Retriving dual values from relaxed MIP
回答済みHi,
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
-
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
サインインしてコメントを残してください。
コメント
2件のコメント