I am going to try those ideas !! And.. do you have any suggerence to do the same but with SetVars instead of IntVars?
Thanks 2008/6/16 Guido Tack <[EMAIL PROTECTED]>: > Mauricio Toro wrote: > > Hello all, >> >> I am doing an application with Gecode using several Spaces. >> I need to copy the domain from IntVars and SetVars from one Space to >> another. >> But, once I copy the domain, the old space is deleted, therefore I do not >> want some sort of "channel" constraint. >> >> For example: >> >> Space * space1; >> IntVar x(space1, 1,10); >> IntSet y; >> copythedomain(x,y); >> > > What do you mean here, that the set y should reflect the current domain of > x? > > //do some computation >> delete space1; >> Space * space2; >> IntVar z(space2,1,100); >> copythedomain(z,y); >> > > And now, what should the result be? Do you expect y to be overwritten with > the domain of z, or intersected? Or do you expect z to be constrained to > the value of y? (I guess the latter) > > //do some computation >> delete space2; >> >> I tried with these constraints: >> dom(space1,x,y); dom(space2,z,y); >> But they did not work. >> > > An IntSet is never modified by a call to dom, after all, it's not a > constraint variable! It works exactly the other way around: the variable > domain is constrained to be a subset of the IntSet. > > What can I do? >> > > The code is not tested, but this is approximately how it should work: > > void copythedomain(Space* home, IntVar from, IntVar to) { > IntVarRanges fromR(from); > IntSet fromS(fromR); > dom(home, to, fromS); > } > > Note that home has to be the space that "to" lives in, and you don't need > the space that "from" lives in. > > Cheers, > 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
_______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users