Skip to main content

Issue with dual values for continuous model

Answered

Comments

1 comment

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    In theory your code is correct. However, in practice, models are not in standard form, i.e., there are also variable bounds and objective constants you have to consider . The following code should do the trick

    total = m.ObjCon
    for c in m.getConstrs():
    total += c.RHS * c.Pi

    for v in m.getVars():
    if v.VBasis == -1:
    total += v.RC * v.lb
    if v.VBasis == -2:
    total += v.RC * v.ub

    Best regards, 
    Jaromił

    1

Please sign in to leave a comment.