Skip to main content

LP relaxation is not solved to optimality

Awaiting user input

Comments

6 comments

  • Maliheh Aramon
    Gurobi Staff Gurobi Staff

    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
  • haonan 钟
    Gurobi-versary
    First Comment
    First Question

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

    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
  • haonan 钟
    Gurobi-versary
    First Comment
    First Question

    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
  • haonan 钟
    Gurobi-versary
    First Comment
    First Question

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

    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.