Naming multiple constraints

Hi,
In JuMP, how do I get the name of a constraint by which I can refer to, if I haven’t named it already?
Also, for multiple constraints, how do you name them? For example:

for i = 1:5
     @constraint(m, con[i=1:5], x[i] + y[i] <= 15)
end

So in this case there are 5 constraints and I want to name each one but it gives me an error saying that an object of this name is already attached to the model. I’ve tried several names and variables but it doesn’t work.
Please help

I think you can simply drop the for loop. If you put con[i=1:5] into the @constraint macro invocation, then it will automatically create 5 constraints.

1 Like

Yes that worked thanks!