Hi,
Could you please tell me how I can model the following in CP optimizer?
W is the array of variables.
n is a constant value
for each 1<=p<=n1
if W[p]=0 then [all wj]s must be equal to 0 for (p+1<=j<=n)
I know that I can easily present the constraint as follows:
for (p = 1; p < n; i++)
{
for (j = p; p <= n; j++)
model.add(IloIfThen(env, W[p] == 0, W[j] == 0));
}
but to have a stronger propagation I wanna present the "Then" conditional section using consecutive logical and expressions as follows:
model.add(IloIfThen(env, W[p] == 0, (Wp+1 == 0)&&(Wp+2 == 0)&&(Wp+3 == 0)&& .... (W[n] == 0)));
Topic

Re: Consecutive logical and constraints
20130405T07:59:05ZThis is the accepted answer. This is the accepted answer.Hello,
you cannot have a stronger propagation, both formulations give the best possible propagation.
Nevertheless you can use only O(n) instead of O(n*n) constraints, for example:
for (p = 1; p < n1; i++) model.add(IloIfThen(env, W[p] == 0, W[p+1] == 0)); }
Regards,
Olivier