[gecode-users] Var indexes-help

pekczynski at ps.uni-sb.de pekczynski at ps.uni-sb.de
Sat Jan 6 13:57:41 CET 2007


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: arrayex.cc
Type: application/octet-stream
Size: 1931 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20070106/3d14ea20/attachment.obj>


More information about the gecode-users mailing list