[gecode-users] Problem with constraint

Ujhelyi Zoltan uz602 at hszk.bme.hu
Sat Aug 9 18:30:22 CEST 2008


Hello all,

we are currently trying to build a static checker system on top of  
Gecode/J 2.1.1. (in an Eclipse environment), and we have found an  
interesting case.

In order to allow us greater flexibility we try to use the Expression  
API (it allows us to build constraints in a hierarchical manner).

I was testing the implementation, and found an interesting final  
result: there were to IntVars, which were supposed to be the same, did  
not have the same final ranges: one of them had {2,4}, but the other  
had {2,3,4}. I tried to trace back the code to look whether the  
constraints were wrong or not, and found the following expression  
building term:

BExpr expression = new BExpr(new Expr(variable1),relation, new  
Expr(variable2));

Tracing the variables variable1 was a new variable, it hadn't been  
constrained yet, while variable2's domain had been limited to the  
values 2 and 4 (and they were the variables mentioned before in this  
letter), while the relation had the value IRT_EQ.

I tried a post of the expression right after it's construction to see  
whether it helps or not:
org.gecode.Gecode.post(space, expression);

It did not solve the problem, but when I replaced the post method to  
the following rel call, the constraint handling was working as I  
expected it before.

rel(space, variable1, IntRelType.IRT_EQ, variable2);

I would like to know, whether this phenomenon is the intentional  
(maybe I do not understand something under the hood), or not. And if  
you could tell me a way to avoid it, I would be very glad.

Thank you very much in advance for your help,
Zoltán Ujhelyi



More information about the gecode-users mailing list