[gecode-users] Using/Implementing Advisors

Mikael Zayenz Lagerkvist zayenz at gmail.com
Fri Oct 10 12:01:29 CEST 2008


On Fri, Oct 10, 2008 at 5:55 AM, David Przybilla <paranoic.pum at gmail.com> wrote:
> Is there any document about how to use/implement Advisors in Gecode?

There is no introductory documentation. The design and reasoning
behind advisors is reported in "Advisors for Incremental Propagation"
[1]. For examples of how to use advisors there are some propagators
that use them, for example the layered graph propagator (for regular
constraints, gecode/int/extensional/layered-graph.icc), the GAC-Schema
propagator (table constraints,
gecode/int/extensional/incremental.icc), and the Boolean linear
in-equation propagator (gecode/int/linear/bool-int.icc).

In general (not knowing what you intend to use it for), the typical
case is that a set of subscriptions to variables are replaced with a
corresponding set of advisors that react to modifications to the
variables. Typical use-cases might be to maintain some propagator
state and/or avoid scheduling the propagator when no propagation can
be done. There are a couple of things to keep in mind when writing a
propagator that uses advisors:
 * The advise-function should follow the information in the documentation [2]
 * The delta-information may be empty if the modifications to the
variable is very complex.
 * The propagator should take care to recognize when it is subsumed.
 * If an initial run of propagation is needed, a propagator not using
subscriptions needs to schedule itself on creation.
 * Advisors are maintained in propagators using a Council, and if
needed are accessed using the Advisors-iterator.

And also, as always when doing a propagator, be sure to test it thoroughly.

Cheers,
Mikael

[1] http://www.gecode.org/paper.html?id=LagerkvistSchulte:CP:2007
[2] http://www.gecode.org/gecode-doc-latest/classGecode_1_1Propagator.html#93f6a78f3613c3afa9a7afe7984da89d

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




More information about the gecode-users mailing list