Skip to main content

Reduced Cost Attributes

Comments

3 comments

  • 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

Please sign in to leave a comment.