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

SOS constraint problem

回答済み

コメント

2件のコメント

  • 正式なコメント
    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?.
  • Silke Horn
    • Gurobi Staff Gurobi Staff

    Hi Buddi,

    I assume the issue is that you are getting an error like "name 't' is not defined" in your addSOS line. Correct?

    If you want to add one SOS constraint for each t, you will have to use a loop; e.g.:

    for t in T:
    model.addSOS(GRB.SOS_TYPE2, [v_weight1[t], v_weight2[t], v_weight3[t], v_weight4[t], v_weight5[t]],
    [0.1, 0.3, 0.5, 0.7, 0.9])
    0

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