Re: [Gurobi] Unable to remove constraints from the model

16 views
Skip to first unread message

Tobias Achterberg

unread,
Feb 15, 2018, 3:08:54 AM2/15/18
to gur...@googlegroups.com
You should avoid identifying constraints by their name. Instead, just collect the
constraint objects returned by m.addConstr() in your own array and use them to discard the
constraint again from the model. Like this:

for i in range(5):
constr[i] = m.addConstr(x[i] + y[i] <= 1)

for i in range(5):
m.remove(constr[i])


Regards,

Tobias
Reply all
Reply to author
Forward
0 new messages