I'm modelling a routing problem in CPLEX opl. I am struggling to implement a certain constraint in CPLEX, which sums a decision variable X over a set of indexes j, and this ∀i ∈ V, where V = C ⋃ S.
The constraint is the following: sum(j ∈ (1..10)) Xij < 1 ∀i ∈ V I implemented this in CPLEX as follows:
forall(i in customers, i in stations) { sum(j in reach) X[i][j] < 1; }
Customers refers to C, stations refers to S, and reach refers to the range of 1..10. However, it seems impossible to use the same index (i) twice in the forall statement.
Could anyone help me to solve this problem. Thanks a lot!
Instead of
you could write
I tried
and that works