Hello,
I am new here and a relatively new Julia user. I have a constraint in a model I am writing where I have variables twice indexed over the same set, but I need the indices to iterate mutually exclusively. The code is:
(ThreeZH2 is the model name, variables start with ‘v’, constraints start with ‘c’, say ‘vTNUM’ is a variable, ‘cTCAP’ is a constraint)
@constraints(ThreeZH2, begin
cTCap[t in T, l in L, n in N, m in N],
transport.max_flow[l,n,m] * (vTNUM[n,m] + vTNUM[m,n]) >= vFLOW[t,l,n,m] + vFLOW[t,l,m,n]
cTSym[l in L, n in N, m in M]
vTNUM[n,m] == vTNUM[m,n]
end)
for context, variables start with ‘v’ such as vTNUM is a variable. The indices n and m are both indexed over the set ‘N’ which is say 1:3, or in general 1:p where p is some number (For my model N = 1:3).
The problem is if I run this constraint n and m can both equal the same number at the same time, say n = 2 and m = 2. I need the indices n and m to be mutually exclusive where m does not equal n. I’m sorry if I am not explaining this well, I hope the problem statement is clear. I feel like the solution should be simple but I cannot figure it out. Any suggestions would be very helpful! Sorry if there is another post with this solution but I could not find one.
Thank you!