Proper way to access LP relaxation?
AnsweredWhen Gurobi has solved a relaxation during it's Branch & Bound - Algorithm, I would like to look at the solution of the relaxation in order to add a type of cut which we found in a paper. What is the proper way to ask for the relaxation solution in the callback? Right now I have this, but apparently it does not always work, sometimes it throws an error which I have to catch:
def my_callback(model, where):
if where == GRB.Callback.MIPNODE:
try:
r = model.cbGetNodeRel(model.getVars())
# ... add cut
except gp.GurobiError:
pass
0
-
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Tobias,
You have to additionally check the current state as it is mentioned in the description of cbGetNodeRel().
Best regards,
Mario0
Post is closed for comments.
Comments
2 comments