I'm trying to write a constraint in the from of the following (also attached):
sum([s,i], x[i,j,s,p] ) = sum([s,k], x[j,k,s,p] ) for all j in N\{0,n}, p in P
I already have all possible combinations of (i,j,s,p)
stored in a set Xs
and X0ns
which a vector of such 4-tuples.
Thus I tried to write it down as
@constraint( model, [p in P, jj in X0ns],
sum(x[(i, j, s, p)] for (i, j, s, p) in Xs if j == jj)
== sum(x[(j, k, s, p)] for (i, j, s, p) in Xs if j == jj)
This gives me an Error. On top of that I think this is not correct way of writing. Because I did not include a summation on S
anywhere. Is it needed?
How can I build this kind of constraint?