From: C. <co...@li...> - 2005-06-29 10:57:51
|
Le jeudi 23 juin 2005 =E0 08:35 -0600, ig...@so... a =E9crit : > The scenario of our little application is this: >=20 > int k =3D 4; > int q =3D 2; > Problem p =3D new Problem(); > IntVar a =3D p.makeBoundIntVar("foo",1,3); > IntVar b =3D p.makeBoundIntVar("foo2",1,3); > Constraint one =3D p.leq(a, k);=20 >=20 > We want to create another constraint, saying that if the value of IntVa= r "b"=20 > is (let's say) 5 (and only in this case), then the constraint "one" mus= t be=20 > modified to something like this: p.leq(a, k*(q+1)) > The new constraint is weaker than the older one, so they can't cohexist= .=20 >=20 > We don't want to check explicitly the values, we want to demand all the= =20 > dirty work to choco :) > Is that possible?=20 Hello, Someone probably already answer you... Anyway bellow is a solution: Since what you call the "new constraint" will always be verified (it is weaker that constraint "one") you can post it from the begining... To capture the fact that "5" is a special value you then post the constraint pb.implies(pb.neq(b,5),pb.leq(a,k)) ! Hope it helps, -- Remi |