graphhopper / jsprit

jsprit is a java based, open source toolkit for solving rich vehicle routing problems
https://www.graphhopper.com/open-source/
Apache License 2.0
1.64k stars 605 forks source link

Feature Request: Pass previous activity to VehicleRoutingActivityCosts.getActivityDuration #525

Open bludginozzie opened 3 years ago

bludginozzie commented 3 years ago

We use this method to implement the time it takes to pickup or deliver the freight. In real life this is the time it takes to park the vehicle and enter the premises to perform the pickup or delivery. However in some circumstances the pickup or delivery is at the same location as the previous one so this time is reduced in this case.

Essentially we want to implement something like this:

public double getActivityDuration(
  TourActivity prevAct,
  TourActivity currentAct,
  double arrivalTime,
  Driver driver,
  Vehicle vehicle
) {
        if (prevAct.getLocation().equals(currentAct.getLocation())) {
            return 0d;
        }
        // Rest of method

From my investigation there is no other way I can see to implement this.

This would be greatly appreciated

waldobeest commented 3 years ago

I have created a PR for this exact purpose: https://github.com/graphhopper/jsprit/pull/527

The challenge I am facing, is that it seems that some other vehicle constraints are being disregarded.