Is there a workaround in order to express this model correctly:
using CP;
int fooSize[0..3]=[2,2,3,2];
dvar interval foo[t in 0..3] size fooSize[t];
dvar int bar[0..3] in 0..1;
dexpr int stop = max(t in 0..3) endOf(foo[t]);
minimize stop;
subject to{
all(ordered u,v in 0..3: bar[u]==bar[v])
startOf(foo[u])>=endOf(foo[v]) || startOf(foo[v])>=endOf(foo[u]);
}
OPLIDE tells me that the decision variable bar
is not authorized. I also tried:
forall(ordered u,v in 0..3)
(bar[u]==bar[v]) => (startOf(foo[u])>=endOf(foo[v]) || startOf(foo[v])>=endOf(foo[u]));
But it does not seem to work, the solver just hangs for hours. By the way how am I supposed to debug an OPL model? Please tell me if you need specific information.
Generally speaking, is there a way to condition a constraint based on the value of a decision variable?