Printing best bound solution for MIP problem
AnsweredHello All,
Is it possible to print the LP solution corresponding to the best bound objective value at a given time during the optimization, for example when an integer solution to the MIP is found?
I would be interested in comparing the two.
Regards.
-
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 Alexia,
You can access the relaxation solution of the current node via the \(\texttt{MIPNODE_REL}\) code in the \(\texttt{MIPNODE}\) callback. A list of all information which can be queried from Gurobi via callback can be found in the Callback Codes documentation.
Best regards,
Jaromił0 -
Hello Jaromil,
Thank you for your reply. This prints the relaxed solution for the current node being explored but this does not necessarily corresponds to the Best Bound solution. What I am looking for is the following: when a solution is found using Gurobi heuristics for example, I would be interested in seeing the difference between the heuristics solution and the current best bound relaxed solution.
Would you know how to do so?
Thank you.
0 -
Hi Alexia,
There is no function to get the best bound solution whenever a new incumbent solution has been found. However, with a bit of bookkeeping, you can still manage to have the best bound solution point at hand. In the \(\texttt{MIPNODE}\) callback, whenever a better best bound has been found, you can save the corresponding best bound solution point obtained by \(\texttt{MIPNODE_REL}\). You then have to replace the best bound solution point and its value only when a better bound has been reported in the \(\texttt{MIPNODE}\) callback. This way, you will have the best bound solution at hand whenever a new incumbent has been found.
Best regards,
Jaromił0
Post is closed for comments.
Comments
4 comments