LP relaxation is not solved to optimality
Awaiting user inputHi,
I'm using Gurobi to solve a MIP with lazy cuts through callbacks. I accessed the LP relaxation solution with getNodeRel in GRB_CB_MIPNODE. I found that the LP relaxation solution is not an optimal solution sometimes. Am I doing anything incorrect?
Thank you!

Hi,
I found that the LP relaxation solution is not an optimal solution sometimes.
Could you please elaborate more on this? How do you know that the LP solution is not optimal? The getNodeRel() method is only available if the node status is optimal in the CB_MIPNODE callback routine.
Best regards,
Maliheh
0 
Thank you for replying! I implemented my project with C++. In the callback that where==GRB_CB_MIPSOL, I obtained the solution with getNodeRel(variable, #of variables). Then I used a constraint to check whether the solution is optimal. I also manually checked it with debugging and the solution is sometimes not optimal.
Also, it prints "Error number :1005 getNodeRel" sometimes. Does that mean I used the function incorrectly?
0 
As explained in the documentation of GRBCallback::getNodeRel(), this method can be queried only when the where member variable is equal to GRB_CB_MIPNODE. You cannot use this method with where==GRB_CB_MIPSOL. That's why you get the error code DATA_NOT_AVAILABLE with error number 10005.
Maliheh
0 
I made a typo in previous comment. I was using getNodeRel() in GRB_CB_MIPNODE. And get that errors sometimes. Also, the obtained solution is not optimal sometimes. Do you have any idea why this happens?
0 
I was adding lazy cuts where==GRB_CB_MIPSOL and also adding user cuts where==GRB_CB_MIPNODE. The getNodeRel() was added in GRB_CB_MIPNODE
0 
Thanks for the clarification.
As mentioned in the documentation of GRBCallback::getNodeRel(), the node relaxation solution can be queried given the following two conditions:
 The where member variable is equal to GRB_CB_MIPNODE.
 The LP relaxation solution status is optimal.
Therefore, it is not possible to retrieve the LP solution if it is not optimal.
Then I used a constraint to check whether the solution is optimal. I also manually checked it with debugging and the solution is sometimes not optimal.
Checking an LP relaxation solution against original model constraints (assuming integrality constraints are removed) pertains to feasibility and is not related to optimality. Do you mean that the LP relaxation solution does not satisfy the constraints?
Could you please share a minimum working example with us? You can share the script and the model file via any file hosting server such as Google Drive or OneDrive.
Maliheh
0
Please sign in to leave a comment.
Comments
6 comments