Using Service instead of Shipment for pickups and deliveries

Hello All,

Using Shipments for pickups and deliveries is a lot slower compared to using an equal number of Service while running algorithm. Instead, can I use Services for pickups and deliveries?

If I create Service for pickup as 1 quantity in capacity with pickup location and -1 quantity of capacity for delivery with the delivery location and create a hard constraint to make sure both of these services for 1 Shipment must be assigned to the same vehicle and also make sure the pickup is happening before delivery, will it work? is it a correct solution?

  • Service does not support negative values as capacity, just wanted to understand why so? Will it work if I override that check and allow negative values.
  • Will it be faster than using Shipment for pickup and delivery? I am okay if the vehicle is not coming back to the depot for loading more shipments.

Any thoughts on this one?

Pickup/dropoff does change the asymptotics of the algo.

It basically checks every possible insertion of the dropoff in the route for each pickup insertion.

-1 quantity is not supported out of the box- without other constraints it does not make sense, e.g. we need to ensure vehicle does not pick up a only a dropoff and have a negative quantity.

So jsprit would probably need to be modified to do this. I am unsure how this will perform compared to letting it use services + constraints, however:

  • while doing pickup+dropoff in this way is slow, we are guaranteed to find the best insertion for the dropoff for a given pickup, and we are spending our cycles on insertions that all obey the pickup before dropoff invariant
  • if we are letting the algo move around the dropoff in an unconstrainted manner, we will “waste” a lot of time on insertions that we know will not work, e.g. it will attempt to insert dropoff into another route without the corresponding pickup, and only then will the hard constraint fail. This means the algo will be spending much less time in areas of valid solution space.