Skip to main content

How to model DummyJobs

Awaiting user input

Comments

1 comment

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

Please sign in to leave a comment.