[gecode-users] Custom constraint to external progam

Mikael Zayenz Lagerkvist zayenz at gmail.com
Fri Nov 14 07:02:56 CET 2008


On Thu, Nov 13, 2008 at 1:24 PM, Tias Guns <tias.guns at cs.kuleuven.be> wrote:
> Cool, I didn't know adding a custom propagator could be as easy as
> including the implementation in your model directly !

Adding a new propagator works just like adding a new branching. In
contrast to branchings though, there are very few standard problems
where a custom propagator is needed, so we don't have any examples
with it. Note that the DisEq-propagator can be implemented using
            IntVarArgs ia(2);
            ia[0] = y; ia[1] = z;
            IntVar index(*this, 0, 1);
            element(*this, ia, index, x, ICL_DOM);
so there is no immediate need to implement it before it is known to be
a performance problem.


> Note that in the example the 'propagate' function misses the ModEventDelta
> parameter:
> line 57 should be:     virtual ExecStatus propagate(Space* home,
> ModEventDelta);
> line 93 should be:   DisEq<View>::propagate(Space* home, ModEventDelta) {

Yes, that is quite right, thanks. I haven't compiled this code since
ModEventDelta's were introduced, so I forgot about them.


> Thanks for the tip,

You're welcome.


/Mikael

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




More information about the gecode-users mailing list