Skip to main content

Save optimizer state and resume.

Answered

Comments

3 comments

  • Simranjit Kaur
    • Gurobi Staff

    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,
    Simran
    0
  • Milin Kodnongbua
    • Gurobi-versary
    • First Question
    • First Comment

    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
  • Simranjit Kaur
    • Gurobi Staff

    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,
    Simran

    0

Please sign in to leave a comment.