[gecode-users] Var indexes-help

penche21 penche21 penche21 at hotmail.com
Fri Jan 5 22:46:25 CET 2007


Hi,

I am having a problem with referring to a VarArray when the index is not 
integers but Var.
I have VarArrays A,B,C and I need the constraint A[i] = B[c[i-1]]

I tried;

1) rel(this, A.get(i), IRT_EQ, B.get( (C.get(i-1) ) )

C.get(i-1) works fine as i is an integer. but B.get( (C.get(i-1) ) stucks as 
(C.get(i-1) returns a Var.

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);

This does not work either.
Because, I think, element makes B[c[i-1] to get the value of x. but i need 
the reverse.

In short, I need to express A[i] = B[c[i-1]] where all A,B,C are VarArrays 
and could not succeed.

Thanks in advance!

_________________________________________________________________
Her yönüyle sohbetin tadi ancak Messenger ile çikar! 
http://messenger.msn.com/?mkt=tr&DI=3490&XAPID=2584





More information about the gecode-users mailing list