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

Parametric optimization with Gurobi in python?

回答済み

コメント

2件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Marika Karbstein
    • Gurobi Staff

    Hi Samuel,

    There is no automatic way in gurobipy. But you can update the model by

    • changing the attribute values, for example, RHS,  Obj,  LB, or UB 
    •  using function Model.chgCoeff() to change a coefficient in a constraint

    For your example x - a <= 0, the part could look like

    a=1 # start value
    con = m.addConstr(x - a <= 0)
    m.optimize()
    # change a = 5
    con.RHS=5
    m.optimize()
    Best regards,
    Marika
    0

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