# [gecode-users] Computing Variable Domains (Integer)

Christian Schulte cschulte at kth.se
Thu Jul 21 19:14:44 CEST 2011

```The best is to look for examples in the code ;-) Just grep for it.

MinMax is nothing but a base-class for other classes and cannot be used directly. Look for the iterators that take arrays as input, they will do what you want.

Best
Christian

--
Christian Schulte, KTH, web.it.kth.se/~cschulte/

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf Of Max Ostrowski
Sent: Thursday, July 21, 2011 10:49 AM
To: users at gecode.org
Subject: [gecode-users] Computing Variable Domains (Integer)

Hello everybody,

as variables in gecode need to have a domain, i want to compute the domain of the variables automatically, given the constraints.
I could also let the constraints restrict the domains of my variables, but as i understood, this is similar to propagation and could take some time.
There i want to restrict the domain manually for all unary constraints.
So, given a constraint "(a>5 /\ a<10) \/ (a>100 /\ a<105)"
the domain should be {6..9,101..104}.
Therefore i wanted to use some Gecode classes to compute the intersection/union/complement etc.. of the sets.
Am i right that i can use the Int::Iter::Ranges classes for this?
And second, how do they work?
So in this case, i would create a

IntSet a1(Gecode::Iter::Ranges::MinMax(5+1,Int::Limits::max));
IntSet a2(Gecode::Iter::Ranges::MinMax(Int::Limits::min, 10-1));

And them somehow the intersection of this.
But i was neither able to initialize a set with a Range, nor to combine Ranges recursively.

So, how do i do this using the helping classes of gecode.

Best,
Max

--
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone

_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users

```

More information about the users mailing list