I am trying to define a constraint containing summation over two indices, k and t.
for i in data.I
for j in 1:length(data.P[i])
@constraint(m, w[i, j, length(data.T[data.P[i][j]])]/(1+sum(data.A[i][k][t] for k in 1:length(data.P[i]), t in data.T[data.P[i][k]])) <= s[i, j])
end
end
I get the following error in running the code:
ERROR: LoadError: UndefVarError: k not defined
I have implemented the same model in OPL for CPLEX in the same way, and this was not an issue. Am I not allowed to introduce such variable as an index in the summation, then use it subsequently as an index to an array within the same sum() as I am trying to do above?