[gecode-users] Modulo operator

Malcolm Ryan malcolmr at cse.unsw.edu.au
Tue May 13 05:32:53 CEST 2008


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





More information about the gecode-users mailing list