[gecode-users] Computing Variable Domains

Max Ostrowski ostrowsk at cs.uni-potsdam.de
Wed Aug 8 13:41:44 CEST 2012


Sorry for reposting an old question. I'm just cleaning up my code and
noticed that i still not managed to use gecode's functionality to
precompute domains of IntVar.
So, given a constraint "(a>5 /\ a<10) \/ (a>100 /\ a<105)"
I want to precompute the domain of "a".
I'm simply not able to find out how the Ranges iterators are used.
How to i create a range "5..inf" and a range "-inf..10"
How do i create the intersection of both.
And finally how to set the domain of IntVar x to this range then.


I tried to grep the gecode code and the examples but was not able to
find any.

Sorry again for reposting this, i'm ashamed.

Best,
Max





    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-boun... at gecode.org [mailto:users-boun... 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20120808/1dd5c2dc/attachment.html>


More information about the users mailing list