[gecode-users] question about posting of linear expressions

Guido Tack tack at gecode.org
Thu Jul 8 22:08:20 CEST 2010


Kish Shen wrote:
> 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);
> ...
> }

Is that a typo, or do you actually assign to reif twice?  If you want to express vBool[b] <-> c, you should use
post(*solver, tt(equiv(solver->vBool[b],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.

That is slightly strange.  I tried to reproduce this with a simple example, but there it seems to work.

Cheers,
	Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/







More information about the users mailing list