Skip to main content

How to print out "root node" information when solving a MIP with Gurobi?

Ongoing

Comments

4 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    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.
  • Maliheh Aramon
    • Gurobi Staff

    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
  • Ali Hassanzadeh
    • Gurobi-versary
    • First Question
    • First Comment

    Hi Maliheh,

    Thank you for the detailed response. This is indeed helpful.

    0
  • Felipe Cordera
    • Gurobi-versary
    • First Comment
    • First Question

    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.