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

Some constraints are not implemented

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Riley Clement
    • Gurobi Staff

    Hi,

    Can I suggest replacing your code for 1.13 with the following:

    # constraint (1.13)
    con_113 = [] for d in range(data.droneNum): for k in range(data.vehicleNum): for i in range(0, 5): # Vl expr = LinExpr(0) for j in range(6, 10): # Cd if (i != j): expr.addTerms(1, Y[i][j][k][d]) model.addConstr(expr == Vl[i][k][d], "c1.13")
               con_113.append((expr, Vl[i][k][d]))

    then after the optimization use the following to inspect these constraints:

    biggest_violation = 0
    for expr, v in con_113:
    print(expr.getValue(), v.X)
       biggest_violation = max(biggest_violation, abs(expr.getValue() - v.X))
    print("number of constraints 1.13:", len(con_113))
    print("biggest_violation:", biggest_violation)

    What is the biggest violation reported?

    - Riley

    0
  • Riley Clement
    • Gurobi Staff

    (as a side note there is no reason to use LinExpr.clear() in your code, I would remove these calls for simplicity sake)

    0

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