Skip to main content

List comprehension syntax in addGenConstrAnd type of constraints

Answered

Comments

2 comments

  • Maliheh Aramon
    • Gurobi Staff Gurobi Staff
    Hi Madhushini,
     
    You can first build the list of variables over which the AND concatenation will be taken and then use the Model.addGenConstrAnd() method.
    vars = [x]
    vars.extend([z_i for i in lst_i])
    model.addGenConstrAnd(y, vars, name="and")
    Best regards,
    Maliheh
    0
  • Madhushini Narayana Prasad
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you, that works!

    0

Please sign in to leave a comment.