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

Key error objective function

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

コメント

3件のコメント

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

    Your example is not reproducible. The \(\texttt{pe}\) object is not defined. Please adjust your code such that it is executable without your \(\texttt{pe}\) construct. It would be best, if you could use native Python data structures only in the reproducible example.

    Best regards, 
    Jaromił

    0
  • Jaromił Najman
    • Gurobi Staff

    You code is still not reproducible because values for, e.g., CO and CT, are missing.

    What you could do to debug your code is to sequentially remove terms from

    obj_expr = sum(model.Y[p,n,i,j,t,t] * CO[p,n,i,j]+CT[p,n,i,j]*L[i,j]
    -S[p,n,i,j] for p in model.P for n in model.N for (i,j) in model.A
    for t in model.T if (t>0))

    This means that you should remove expression C0 then try to run your code. If this does not work then remove CT and proceed. This way, you should be able to find the object responsible for the key error. Once you found the culprit, you can just print(...) it to see what the keys actually look like.

    0

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