Groups
Groups
Sign in
Groups
Groups
Python-MIP
Conversations
About
Send feedback
Help
how to change rhs, then reoptimize
57 views
Skip to first unread message
Li Mike
unread,
Sep 2, 2020, 11:59:15 PM
9/2/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python-MIP
Dear develpoer, suppose we have the following model:
from mip import Model, xsum, minimize, BINARY, IncumbentUpdater
I = range(500)
m = Model("my")
x = [m.add_var(var_type=BINARY) for i in I]
for i in I:
m += x[i] >= 1
m.objective = minimize(xsum(x[i] for i in I))
m.optimize()
After solve the model, I want to change the rhs of the above constraints to zero, and then reoptimize it. How to do it?
Thanks in advance.
Martin Hjelmeland
unread,
Sep 4, 2020, 10:08:17 AM
9/4/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Python-MIP
from mip import Model, xsum, minimize, BINARY, IncumbentUpdater
I = range(500)
m = Model("my")
x = [m.add_var(var_type=BINARY) for i in I]
c = dict()
for i in I:
c[i] = m.add_constr(x[i] >= 1)
m.objective = minimize(xsum(x[i] for i in I))
m.optimize()
for i in I:
c[i].rhs = 2
m.optimize()
Reply all
Reply to author
Forward
0 new messages