i want to build an MEXCLP using Julia/Jump in VS Code. Everything is working fine with the declaration except for this particular constraint.
I tried this declaration: @constraint(model, c1, sum(x[j] for j in W[i]) >= sum(y[i,k] for k in 1:p) for i in V)
But I get an error. Is this declaration correct for the picture I added, which shows the constraint? Maybe I did something wrong with the declaration of p, W and V so it doesn’t work?
The condition j != j‘ should be separated with ;, not ,, see Containers · JuMP
Otherwise, you just create another dimension indexed by the Booltrue or false so you will actually add the constraints when it is false.
constraint(model, c10[u in setdiff(U, [1]), sum(sum(V[j,j‘,u] for j in J) for j‘ in J if j !=j‘) <=F)
A , means “for all”, a ; means “if”. So in your second example, you need a comma.
In your first example, j was not a constraint index but an index of the for loop so it’s the classical Julia syntax