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, Mauricio 2008/5/14 Guido Tack <[EMAIL PROTECTED]> > 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 you advise? > > As there's no built-in propagator for the modulo constraint, you have > to decompose into other constraints, so your solution should be ok. > After all, it's just a linear equation with constant coefficients > 1*A-1*B+1*C-n*X=0, right? And X will be determined as soon as A,B,C > are, you don't even have to include X in the branching. > > Guido > > > _______________________________________________ > Gecode users mailing list > [EMAIL PROTECTED] > https://www.gecode.org/mailman/listinfo/gecode-users > -- Mauricio Toro Bermudez Estudiante de Ingeniería de Sistemas Pontificia Universidad Javeriana, Colombia Stagiare à l'Ircam 1, place Igor-Stravinsky 75004 Paris, France de 2008 à 2009
_______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users