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

"If" in object function

ユーザーの入力を待っています。

コメント

2件のコメント

  • 正式なコメント
    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?.
  • Matthias Miltenberger
    • Gurobi Staff Gurobi Staff

    Hi Saeed,

    I am not entirely sure that this is what you are trying to model but to me, this appears to be a case for splitting the \(P_\text{grid}\) variables into a positive and a negative part:

    Pgrid_pos = m.addVars(n-1, name="P_grid_pos", obj=10)
    Pgrid_neg = m.addVars(n-1, name="P_grid_neg", obj=5)
    m.addConstrs(Pgrid[i] == Pgrid_pos[i] - Pgrid_neg[i] for i in range(n-1))

    Cheers,
    Matthias

    0

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