Skip to main content

How to model DummyJobs

Awaiting user input

Comments

2 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.
  • Jaromił Najman
    • Gurobi Staff

    Hi Martin,

    From your post I assume that you don't need help with the modeling part but rather with the choice of correct indexing of your variables, is this correct?

    You don't have to use integer values for variable indices only. You could define your jobs + the dummy job as

    import gurobipy as gpm = gp.Model()

    NumberOfJobs=10
    indices = ["dummy"]
    for i in range(NumberOfJobs):
      indices.append(i)

    x = m.addVars(indices)

    # access variables
    print(x["dummy"])
    print(x[0])

    More often it is best to introduce a separate individual variable for special values, such as the dummy job in your case. So introducing an individual variable \(x_{d}\) might make modeling of your problem easier.

    Best regards, 
    Jaromił

     

    0

Post is closed for comments.