[gecode-users] Sets difference
Mauricio Toro
mauriciotorob at gmail.com
Fri Feb 29 18:21:49 CET 2008
Hello,
I made the difference. There was a bug in other part of the code.
But the problem with the ".." representation is that I am getting
too many solutions representing the same, such as:
(1,2..5)
(1,2,3..5)
(1,2,3,4,5)
and I just want to get (1,2,3,4,5).
What can I do ?
thanks
2008/2/29, Guido Tack <tack at ps.uni-sb.de>:
>
> 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
>
>
>
>
>
>
--
Mauricio Toro Bermudez
Estudiante de Ingeniería de Sistemas
Pontificia Universidad Javeriana, Colombia
Stagiare à l'Ircam
1, place Igor-Stravinsky 75004 Paris,
France de 2008 à 2009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080229/41ae12fe/attachment.htm>
More information about the gecode-users
mailing list