Mauricio Toro wrote:

Sorry... I meant this

2008/2/14, Guido Tack <[EMAIL PROTECTED]>:
Am 14.02.2008 um 21:23 schrieb Mauricio Toro:
How can I make this constraint?


int const x[] = {0,2,5,8,9,10};
answer = IntVarArray(this,n,1,11);

for (int i = 0; i < n-1; i++){
                // x[i] - x[i+1] = answer[i] - answer[i+1]

for (int i=0; i<n-1; i++)
  post(this, x[i] - x[i+1] == answer[i] - answer[i+1]);

should do the trick (you have to include gecode/minimodel.hh for this to work).

Cheers,
        Guido

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

Reply via email to