[gecode-users] Limiting some combinations of variables

Conrad Drescher conrad.drescher at gmail.com
Fri Jun 7 10:37:35 CEST 2013


Hi,

2013/6/6 Pascal Francq (Mailing lists) <mailing-list at francq.info>

> Hi,
> I have a question regarding how to avoid some combinations of variables
> to test. I give here a simple example:
> 1. I have four IntVar a,b,c and d.
>

Gecode-matters aside I think that this


> 2. I want to allow a=2*b=2*c only if a==1 and d==0.
> If have try to encode this constraint with a code that looks like:
>         BoolVar tmp;
>

doesn't say the same as this:


>         tmp=expr(home,(a!=1)&&(a==2*b)&&(a==2*c)&&(d==0));
>         rel(home,!tmp);
>

If I understand your 2. correctly it says:

neg (a = 2*b /\ a = 2*c /\ (a != 1 \/ d != 0))

Hence I think tmp should be something like

expr(home,(a==2*b)&&(a==2*c)&&((a!=1)||(d!=0))

HTH
Conrad


> But it seems that it does not try the only combination allowed.
> Is this the correct way ?
> Thanks.
> --
> Dr. Pascal Francq
> Belgium
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130607/20faaaf8/attachment.html>


More information about the users mailing list