0

I am uisng OR tools to solve a CVRP problem for mimicing a waste collection system with the below constraints:

  1. There can be multiple depots (depot is fixed), from where vehicles can start. The vehicles can start from these depots, pick up waste along certain paths across multiple nodes, and dump the waste in one of the nearest dumping zones once the vehicle capacity is reached, and then return back to the depot.
  2. There can be multiple dumping zones where vehicle can dump the waste.
  3. Capacity of each vehicle is fixed.
  4. There are some priority nodes that has to be cleaned earlier.
  5. Volume of accumulated waste information is provided as demands.

I want to maximize the total volume of waste collection and minimize the total distance travelled by vehicles.

I have a 2D NetworkX graph object, where each node represents the physical locations of places. Every node doesn't have a direct edge between them. For example if there's a path like -- Node1 -> Node2 --> Node3 --> Node4, there is a direct edge connection that exists between Node1 and Node2, but no direct edge between Node1 and Node3. Node1 is connected to Node3 indirectly via Node2. I have to use this networkX graph object to generate a distance matrix. While generating the distance matrix, I am computing the pairwise distance between every nodes (tried both Eucledian as well as Haversine distance), such that in the final matrix, all the diagonal elements are 0, and all other nodes are non empty. I am taking this distance matrix as an input to OR tools and trying to solve a CVRP. But, Google OR tools is not giving the required solution I want. For example, if the optimal output path is -- Node1 --> Node5 --> Node8, the vehicle should go from Node1 to Node5. However, in reality there is no direct edge connection that exists between Node1 and Node5. Node1 can be connected to Node5 via another Node, but not directly. But according to OR tools solution, there exists a direct connection between Node1 and Node5.

My questions are:

  1. In what way shall I change the distance matrix, that Node1 has a direct edge to Node2, but no direct edge exists between Node1 and Node3. Node1 is connected to Node3 via Node2. What changes do I need to make in the distance matrix? Any alternative approach other than modifying the distance matrix? How can I use disjunction to tackle this?

  2. Also how to assign multiple depot as vehicle start points? Mostly all the default examples in the Google OR page has implementation for 1 depot.

  3. Is there a way I can provide this information to Google OR tools that which edge is connected to which ones and which arent's connected? I am currently referring to this link : https://github.com/google/or-tools/blob/stable/examples/python/cvrptw_plot.py

For code implementation, please refer to this notebook --> Extremely new to Google OR tools, would be extremely helpful if someone can give an insight -- https://github.com/saugatapaul1010/CVRP/blob/main/Google%20OR%20Tools%20and%20NetworkX.ipynb

Please refer to the networkX graph object present in the notebook.

In the repository, I have included the I have included the NetworkX graph as an image attachment, and the distance matrix as a CSV file. I have used haversine distance to compute the distance between two nodes that are present in the networkX graph. Alternatively, I have also tried calculating the distance matrix by calculating the actual distance between the node co-ordinates in the networkX graph. If you look at the graph, the distance corresponding to Nodes A and C is 28.99 units. However, in the actual NetworkX graph A doesn't have a direct edge with C. It is connected to C via this path A --> B --> C. During optimization, how can I ensure that the vehicle will go from A to B and not A to C? How can I force the vehicle to not to travel to C from A? Rather it should travel to C by this path A --> B --> C and not directly take this path A --> C.

Saugata Paul
  • 59
  • 1
  • 9

0 Answers0