-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The below code is set up to have 4 nodes with 10 each as demand. It also has 4 vehicles with 10 capacity each. vrpy returns 4 routes as expected.. 1 node per route. But if you uncomment the line prob.use_all_vehicles, it results in error of problem infeasible. But as we have seen, when we run the code without this line, it does actually end up using all vehicles.
from networkx import DiGraph
from vrpy import VehicleRoutingProblem
import networkx as nx
def run():
G = DiGraph()
for v in [1, 2,3,4]:
G.add_edge("Source", v, cost=[10, 11, 10, 10])
G.add_edge(v, "Sink", cost=[10, 11, 10, 10])
G.nodes[v]["demand"] = 10
G.add_edge(1, 2, cost=[10, 11, 10, 10])
G.add_edge(2, 3, cost=[10, 11, 10, 10])
G.add_edge(3, 4, cost=[15, 16, 10, 10])
nx.draw_networkx(G)
prob=VehicleRoutingProblem(G, mixed_fleet=True, load_capacity=[10, 10, 10, 10])
prob.num_vehicles = [1,1,1,1]
#prob.use_all_vehicles=True
prob.solve(time_limit=60)
a = prob.best_value
a = prob.best_routes
a = prob.best_routes_type
print(a)
run()Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working