Reputation: 6086
I'm using Gurobi 7.0.2 (+ Python 3.5, i.e., gurobipy
) to solve some hard optimization problems (MIPs). Finding optimal results usually takes days or even weeks. It's possible to interrupt Gurobi before having found an optimal solution, i.e., Gap > 0%, and the currently best solution will be returned.
However, it would be much nicer to retrieve such an intermediate result with Gap > 0% but without completely interrupting Gurobi. Gurobi should continue trying to improve the current solution, but I could already start working with the intermediate solution.
Is this possible somehow? If not, please add it to the next Gurobi version.
Upvotes: 4
Views: 1698
Reputation: 5653
Write a callback function, with where==MIPSOL. Then call Model.cbGetSolution()
; see the sample code for Model.cbGetSolution().
Upvotes: 2