Hi there,
I think using the element constraint is the correct choice.
Maybe the little example I attached will help you out.
At least you can use the element constraint to model

B[C[i-1]]=A[i]

and indeed the alg also does

A[i]=B[C[i-1]]

see http://www.gecode.org/gecode-doc-latest/group__TaskIntIntElement.html

> 2) I also tried 'element' to express this constraint
>
> Int Var x;
> element(this, B, C.get(i - 1), x);
> rel(this,A.get(i),IRT_EQ,x);

So this was quite right, but you can directly use

 element(this, B, C[i - 1], A[i]);

so you don't need the rel constraint.

If there are any further questions, let us know.
:-D
Cheers
Patrick

Attachment: arrayex.cc
Description: Binary data

_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to