[gecode-users] question about posting of linear expressions

Kish Shen kisshen at cisco.com
Thu Jul 8 21:43:09 CEST 2010


Guido Tack wrote:
> 
> No, it should work as you expected.  Could you give us a little more details of the actual code?
> 

Thanks Guido!

First I should say I am still using Gecode version 3.0.2, on Linux. I 
have not updated it since I have had no reason to do so.

The actual code is a bit complicated, and I am using it indirectly (my 
tests are done at the ECLiPSe level, and I have not been debugging this 
at the C++ level). I will try and explain what is happening.

First of all, at the ECLiPSe level, I have only one type of finite 
domain variable, and such variables are normally linked to IntVar. If 
the variable is used as a gecode boolean (as in this case), then the 
ECLiPSe variable is linked to both an IntVar and a BoolVar, with a 
channel constraint linking the two.

The actual code for posting the expression is as follows:
int p_g_post_bool_expr()
{
BoolVar reif;
BoolExpr c;
...
reif = solver->vBool[b];
...
reif = post(*solver, c);
...
}

where vBool is my array of boolean variables (and there is a 
corresponding vInt array). The procedure is called when I post the 
boolean expression.

I have mainly been testing this with reified domain constraints, for 
example,

IntVarArgs vars(size);
BoolVar reif;
...
dom(*solver, vars[i], min, max, reif)

where reif is assigned in much the same way.

I have used the reified domain constraint directly, and this work as 
expected.

What is not working is when I use the domain constraint as a boolean 
expression. What happens is that I post the domain constraint

dom(*solver, vars[i], min, max, reif1);

and a boolean expression:

reif2 = post(*solver, c);

where c = vBool[<index for reif1>]

the problem is that reif2 does not seem to behave as expected.
For example, when the domain is constrained such that the domain 
constraint is true, reif1 is correctly constrained to 1, but reif2 still 
has the 0..1 domain.

As for detecting the domain changes -- after each propagation, the 
entire vInt array is checked to see if there are any domain changes
to the variable, so if reif2's domain was changed from 0..1 to 1, this 
should have been detected.

Cheers,

Kish

-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.



More information about the users mailing list