you have found a bug, involving indicator constraints and conjunctions. A workaround is to replace the conjunction by the keyword "ordered" in the forall:
forall(ordered i,j in 1..n) {
(a[i]==a[j]) => x==0;
}
Another workaround is to use "if" instead of "=>" :
forall(i,j in 1..n) {
if (i!=j && a[i]==a[j]) x==0;
}
We will get in touch with the OPL dev team who will investigate and improve in a next release.
0
Alex Fleischer
On
I would use slicing
int n=6;
int a[1..n] = [12,0,10,4,10,8];
dvar int x in 0..1;
maximize x;
subject to
{
forall(i,j in 1..n:(i!=j) && (a[i]==a[j]))
(x==0);
}
you have found a bug, involving indicator constraints and conjunctions. A workaround is to replace the conjunction by the keyword "ordered" in the forall:
Another workaround is to use "if" instead of "=>" :
We will get in touch with the OPL dev team who will investigate and improve in a next release.