Hi, I am trying to set and get constraint names but am running into some errors. I originally built the model without naming the constraints but now I want to name them. Take for example,
for i in 1:timerange @constraint(m, cost[i,1] == s[i,1] * price[i]) end
Then I tried to name it with
for i in 1:timerange @constraint(m, con[i], cost[i,1] == s[i,1] * price[i]) end
but I got
LoadError: An object of name con is already attached to this model. If this is intended, consider using the anonymous construction syntax, e.g., x = @variable(model, [1:N], …) where the name of the object does not appear inside the macro.
This error happens no matter what I name the variable. However when I do constraint_by_name(m,“con”) it actually shows the constraint correctly… Is there a way to conveniently name all the constraints without causing the error?