Change the constraints name iteratively to JUMP model

I am new to JUMP model and Julia,

I have created a JUMP model, with a constraint inside a while loop

I wanted to change the constraint name in each iteration and optimize the model again

for example:
if i=1
@constraint(model, constraint_1[t=1:nt], flow<= maxflow])


again if i=2
@constraint(model, constraint_2[t=1:nt], flow>= minflow])

Hi @ayodyas, I’m not really sure what you mean by changing the constraint names? Do you want to add new constraints? Or delete constraint_1 and add constraint_2?

Is flow a variable and maxflow a constant? If so, you can use set_lower_bound and delete_upper_bound to add and remove different bounds.

Otherwise you can delete constraints:

p.s., You might want to take a read of Please read: make it easier to help you. It explains how to format your code, and it’s easier to help if you can provide a fully reproducible example.