Terminate when the first BestBd is found
AnsweredI am trying to find the optimality gap of a solution (retrieved from a heuristic). Briefly, my procedure is: 1) find a heuristic solution, 2) feed the solution into Gurobipy MIP formulation as a start (assume, my solution is feasible), 3) wait in front of the screen until a BestBd is found (or take a few coffee breaks if the problem size is too large and constantly worry about where the solver is...), and 4) manually terminate once a BestBd value is seen.
Since the problem sizes for my instances are varying, I cannot estimate a single rough time limit to stop the solver. For this reason, I may even get no "BestBd found" after a given time limit. Is there any way to terminate once a BestBd is found? I checked out "BestBdStop," but that is not what I am chasing. Any suggestion?
-
Official comment
This post is more than three 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 why not try our AI Gurobot?. -
Hi Taner,
Could you briefly explain why the BestBdStop does not work in your case?
You could implement a MIP callback, check whether the best bound so far fulfills your needs, and terminate the optimization from the callback if needed.
Best regards,
Jaromił0 -
Hi Jaromił,
Thanks for your response. BestBdStop does not work because I cannot guess a good value for it. The below log shows an example termination with a time limit. The gap is 100% because a BestBd has not yet been found, but the run was terminated because of the time limit. Instead of using a time limit or an estimated BestBd with BestBdStop, I would like to run the instance until it naturally (without time limits) produces the below first line (and hopefully shows a BestBd not equal to 0.00).
Nodes | Current Node | Objective Bounds | Work
Expl Unexpl | Obj Depth IntInf | Incumbent BestBd Gap | It/Node Time
0 0 - 0 449701.000 0.00000 100% - 9059s0 -
Hi Taner,
To summarize, you want to stop the optimization as soon as any BestBd is computed, correct? There are multiple ways to achieve this. You could set BestBdStop = -1e10, assuming that a lower bound of -1e10 is not achievable for your problem. You could set NodeLimit=0 which terminates the optimization process as soon as pre-processing and the computation of the root relaxation is finished.
The problem of a BestBd "being stuck" at 0 is a different one. This can sometimes be tackled via reformulations or a more aggressive presolving.
Best regards,
Jaromił1
Post is closed for comments.
Comments
4 comments