Avoid Waiting Time

Hi,

I found that Jsprit provides min-waiting-time feature as in this discussion: https://groups.google.com/forum/#!topic/jsprit-mailing-list/E3yRr-P7OWw

But I could not find where it is, the link is broken
https://github.com/jsprit/jsprit/blob/master/jsprit-examples/src/main/java/jsprit/examples/WaitingTimeExample2.java

I am just wondering how can I find this one? Thanks!

I am wondering how can I minimize the waiting time between stops (activities) in a route. I tried to use setCostPerWaitingTime(…) to avoid long waiting time by assigning high cost for waiting time, but it does not work.

Consider this example, assume that we have 6 stops as follows:
3 stops need to be delivered on Monday and their time window is from 7 am to 2 pm.
3 stops need to be delivered on Tuesday and their time window is from 7 am to 2 pm.

I want to create 2 different routes, not one route. The current solution I got is only one route for all 6 stops with a long waiting time for the next 3 Tuesday stops. Is there a way to avoid this and make the route ends or returns to the depot after the delivery of the first 3 stops on Monday and starts a new route for the rest of the stops (Tuesday)?

Any help is appreciated, thanks!

This is the right way to go, i.e. set setCostPerWaitingTime(…). With regard to your example, this can only be achieved with variable departure times. Since this is not yet possible with jsprit, you need to constraint the driving time of your vehicles, i.e. use .setEarliestStartTime and .latestArrivalTime to enforce vehicles to come home on Monday and Tuesday. For example, you can define two vehicles. One can only be used on Monday, the other one needs to be employed on Tuesday.

1 Like

Thank you so much, Stefan, for the clarification.

One thing, does setCostPerWaitingTime(…) consider the waiting time between the stops or just between the depot and the stops. Thanks again!

Using this feature only makes sense when using time windows (otherwise
it has no effect). Since time windows are hard, vehicles need to wait at
corresponding locations until the time window starts, i.e. until the
customer opens his doors for the vehicle. If the vehicle arrives earlier
then it needs to wait. If waiting time is considered when minimizing
transportation costs then the algorithm considers these waiting times,
i.e. it tries to serve other customers instead of just waiting at the
closed doors of customer sites. The extend to which this is done depends
on the cost ratio between transport_time/distance and waiting_time.

Am 30/11/15 um 17:16 schrieb kelish09:

I see, thank you for your help!

Hi, My question is why cant we model it as a hard constraint
as
public ConstraintsStatus fulfilled(JobInsertionContext iFacts, TourActivity prevAct, TourActivity newAct, TourActivity nextAct, double prevActDepTime) {

    if (newAct instanceof DeliverShipment) {
        Double transportTime = costMatrix.getTransportTime(prevAct.getLocation(), newAct.getLocation(), prevActDepTime,
                iFacts.getNewDriver(), iFacts.getNewVehicle());
        double arrTimeAtNewAct = prevActDepTime + transportTime;
        Double diff = newAct.getTheoreticalEarliestOperationStartTime() - arrTimeAtNewAct;
        if(diff > 0)
        {
            return ConstraintsStatus.NOT_FULFILLED;

        }
        return ConstraintsStatus.FULFILLED;

    }

Also, i want to ask, how does the shipment insertion works in case of hard delivery windows, what happens when new activity is inserted? Does all the activities in the current route are checked for their time window constraint again?