best_routes_type returns invalid type ?
Kuifje02 opened this issue · 1 comments
Kuifje02 commented
I am having trouble with determining vehicle type by route.
I solved the problem below:
from networkx import DiGraph
G = DiGraph()
G.add_edge("Source", 1, cost=[1, 2])
G.add_edge("Source", 2, cost=[2, 4])
G.add_edge(1, "Sink", cost=[0, 0])
G.add_edge(2, "Sink", cost=[2, 4])
G.add_edge(1, 2, cost=[1, 2])
G.nodes[1]["demand"] = 13
G.nodes[2]["demand"] = 13
prob = VehicleRoutingProblem(G, mixed_fleet=True, load_capacity=[10, 15])
when I print out ‘prob.best_route’ and ‘prob.best_routes_type’, I get:
Best routes: {1: ['Source', 1, 'Sink'], 2: ['Source', 2, 'Sink']}
Route type: {1: 0, 2: 0}
As you can see, all the routes type have value ‘0’, which would mean that the routes used vehicle 1 with capacity 10. But this would not be possible since vehicles of type ‘0’ cannot handle a demand of 13 for node 1 and 2. Should I be seeing ‘Route type: {1: 1, 2: 1}’?