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

TypeError: 'int' object does not support item assignment

回答済み

コメント

1件のコメント

  • Maliheh Aramon
    • Gurobi Staff

    This error is a Python error and is not related to Gurobi. 

    The error happens when an integer is made to act as a list. For example, the script below will generate the same error as you observed:

    A = [1, 2, 3]
    # A[2] is an integer and cannot be treated as a list
    A[2][0] = 4

    You might want to check the initialization of the \(\texttt{solution.Y}\) attribute in your code to ensure \(\texttt{solution.Y[i][j][k]}\) is a list and not an integer. 

    Best regards,
    Maliheh

    0

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