Skip to main content

Runtime until certain optimality gap had been reached




  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi Caroline,

    It is currently not possible to query the times you mentioned.

    However, you can use callbacks to determine the values you are looking for. With that, you can avoid re-running the model. You could, e.g., use the message callback to retrieve the logging messages and filter them for the information you seek. Other callbacks such as the MIPSOL callback could also come in handy. Note that the MIPGap is not directly accessible, but you can compute the currently reached Gap by the formula provided in our knowledge base article on changing MIPGap values.

    Best regards,

  • Yuriy Zinchenko
    Gurobi Staff Gurobi Staff

    One more note is that in Python, as you have mentioned, you can simply set MIPgap to 10%, record your time, then reset it to 5% etc., while Gurobi will actually resume the solution process from the previous point.  It is indeed a suboptimal approach, but the overhead to restart the optimization should not be that huge.


Please sign in to leave a comment.