[gecode-users] Getting domain values after posting

Efstratios Kalogirou efkalog at gmail.com
Tue Mar 28 17:35:20 CEST 2006


Hi all,

I am trying to get the remaining (valid) values and the size of the domain
of a variable after posting some constraints (assuming that due to the
constraints some values inside the domain are no longer valid). It seems
that everything is fine when I don't use any BoolVar to wrap the contraint.
For example:

IntVarArray q(this,1,0,10);
post(this,q[0]==3);
cout<<"The size of the domain is now "<<q[0].size()<<endl;

In the above case the size of the domain is indeed 1 and the solution is
correctly the value 3.

But things are different when I try to wrap the equality constraint in a
BoolVar:

IntVarArray q(this,1,0,10);
BoolVar wrapper(this,0,1);
rel(this,q[0],IRT_EQ,3,wrapper,ICL_BND);
post(this, wrapper==1);
cout<<"The size of the domain is now "<<q[0].size()<<endl;

In the latter example I get again the corrent solution 3 but after posting
the constraint the size of the domain remains 11 and doesn't shrink to 1 as
I would expect.

Since I am solving problems using the second way I am wondering if there is
a way to shrink the domain of the variable after posting as showed in the
second example. Also how can I get all the valid values of the domain of a
variable after posting? I assume this can be done by using iterators but I
am not certain how exactly to relate the iterator with the IntVar or the
IntSet that represents the variable, so any enlightening on that, would be
highly appreciated.

Best,
Stratos Kalogirou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20060328/0810fb34/attachment.htm>


More information about the gecode-users mailing list