[gecode-users] Why are my variables not constrained

Max chaosangel at gmx.de
Sat Oct 4 14:36:33 CEST 2008


Furthermore the constraint is never applied.

 x(this,3,0,1500)


 post(this, eqv((x[0] > x[1] + 30), y));
 post(this, x[2] - x[0] == 45);
 post(this, x[0] == 2); // 2 cant be greater than x[1]+30
 post(this, y == 1); // the constrained must hold

 branch(this, x, INT_VAR_SIZE_MIN, INT_VAL_SPLIT_MAX);
 (PS: How do i branch on a single variable (BoolVar y) and where can i 
find such information by myself)

So, the first constraint must aplly, as y is set to 1, it can not apply, 
since 2 > 0 +30 is false

But i do get valid answers, so what am i doing wrong, did i 
misunderstand the eqv?

Tank you in advance and sorry for my clumsiness.

Max Ostrowski





Max wrote:
> At first, thank you for the answers to my other questions.
> As reified constraints seem to be en vogue, i tried them myself:
>
> post(this, x[0] > x[1] + 30);
> post(this, x[2] - x[0] == 45);
>
> This constraints my variables to the following
> x = {[31..1455], [0..1424], [76..1500], [0..1500]}
>
> Now i want to make the first constraint reified
>
> post(this, eqv((x[0] > x[1] + 30), y));
> post(this, x[2] - x[0] == 45);
>
> This constraints my variables to
> {[0..1455], [0..1500], [45..1500], [0..1500]} und y= [0..1]
> So x[0] and x[1] are less constrained, because y is not decided.
> But, if i now post
>
> post(this, eqv((x[0] > x[1] + 30), y));
> post(this, x[2] - x[0] == 45);
> post(this, y == 1);
>
> I do get the same constraints, so why are x[0-1] not constrained
> {[0..1455], [0..1500], [45..1500], [0..1500]} and y= 1
>
>
>
> By the way, is there a smarter way to set y (variables in general) ?
>
> Tank you in advance
>
> Max
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>   





More information about the gecode-users mailing list