Skip to main content

Reduced Cost Attributes

Comments

4 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff Gurobi Staff
    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 why not try our AI Gurobot?.
  • Thomas Opfer
    Gurobi-versary
    Thought Leader

    Concerning your question about integer variables: There are no (trivial) duals / reduced costs in MIPs. What you might want to do is to fix the integer solution and solve the remaining LP.

    Concerning your other (continous) question: The code seems incomplete, so I cannot test it. What do you mean by "does not work"? Do you get an exception? Do you get zeros (which might be perfectly ok)? For a very simple LP I just tested, the code

    print m.getAttr(GRB.Attr.RC)
    print m.getAttr(GRB.Attr.Pi)

    works.

    0
  • Taylor Leonard
    Gurobi-versary
    Conversationalist
    Curious

    Hi Thomas, thanks for the reply.  The error I get when optimizing a standard linear program with continuous variables is 

    AttributeError: 'tupledict' object has no attribute 'RC'

    I understand that zeros are fine, but I did not expect to receive no attribute because I know that the solution is not the optimal one.

    Thank you,

    Taylor

     

    0
  • Thomas Opfer
    Gurobi-versary
    Thought Leader

    Ah, I see.

    You are calling:

    r.RC
    s.RC
    z.RC

    I guess, this should be something like:

    r.getAttr(GRB.Attr.RC)
    s.getAttr(GRB.Attr.RC)
    z.getAttr(GRB.Attr.RC)

    0

Post is closed for comments.