I have a heuristic for a difficult MIP I am solving. I'm using two processes, similar to How do I inject a solution calculated in a separate process? – Gurobi Support Portal . Although my heuristic is fast, there seem to be two problems that prevent it from making the optimization process fast. First, Gurobi takes a long time before calling the callback with where == MIPNODE (>10 mins after root relaxation finished).
Second, although Gurobi realizes my solution in feasible, and returns the right objective from cbUseSolution(), it doesn't seem to do anything with it.
Here's a snippet from the log:
Gurobi Optimizer version 9.1.1 build v9.1.1rc0 (linux64)
Thread count: 48 physical cores, 96 logical processors, using up to 32 threads
Optimize a model with 648960 rows, 9440257 columns and 28327680 nonzeros
Model fingerprint: 0xa0754ebb
Model has 638976 SOS constraints
Barrier solved model in 5 iterations and 157.23 seconds
Optimal objective 2.00000000e+01
Root crossover log...
223681 variables added to crossover basis 215s
225769 DPushes remaining with DInf 0.0000000e+00 219s
1217 DPushes remaining with DInf 0.0000000e+00 341s
126 DPushes remaining with DInf 0.0000000e+00 362s
0 DPushes remaining with DInf 0.0000000e+00 369s
8 PPushes remaining with PInf 0.0000000e+00 369s
0 PPushes remaining with PInf 0.0000000e+00 370s
Push phase complete: Pinf 0.0000000e+00, Dinf 1.2060309e-09 370s
Root simplex log...
Iteration Objective Primal Inf. Dual Inf. Time
225770 2.0000000e+01 0.000000e+00 0.000000e+00 370s
225770 2.0000000e+01 0.000000e+00 0.000000e+00 374s
Solved with barrier
Root relaxation: objective 2.000000e+01, 225770 iterations, 244.84 seconds
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 20.00000 0 9768 - 20.00000 - - 378s
H 0 0 30.0000000 20.00000 33.3% - 803s
MIPNODE at 1068.8488900661469
Solution objective value: 20.0
It doesn't print anything else for at least the next hour. Since the heuristic solution turns out to be optimal in this case, I would expect Gurobi to terminate almost with the OPTIMAL status code immediately after the cbUseSolution() call.
Here's the version of the callback I'm using to reproduce this issue.
def callback(model, where):
if where == GRB.Callback.MIPNODE:
print("MIPNODE at", model.cbGet(GRB.Callback.RUNTIME))
with open("heuristic.txt", "r") as f:
for line in f:
l2 = line.rstrip('\n')
v = model.getVarByName(l2)
print "Could not find", l2
print("Solution objective value:", model.cbUseSolution())
Please sign in to leave a comment.