Skip to main content

Set definition

Awaiting user input

Comments

2 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff 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?.
  • Mario Ruthmair
    Gurobi Staff Gurobi Staff

    Hi Shuk,

    How is this related to Gurobi? Are you trying to create variables for each tuple (tau,q)?

    Creating the list of feasible tuples can be done, e.g., with Python generator expressions:

    Tpt = [(tau, q) for tau in range(ESp, LSp + 1) for q in range(1, dp + 1) if tau + q - 1 == t]

    Then, you could for example create one binary variable for each pair (tau,q) by:

    x = model.addVars(Tpt, vtype=GRB.BINARY, name="x")

    Is this what you need?

    Best regards,
    Mario

    0

Post is closed for comments.