Retriving dual values from relaxed MIP
AnsweredHi,
I have defined a MIP model that solves a unit-commitment problem. I have first tried the fixed()-method to retrieve the dual values. Now, I want to do the same through relaxing the binary models. However, I need to make sure that they stay between 0,1, what is the best way to do this in Gurobi?
Best
Benedicte
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi,
You could simply change the variable type without impacting the bounds:
import gurobipy as gp
from gurobipy import GRB
with gp.Model() as m:
v = m.addVar(vtype=GRB.BINARY)
m.update()
print(v.LB, v.UB) # Shows 0,1
v.VType = GRB.CONTINUOUS
print(v.LB, v.UB) # Still shows 0,1Kind regards,
Ronald0 -
Also, if using Python, Model.relax()
0
Post is closed for comments.
Comments
3 comments