Skip to main content

List comprehension syntax in addGenConstrAnd type of constraints

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 try Gurobot, our chatbot interface offering instant, expert-level support.
  • Maliheh Aramon
    • 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

Post is closed for comments.