Closed jamilfitouri closed 3 years ago
Could you try and see if the data set runs with time windows only (without pickup and delivery) and with pickup and delivery only (without time windows) ? I suspect there is an incompatibility between the two. I would not be surprised if the problem is infeasible (the error is raised while initializing, when building an initial trivial solution, which is probably infeasible).
What is happening is that the problem in not feasible. You have a request from node 1 to node 6 which cannot be done with the given time window constraints. I will update the code so that a more relevant error is raised, more understandable for the user.
cd504cd7e02320f72bc5379d8b12c58fbb8cbd00
First of all thank you very much for sharing this great project! Now i wanted to impliment a capacited VRP pickup/delivery with time windows but i got the error below:
Code `# Transform distance matrix to DiGraph A = np.array(DISTANCES, dtype=[("cost", int)]) G_d = from_numpy_matrix(A, create_using=DiGraph())
Transform time matrix to DiGraph
A = np.array(TRAVEL_TIMES, dtype=[("time", int)]) G_t = from_numpy_matrix(A, create_using=DiGraph())
Merge
G = compose(G_d, G_t)
Set time windows
set_node_attributes(G, values=TIME_WINDOWS_LOWER, name="lower") set_node_attributes(G, values=TIME_WINDOWS_UPPER, name="upper")
Set demands and requests
for (u1, v1) in PICKUPS_DELIVERIES: G.nodes[u1]["request"] = v1 G.nodes[u1]["demand"] = PICKUPS_DELIVERIES[(u1, v1)] G.nodes[v1]["demand"] = -PICKUPS_DELIVERIES[(u1, v1)]
Relabel depot
G = relabel_nodes(G, {0: "Source", 17: "Sink"})
if name == "main":
Error message: KeyError Traceback (most recent call last)