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

Updating the RHS and LHS of specific constraints [Python]

回答済み

コメント

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 why not try our AI Gurobot?.
  • Silke Horn
    • Gurobi Staff

    When you try to set a constraint attribute, setAttr expects two arrays.

    This should work:

    self.model.setAttr("RHS", [self.model.getConstrs()[i]],[self.water_network.b[i]])

    Alternatively, you could first collect all constraints and all new RHS values in arrays and then change them with one setAttr call.

    1
  • Dionysios Nikolopoulos
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you!

    0

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