[gecode-users] reified distinct()?

Mikael Zayenz Lagerkvist zayenz at gmail.com
Mon Nov 26 09:14:15 CET 2007


On Nov 26, 2007 6:58 AM, Malcolm Ryan <malcolmr at cse.unsw.edu.au> wrote:
> I'm looking for a reified version of Gecode.distinct() but there
> doesn't appear to be one. Can anyone suggest a reasonable alternative?

As you already found out, there is no reified version of distinct in
Gecode. What kind of application did you have in mind for it?

The most direct model would probably be a reified decomposition into
not-equals constraints. However, this will only give the same pruning
when distinctness should hold as using ICL_VAL.

Another possibility would be to write a simple propagator that checks
whether the constraint should hold. If so, it can re-write itself into
a distinct-propagator. However, there is no way to re-write
propagators directly in Java, you'd have to post a propagator using
the modelling-interface instead.

As a side-note, there are other global constraints, not currently in
Gecode, which might be interesting to know about. Nvalue constrains a
sequence to take a specific number of values. It is easy to model a
reified distinct using nvalue by reifing whether the number of values
are equal to the number of variables, or less.


Cheers,
Mikael

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




More information about the gecode-users mailing list