Skip to content
Advertisement

Pickup and delivery VSP with aggregation points

I’m trying to solve a simple pickup and delivery VRP for one vehicle only using or-tools. I was following the docs https://developers.google.com/optimization/routing/pickup_delivery, and it seems that everything works as expected when all the pickup and drop-off points are different from each other. The pickups_deliveries array looks like this:

JavaScript

However, let’s assume there are aggregation points where there’s more than one package to pick up and courier has unlimited space. I was trying to modify the example above to use the same pickup index in multiple pickup/delivery pairs:

JavaScript

The result I was expecting was to have only 2 pickup stops and 8 deliveries, but unfortunately when I run the solver, it returns None.

JavaScript

Is there a way around this or am I missing something more crucial? I’m pretty new to this library, so any directions would be very appreciated.

Advertisement

Answer

You must duplicate the node 2 to have it involve in one P&D only.

Please notice that each location can only be visited once !

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement