Skip to main content

Gurobi for Python Declaring Variables Using Distinct Indices

Answered

Comments

1 comment

  • Greg Glockner
    Gurobi Staff Gurobi Staff

    Try creating the index as a generator expression:

    X = m.addVars(((s, ss) for s in S for ss in S if s != ss), vtype=GRB.BINARY)

     

    1

Please sign in to leave a comment.