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

Adding time window constraints on VRP gets an unexpected result

回答済み

コメント

2件のコメント

  • 正式なコメント
    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.
  • Maliheh Aramon
    • Gurobi Staff

    Hi Daisuke, 

    The issue is likely happening because of the very big M value \(\texttt{numpy.inf}\) you are using in the RHS of the arrival time constraints. 

    The arrival time constraints ensure 

    if edges[j, i] = 1, then arrTime[i] >= arrTime[j] + dist_matrix[j, i]

    I would suggest to use the Gurobi API for indicator constraints and implement them as below:

    model.addConstrs(
    (
    (edges[j, i] == 1) >> (arrTime[i] >= arrTime[j] + dist_matrix[j][i])
    for i in range(n)
    for j in range(n)
    ),
    name="arrival_time",
    )
    Best regards,
    Maliheh
    0

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