メインコンテンツへスキップ

Issue with dual values for continuous model

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • 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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • 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
  • Zhiyuan
    • Gurobi-versary
    • First Comment

    I also had this problem, Jaromił  is correct. Please use GRB_INFINITY to define the UB of the variable if it is implicitly bounded by some constraints elsewhere.

    0

投稿コメントは受け付けていません。