Skip to main content

Multi-period VRP Inventory stuck

Answered

Comments

1 comment

  • 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

Please sign in to leave a comment.