[gecode-users] Question About Function of Gecode with SetVar

Guido Tack tack at ps.uni-sb.de
Mon Jul 6 08:19:25 CEST 2009


Hi Carlos,

there seem to be several problems in your model.  First, you constrain  
t[0] instead of t[i].  Then, dom(this,t[i],SRT_EQ, i+1, i+3) states  
that t[i] is equal to the set {i+1,...,i+3} - this means that all your  
variables are assigned to fixed sets right from the start.  I guess  
you rather want them to be subsets of {i+1,...,i+3}?  Remember that  
the domain of a set variable is a set of sets, and its value is a  
set.  Third, I guess you mean Sets_Possibles instead of Dia1SetVar.   
If you can't fix the problem now, please send us code that actually  
compiles.

Cheers,
	Guido

Carlos Cerrano wrote:

> I offer excuses for the wrong message, this is the correct message:
> I am trying to use Gecode for  solve this  problem:
> I have two SetVar  and each one  must  satisfy  the constraints:
> 1.To have a domain in an interval defined   between your position in  
> the SetVarArray and  your position + n , for example , if  n=3:
>   dom(setvar1)= {1..4}
>   dom(setvar2)={2..5}
> 2.The domain of each variable must be  Subset  of other SetVar  
> called  Sets_Possibles.
>
> I believe that this model:
> class model : public model {
>         public:
>                 SetVarArray t;
>                 SetVar Sets_Possibles;
>                 void explore(Space* root, Gist::Inspector* i){
>                         (void ) Gecode::explore(root,i);
>                 }
>
>                 model():t(this,2,IntSet::empty, IntSet(1,10),4,4),  
> Sets_Possibles(this,IntSet::empty,1,6,4,4)
>                 {
>                         for(int i=0; i < 2; i++){
>                                 dom(this,t[0],SRT_EQ, i+1, i+3);
>                                 rel(this,t[0], SRT_SUB,Dia1SetVar);
>                         }
>                         branch(this, t, Gecode::SET_VAR_NONE,   
> SET_VAL_MAX);
>                 }
>
>                 model(bool share, model& m) : Space(share,m) {
>                     t.update(this, share, m.t);
>                     Sets_Possibles.update(this, share,  
> m.Sets_Possibles);
>                 }
>         ....
>
>
> Should throw the solutions t[0]= {1..4} t[1]= {2..5}, but I do not  
> obtain any solution,so, someone can help me with an idea  about why  
> it does not work.
> Thanks for your great patience and any colaboration.
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list