5

For a VRP in or-tools, is there a way to have vehicles start at some fixed locations, but allow for arbitrary end locations?

The documentation https://developers.google.com/optimization/routing/routing_tasks#setting-start-and-end-locations-for-routes and https://developers.google.com/optimization/routing/routing_tasks#allowing-arbitrary-start-and-end-locations show present how to set custom or arbitrary start/end locations respectively.

My question is can we combine them both? i.e. custom start location and arbitrary end location(and vice-versa)?

Thank you

François
  • 53
  • 3

1 Answers1

5

You just need to tweak your distance matrix to have a zero length from any normal node to the end nodes, and ignore this last arc when reading the solution.

Laurent Perron
  • 8,594
  • 1
  • 8
  • 22
  • In this case wouldn't any node be a candidate for end node? To clarify, if we have 10 nodes (1-10) and 3 vehicles with start nodes as 1,2, and 3. I'm thinking all the remaining nodes (4-10) would be candidates for end nodes. In this instance, how would we set the matrix up? – François Sep 15 '20 at 05:18
  • Create a dummy end node that you set as the vehicle's end node. Then when constructing the distance matrix, set the distance from any node to the dummy node to zero. – k88 Sep 17 '20 at 03:07
  • @Laurent, do you have a simple bit of code to express this, i think this would be a great feature especially for mvrp / mtsp – Brandon Grossutti Nov 15 '20 at 23:41