Is there a way to configure Gurobi to allow the LP relaxation associated with the optimal solution leaf of a MIP branch-and-bound tree to be queried for shadow prices & other general LP properties--understanding that there may be serious shortcomings about some of the inferences that can be made given the cutting planes that are put in.

If this is possible, how would one go about storing this LP relaxation or querying the properties of a given constraint c?


Based on the documentation, this level of information retrieval from a specific branch-and-bound node is currently not available. If this was possible, we'd have to use a callback function (python documentation, python examples) to get the information from the relevant MIP branch-and-bound tree. We'd need where == GRB.Callback.MIPNODE since we want information from a specific node.

Looking at the what callback codes and archived Google Groups discussions for MIPNODE, there is no code to get the LP relaxation constraints and their properties. The closest thing would be MIPNODE_REL (or Model.cbGetNodeRel() for python), which provides the values of the variables for a node relaxation solution.


If you only care about those attributes in an optimal solution (or integral solution), save the integer part of the solution, fix the value of those integer variables in the model (x.ub=value, x.lb=value) and re-solve the remainder linear relaxation (model2=model.relax()) . Now you can query what you normally could for an LP. Not quite what you want, but is a hack around.

  • 1
    $\begingroup$ This is the better answer I think, unless Colin wants the LP with the presolve, cuts, etc that were added during the optimization process (which I assumed he did, might have misinterpreted). We can get presolve via Model.presolve; what's the best way to query the exact cuts that Gurobi added? $\endgroup$ – Dipayan Banerjee Jul 18 '19 at 1:47
  • $\begingroup$ I think you can’t do that either. $\endgroup$ – Daniel Duque Jul 18 '19 at 1:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.