[gecode-users] constraint graphs via boolvars

Mikael Zayenz Lagerkvist zayenz at gmail.com
Fri Jun 2 09:52:19 CEST 2006


On 5/31/06, Martin Mann <mmann at informatik.uni-freiburg.de> wrote:
> Greetings,
>
> I m currently thinking about an implementation of a more or less
> bruteforce implementation of a binary constraint graph. my idea is like
> that:
>
> 1) i ve got an array of n IntVars = D[0..n-1]
>
> 2) a BoolVar derived subclass EdgeVar manages 2 indices in (0..n-1) in
> addition to the normal BoolVar data
>
> 3) for each binary constraint c I introduce an EdgeVar connected to a
> corresponding reified constraint
>
> 4) i create an adjacency list to represent the constraint graph
>
> so far no prob..
>
> now i want that:
> - if an EdgeVar becomes assigned, i remove the corresponding entries
> from the adjancency list
>
> thats the point I m currently stucked ..
>
> whats the best way to do?
> theoretically the constraint graph and therefor the adjacency list is an
> n-ary constraint over the EdgeVars. So my first idea is to derive the
> adjecency list from Gecode::Propagator, to get notified of the
> assignments... but cant find a way to subscribe this "global" constraint
> to the EdgeVars.

In Gecode, there is a difference between a variable and a view. A view
is the entity that propagators use, exposing a read-write interface to
a variable (as opposed to a variable, which has a read-only
interface).

So to get you system to work, you should also create EdgeViews. The
best is probably to look at how BoolViews are done.

If you want to know more about views in general and what they can be
used for, see [1].

Cheers
Mikael

[1] http://web.it.kth.se/~schulte/paper.html?id=SchulteTack:Advances:2006


-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list