[gecode-users] count/atleast: partial propagation towards y ?

Mikael Zayenz Lagerkvist zayenz at gmail.com
Sun Feb 3 13:08:38 CET 2008


On 2 feb 2008, at 18.15, Didier Loiseau wrote:
> I am trying to post a propagator for the constraint
>   x' = x or x' = epsilon
> with x and x' integer variables and epsilon some constant not in  
> dom(x).
>
> I first thought to use reified equality constraints but it would  
> achieve
> very few propagation (for example, removing values from x would not
> remove them from x' as long as epsilon is in dom(x'))
<snip>
> If what I am trying to do is not possible using count, what is the  
> best
> way to implement it, achieving domain consistency ?

Hi,

You can model this using set-constraints.  Given are variables x', x,  
and epsilon. Using a temporary set-variable S, add the following  
constraints

	rel(this, SOT_DUNION, [x,epsilon], S)
	
	rel(this, S, SRT_SUP, x')

The first will make S be the union of the (disjoint) domains of x and  
epsilon. The second makes sure that x' is a member of that set.


If you are concerned with efficieny, then you could add a custom  
propagator for this constraint.


Cheers,
Mikael




More information about the gecode-users mailing list