Save optimizer state and resume.
AnsweredIs it possible for the state of the optimizer to be saved? I want to run Gurobi on an preemptible node and want to resume from the saved state.
-
Official comment
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Milin,
Calling the optimize() method again on a model will continue the optimisation process from the last state where the optimizer had stopped. Please see a sample code below.
import gurobipy as gp
#construct your model
...
# your custom terminating criteria
model.params.MipGap=0.05
...
# optimize
model.optimize()
# do something with the solution/s
...
#redefine termination criteria
model.params.MipGap=0.02
...
#resume optimisation
model.optimize()Best regards,
Simran0 -
Thanks for the response.
However, I mean load the state to a new instance of solver in a new process. The same solver is not in memory anymore. Is there a way to save/load from disk?
0 -
Hi Milin,
It is not possible to save a snapshot of the optimizer state to a disk. One cannot store the branch-and-bound tree or the presolve transformations. However, you can store the solution at the end of a solve by writing the SOL file and use it to warm-start the next solve.
Best regards,
Simran0
Post is closed for comments.
Comments
4 comments