-------- Original-Nachricht -------- > Datum: Mon, 18 Jul 2011 10:37:32 +0200 > Von: Guido Tack <[email protected]> > An: Max Ostrowski <[email protected]> > CC: [email protected] > Betreff: Re: [gecode-users] Initializing domain of IntegerVars
> On 18 Jul 2011, at 10:21, Max Ostrowski wrote: > > > Hello, > > > > currently i have to create some IntegerVariables and some constraints, > and i'm doing this using the IntVar/2 constructor, restricting the variables > domain. > > > > Due to some design decisions it could be necessary to change this to > something like: > > > > IntVar x(*this, MIN_INT,MAX_INT); > > You should use Gecode::Int::Limits::min and ::max here (otherwise you'll > get an exception). Sorry, this was only Pseudo-code ... > > > dom(*this, x,2,12); > > or worse > > BoolVar a,b; > > dom(*this, x,2,12, a); > > dom(*this, x,24,42, b); > > rel(*this, a, BOT_OR, b, 1). > > > > > > Afterwards i will do post further constraints and do search. > > Is this bad in terms of performance, and if, why. > > In some cases it may lead to less efficient propagators being posted (e.g. > linear equation propagators exist in different versions depending on the > variable domains). In the case of the BOT_OR, it may be even worse if you > search the x variables before the Boolean variables, because search will try > everything in min..max instead of just the two possible sets of values > (see below). > > > (I can understand that i have to post the dom constraint first, because > sending a constraint already does some propagation. > > Yes, dom constraints have an immediate effect. > > > Furthermore: does the second variant (with the BOT_OR) also restrict the > domain of the variable?) > > No, it doesn't (it would require something called constructive > disjunction, which the BOT_OR constraint in Gecode cannot do). In this case > you'll > have to preprocess your input data yourself to determine the smallest > possible domains. > > Cheers, > Guido Thanks a lot for this information. Max > > -- > Guido Tack, http://people.cs.kuleuven.be/~guido.tack/ > > > > > -- Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
