Skip to main content

Updating the RHS and LHS of specific constraints [Python]

Answered

Comments

3 comments

  • Official comment
    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

Post is closed for comments.