Runtime until certain optimality gap had been reached
AnsweredAfter having solved the model to optimality, is it possible to not only query the overall runtime (model.Runtime), but also the runtime until a certain optimality had been reached, e.g., 10%, 5%, 1%?
Of course, I could run the model with different optimality gaps and then query model.Runtime but that is obviously not the preferred option.
I am using the python API (gurobipy).
-
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 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,
Jaromił0 -
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.
0
Post is closed for comments.
Comments
3 comments