I am trying to build a constraint of the form x[i j] +x[j i] <y[i][j]
where x
is a decision variable if arc ij
is used.
The arcs are defined in terms of tuples. However, not all arcs are available in that [2 3]
is presented while [3 2]
is not.
y[i][j]
is a decision variable too but it is using nodes (not tuple values) representing if the two nodes are covered by the same trip or not.
How can I write this constraint?
Note: When I run it using this constraint, it uses only same arc tuples
forall(i,j in Setlocations : i < j && i!=j )
forall( g in Graph : g.o==j && g.d==i )
forall(m in Graph : m.o==j && m.d==i)
x[g] + x[m] <= z[i][j] ;