Skip to main content

Multi-period VRP Inventory stuck

Answered

Comments

2 comments

  • Official comment
    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.
  • David Torres Sanchez
    • Gurobi Staff

    Hi Maura,

    First you don't need two \(\texttt{quicksum}\)s, a single one is fine:

    M.addConstr(
        gb.quicksum(e[i, j, k] for i in range(m) for j in range(n)) >= d[k + 1] + ss - I[k]
    )

    The error states that the variable key (0, 0, 2) does not exist i.e. \(\texttt{e[0,0,2]}\).

    You can try to debug this by creating the linear expression in for loops and printing the results something like:

    for k in range(t + 1):
        expr = 0
        for i in range(m):
            for j in range(n):
                print(f"{i=},{j=},{k=}")
                expr += e[i, j, k]
                print(f"{expr=}")

    Cheers, 
    David

    0

Post is closed for comments.