"Node relaxation not Available"
AnsweredIn a Callback invoked while solving a MIP problem I wrote:
if where == GRB.Callback.MIPNODE:
x = model.cbGetNodeRel(model._x)
Gurobi gives the following answer:
File "src\gurobipy\model.pxi", line 6279, in gurobipy.Model.cbGetNodeRel
GurobiError: Node relaxation not available
Exception ignored in: 'gurobipy.callbackstub'
Traceback (most recent call last):
File "src\gurobipy\callback.pxi", line 209, in gurobipy.CallbackClass.callback
File "G:\Il mio Drive\MyCode.py", line 148, in mycallback x = model.cbGetNodeRel(model._x)
File "src\gurobipy\model.pxi", line 6279, in gurobipy.Model.cbGetNodeRel
gurobipy.GurobiError: Node relaxation not available
BUT if I check the values of variable x, I found that they have been provided (I do not know whether the values are correct).
MOREOVER the B&B proceeds and at the end it produces an (optimal!) solution which violates one of the constraints of the base formulation (NOT one of the lazy constraints added by the Callback).
-
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 Antonio,
As described in the documentation of cbGetNodeRel
Note that this method can only be invoked when the
wherevalue on the callback function is equal toGRB.Callback.MIPNODE, andGRB.Callback.MIPNODE_STATUSis equal toGRB.OPTIMALYou have to first check whether the node relaxation has been solved to optimality before accessing it.
Best regards,
Jaromił0 -
From Antonio:
Many many thanks Jaromił, problem solved!
Sorry! Antonio0
Post is closed for comments.
Comments
3 comments