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.
-
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
Please sign in to leave a comment.
Comments
3 comments