Skip to main content

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

Answered

Comments

2 comments

  • Maliheh Aramon
    Gurobi Staff 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

Please sign in to leave a comment.