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

TypeError: 'bool' object is not iterable

回答済み

コメント

1件のコメント

  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    When using the addConstrs method, you have to generate a list of constraints. Thus, you have to move your last \(\texttt{for}\)-loop after the \(\texttt{== 1}\) part

    case.addConstrs(
        (quicksum(x[j][k] for k in range(2, K + 1))
     
    == 1 for j in range(J)), 'Each job one machine'
    )

    Best regards, 
    Jaromił

    0

サインインしてコメントを残してください。