メインコンテンツへスキップ

How to model DummyJobs

ユーザーの入力を待っています。

コメント

2件のコメント

  • 正式なコメント
    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

投稿コメントは受け付けていません。