Help with incumbent
AnsweredHello everybody.
Is there any command to know how much time did Gurobi spend finding the first feasible solution for a MILP?
Thank you very much.
Alejandro
0
-
Hi Alejandro,
There is no built-in method or attribute to get this information, but it can be obtained with callbacks.
One example code might looks something like
import gurobipy as gp
from gurobipy import GRB
def mycallback(model,where):
if where == GRB.Callback.MIP:
solcnt = model.cbGet(GRB.Callback.MIP_SOLCNT)
if solcnt == 1:
runtime = model.cbGet(GRB.Callback.RUNTIME)
print("Found first incumbent after %f seconds."%(runtime))
m = gp.read("myLP.lp")
m.optimize(mycallback)Best regards,
Jaromił0 -
Thank you!
0
Please sign in to leave a comment.
Comments
2 comments