There's a bit on iterators in Sect. 23.3 (p 268), but I agree we could add some examples.
Cheers, Guido On 11/01/2013, at 10:44 PM, [email protected] wrote: > Thx a lot, this now works perfectly. > > I'm still not very familiar with your iterators, > would it be possible to have some examples using them > (for computing domains etc...) in your "Gecode Modelling"? > > > Best > Max > > > Quoting Guido Tack <[email protected]>: > >> On 09/01/2013, at 10:51 PM, [email protected] wrote: >> >>> I want to use the information about pruned values from an Integer Variable >>> in another space. >>> >>> So i have a Space with variable x and some constraints. >>> I do propagation, now x is constrained somehow according to the >>> constraints and the propagator strength, e.g. x = {1..3,5..9}. >>> >>> Now i want to create a second Space with a variable y, whose domain is is >>> a copy of the current domain of x. (so that y={1..3,5..9}) >>> >>> These variables do have nothing in common and are not connected somehow by >>> the constraints. >>> >>> I tried to use the IntVar constructor that takes another IntVar or the >>> IntView of x, but i think this is wrong (get segfault when copying spaces). >> >> Right, that won't work. >> >>> So, how do i transfer the domain, without sharing the VarImp. >> >> You have to use iterators. Let's say you want to create a new variable y in >> space s with the domain of x: >> >> IntVarRanges ir(x); >> IntVar y(s,IntSet(ir)); >> >> Cheers, >> Guido >> >> > > > _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
