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

data_import / syntax error

回答済み

コメント

3件のコメント

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

    Hi,

    You see this error because you are trying to add the variable y[17,1] to a constraint, but this variable does not exist. A y variable is defined for every tuple in the list C:

    [(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3),
    (4, 1), (4, 2), (4, 3), (5, 1), (5, 2), (5, 3), (6, 1), (6, 2), (6, 3),
    (7, 1), (7, 2), (7, 3), (8, 1), (8, 2), (8, 3), (9, 1), (9, 2), (9, 3),
    (10, 1), (10, 2), (10, 3), (11, 1), (11, 2), (11, 3), (12, 1), (12, 2),
    (12, 3), (13, 1), (13, 2), (13, 3), (14, 1), (14, 2), (14, 3), (15, 1),
    (15, 2), (15, 3)]

    Note that (17,1) is not in this list. Consider the following constraint set:

    m.addConstrs(x[i,p]+y[j,p] <= 1 + z[i,j,p] for i,j in E_complete for p in K) 

    We encounter the error for the first of these constraints, defined by (i,j) = (1,17) in E_complete and p = 1 in K, because y[j,p] is never defined.

    Could you elaborate on what these variables represent and the sets you want to use to define them? Thanks!

    Eli

    0
  • shohre sadeghsa
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Eli, 

    Yes, you are right! I didn't define the sets correctly! that works now! 

    Thank you so much

    Shiva

    0

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