[gecode-users] Sets difference
Guido Tack
tack at ps.uni-sb.de
Fri Feb 29 18:13:57 CET 2008
Mauricio Toro wrote:
> I am trying to make a little program for set's difference.
> I found some info at sudoko's example.. but I have not
> been able to make the difference work :(
>
> I have this code:
>
> SetVar a = SetVar(this);
> SetVar b = SetVar(this);
> SetVar c = SetVar(this);
> SetVarArray answer = SetVarArray(this,2);
>
> dom (this, a, SRT_EQ , 1, 5);
> dom (this, b, SRT_EQ , 3, 10);
>
> //c = a - b
> // answer = c ??
> rel (this, a, SOT_MINUS, b, SRT_EQ, c);
> rel (this, SOT_UNION, answer, c);
>
>
>
>
> //SET_VAR_MIN_CARD With smallest unknown set.
> //SET_VAL_MIN Select smallest value in unknown set
> branch(this, answer, SET_VAR_NONE, SET_VAL_MIN);
As a is {1,2,3,4,5} and b is {3,4,5,6,7,8,9,10}, the difference is
{1,2}, and answers should be constrained to two sets answers[0] and
answers[1] such that their union is {1,2}. What exactly is your
question?
Guido
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080229/12fa6503/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2436 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080229/12fa6503/attachment.bin>
More information about the gecode-users
mailing list