question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Vrpy not accomplish the Time Windows Constraints

See original GitHub issue

I am trying to solve a CVRPTW on a graph with 54 nodes and 353 edges, as you can see it is a little size problem, and all the edges have a time window, a demand and a service time as the next image:

image

However, when I try to solve the problem with the exact algorithm the best routes are not satisfying the time windows constraint, as an example (even when this happens with many nodes) the previous node 36 has the time window [8 , 14] and when I look at the prob.arrival_time attribute the arrival time at the node is 15.3 (out of the TW) as shown in the next image image

You can reproduce the problem with the next graph in the zip and this code:

from networkx import read_gpickle
import vrpy
G = read_gpickle('graph_vrpy,test')
len(G.nodes)
prob = vrpy.VehicleRoutingProblem(G, load_capacity=80)
#prob = VehicleRoutingProblem(G, load_capacity=100)
prob.time_windows = True
prob.solve(exact=True)

prob.best_routes
prob.arrival_time
G.nodes['36']

graph_vrpy.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
torressacommented, Jun 17, 2021

And… Going back to the beginning, @tomatoes-prog is correct. With the previous arrival_time version, without the min, cspy works with direction="forward" and not with "both". Performance-wise "forward" seems to be faster so it’s not really a problem, I just need to double check the backward REF.

PS. Sorry for committing to master

2reactions
torressacommented, Jun 17, 2021

Can confirm, only for arrival times though… I’ve just added another condition there

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vehicle Routing Problems — VRPy 0.1.0 documentation
Taking into account duration constraints requires setting time attributes on ... This means that if a vehicle arrives at a node before the...
Read more >
Cannot Get Optimal Solution with 16 nodes of VRP with Time ...
The solver find difficult to get the optimality. Does the time windows width become more complex as they are getting bigger? I have...
Read more >
Program does not respect time window constraint for each ...
My inputs are like this, I am trying to make a code with starting and ending points to control the routing from a...
Read more >
Algorithms for the Vehicle Routing and Scheduling Problems ...
This paper considers the design and analysis of algorithms for vehicle routing and scheduling problems with time window constraints.
Read more >
VRPy: A Python package for solving a range of vehicle routing ...
the CVRP with time windows (Cordeau & Québec), 2000), ... We do not claim to outperform OR-Tools, but aim to have results of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found