Toro
Sent: Monday, August 25, 2008 3:40 PM
To: gecode list
Subject: Re: [gecode-users] Modulo operator
Hello,
I am trying to write this reified constraint.
(a mod c = d) <-> b
where a,c,d are IntVars and b is BoolVar.
In the past, you recommend to represent
A = (B - C) mod n
Hello,
I am trying to write this reified constraint.
(a mod c = d) <-> b
where a,c,d are IntVars and b is BoolVar.
In the past, you recommend to represent
A = (B - C) mod n as A = (B-C) + n * X.
But, now I am wondering how can I
write a reified propagator for (a mod c = d) <-> b.
Thanks,
Maur
Malcolm Ryan wrote:
> I'd like to express the constraint:
>
> A = (B - C) mod n
> 0 <= A < n
>
> for variables A,B,C and constant n.
>
> How would you advise doing this? The obvious answer is to add an extra
> variable X:
>
> A = (B-C) + n * X
> 0 <= A < n
>
> but I'm not sure if this is best. Can
I'd like to express the constraint:
A = (B - C) mod n
0 <= A < n
for variables A,B,C and constant n.
How would you advise doing this? The obvious answer is to add an extra
variable X:
A = (B-C) + n * X
0 <= A < n
but I'm not sure if this is best. Can you advise?
Malcolm
__