Jsprit: remove shipment based on custom logic

Hi I have one driver that has to pick up 3 deliveries from one restaurant . The algorithm works OK .

I have seen that i can use HardActivityConstraint to be able to remove the usage of a given job.
The problem that i cant solve is that the distance from the driver to a given restaurant needs to be less than the sum of the distances to the deliveries.

Vehicle 1 travels to restaurant A to pick up 3 shipments (distance is 1.5 km).Delivery 1 is 500m from the restaurant, deliveri 2 is 600m form delivery 1, and delivery 3 is 1km from delivery 2. In this case all is good. But if in some cases distanteToRestaurant> distanceDelivery1+distanceDelivery2+distanceDelivery3 i need to search for another driver.Is it even possible

Powered by Discourse