Kuifje02 / vrpy

A python framework for solving the VRP and its variants with column generation.
MIT License
173 stars 42 forks source link

Route Departure and Arrival Time #113

Closed ugirumurera closed 2 years ago

ugirumurera commented 2 years ago

When I solve a simple problem with time window constraints, the tour arrival and departure times don’t make sense to me. Below is an example: G = DiGraph() G.add_edge("Source", 1, cost=5) G.add_edge("Source", 2, cost=5) G.add_edge(1, "Sink", cost=5) G.add_edge(2, "Sink", cost=5) G.add_edge(1, 2, cost=1) G.nodes[1]["lower"] = 0 G.nodes[1]["upper"] = 20 G.nodes[2]["lower"] = 0 G.nodes[2]["upper"] = 20 G.nodes[1]["service_time"] = 5 G.nodes[2]["service_time"] = 5 G.nodes[1]["demand"] = 8 G.nodes[2]["demand"] = 8 prob = VehicleRoutingProblem(G, load_capacity=10) prob.time_windows = True

After solving I retrieve the departure and arrival time with prob.departure_time and prob.arrival_time, and I get the following results: departure: {1: {'Source': 0, 1: 5, 'Sink': 5}, 2: {'Source': 0, 2: 5, 'Sink': 5}} arrival: {1: {'Source': 0, 1: 0, 'Sink': 5}, 2: {'Source': 0, 2: 0, 'Sink': 5}}

How is the departure and arrival time calculated? How can arrival time be lower than departure time? And it does seem lie the service time is used at all.

Thans.

torressa commented 2 years ago

Hi @ugirumurera! Thanks for pointing this out but we are already working on this in #101 The work was merged onto the patch15 branch which currently contains the fudge https://github.com/Kuifje02/vrpy/issues/101#issuecomment-863431367 Will steal this example as it is a brilliant unit test!