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


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Gecode users mailing list
[EMAIL PROTECTED]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to