[gecode-users] Difference between rel(), post() and post(tt()) ?

Guido Tack tack at ps.uni-sb.de
Sat Jan 10 20:50:26 CET 2009

Jeffrey wrote:

> Are the following three constraints equivalent?
> Objective: To extract the d.val() th element in tmpArray into an  
> IntValArray groupStudentVal so that further constraint can be  
> written on it.

What's an IntValArray?

>  tmpArray  is int[]
> groupStudentVal is IntValArray
> d is SetVarGlbValue of a SetVar

What's a SetVarGlbValue?

>     (1) post(this, tmpArray[d.val()] == groupStudentVal[index]);
>    (2) rel(this, groupStudentVal[index], IRT_EQ, tmpArray[d.val()]);
>    (3) post(this, tt(groupStudentVal[index]==tmpArray[d.val()]));

All three statements should do the same thing.  However, I don't  
understand what d.val() is, and if d is an IntVar, you cannot use its  
value when posting constraints, as the value will only be determined  
after solving the problem.


More information about the gecode-users mailing list