Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_all_vehicles = True results in 'problem Infeasible' #147

Open
prasanik opened this issue Mar 14, 2023 · 2 comments
Open

use_all_vehicles = True results in 'problem Infeasible' #147

prasanik opened this issue Mar 14, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@prasanik
Copy link

prasanik commented Mar 14, 2023

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()
@torressa
Copy link
Collaborator

Thanks for the report! This is indeed a bug on our side with the way the initial routes are handled.

@torressa torressa added the bug Something isn't working label Apr 28, 2023
@torressa
Copy link
Collaborator

Just pushed a fix without changing the master problem formulation. It is a bit over-complicated but works for this small example. I cannot a better way of fixing it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants