Reputation: 73
I get an error in a OPL model when I use that constraint:
forall (j1,j2 in p: row[j1]==row[j2] && j1<j2)
where row is a variable:
dvar int row [p];
The error is like this:
Decision variable row not allowed.
I don't know why this is not possible, but how can fix this problem?
Upvotes: 1
Views: 547
Reputation: 10062
The condition is slicing should be bound and should not contain any decision variable. You should rely on logical constraints:
range p=1..4;
dvar int row[p] in p;
subject to
{
forall(j1,j2 in p) ((row[j1]==row[j2] ) => (row[j1]>=2));
}
This works fine.
Upvotes: 2