Kuifje02/vrpy

Question: I'm experiencing this error when trying to solve in converting from an adjacency matrix to a digraph

Closed this issue · 3 comments

File "c:\Users\~\~V\VRPY_attempt.py", line 184, in solve
prob.solve(exact=False)
File "C:\Users\~\Miniconda3\envs\ENV\lib\site-packages\vrpy\vrp.py", line 252, in solve self._initialize(solver)
File "C:\Users\~\Miniconda3\envs\ENV\lib\site-packages\vrpy\vrp.py", line 478, in _initialize
self._convert_initial_routes_to_digraphs()
File "C:\Users\~\Miniconda3\envs\ENV\lib\site-packages\vrpy\vrp.py", line 945, in _convert_initial_routes_to_digraphs
edge_cost = self.G.edges[i, j]["cost"][0]
File "C:\Users\~\Miniconda3\envs\ENV\lib\site-packages\networkx\classes\reportviews.py", line 1094, in __getitem__
return self._adjdict[u][v]
KeyError: 1

I'm experiencing this error when trying to solve. I'm trying to implement time windows with an adjacency matrix. So that has to be converted to a digraph first according to https://vrpy.readthedocs.io/en/dev/examples.html#vrp-with-time-windows

Anybody has any idea what this error means and how to solve it?

Thanks in advance!

Hi there !
Can you share a minimal reproducible example so that we can reproduce the error ?

Sorry, while I was reducing the size of my code to make a reproducible example I stumbled on the error. I guess minimizing the scale of the code can sometimes help in finding the problem!

The issue lied in simply not making the TIME_WINDOW_UPPER & TIME_WINDOW_LOWER variables correctly.

Thanks for your reply, you (in)directly helped me solve it! :)

Dear dschoon98,

I have read your error online and I am experiencing the same issue when solving a VRP with Time Windows, using VRPy. I have used the same script to solve the issue for 8, 16, 32 and 40 nodes, however I get 'your' error when running the script for 24 nodes.

Could you please help me by letting me know how you solved the issue?

Thanks in advance,
Erik