How to print out "root node" information when solving a MIP with Gurobi?
OngoingI need to print out root node time/gap/bounds when solving a MIP with Gurobi. Is there any built-in attribute that we can call to print out these values? I am using Python as the main programming language.
The parameters I am looking for are very similar to the ones shown in Table 1 of the following Management Science paper by Fischetti et al. (2016) by the title of "Redesigning Benders Decomposition for Large-Scale Facility Location".
0
-
Official comment
This post is more than two 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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Ali,
There is no attribute to directly query the root relaxation value. There are several other alternatives:
- Gurobi log file includes a message like below at the end of root node solve where you can find the root relaxation value.
Root relaxation: objective 1.415000e+03, 85 iterations, 0.00 seconds (0.00 work units)- You can use Gurobi callbacks (either the MIPNODE or the MESSAGE callback) to obtain the value of the root relaxation programmatically.
- In the MIPNODE callback, the first queried MIPNODE_OBJBND value will give the root relaxation with no cutting planes when MIPNODE_NODCNT equals 0.
- See the example callback.py on how to use callbacks in Gurobi Python API.
- You can use the GRBlogtools open-source Python package which parses the Gurobi log and saves it in a pandas DataFrame. You can then find the root relaxation value in a column named \(\texttt{RelaxObj}\).
Best regards,
Maliheh
0 -
Hi Maliheh,
Thank you for the detailed response. This is indeed helpful.
0 -
Hi,
I have two related questions.
- Should I expect the first queried MIPNODE_OBJBND (when MIPNODE_NODCNT equals 0) to be equal to the plain LP relaxation?
- Is it correct to assume that the last queried MIPNODE_OBJBND (when MIPNODE_NODCNT equals 0) corresponds to the value of the relaxed problem after the last added cut (right before branching)?
Best,
Felipe
0
Post is closed for comments.
Comments
4 comments