Hi, I am just wondering would it be possible to add break in the route after, e.g., 6 hours of driving regardless of when the route starts, i.e., at anytime. For example, if the driver starts at 6am, then the break will be at 12pm, and if the driver starts at 2pm then the break will be at 8pm, and so on…
I know that JSprit allows break but I think you have to provide specific time window for the break.
Would it be possible to provide break without any time window? Is there any workaround for this?
Unfortunately, there is no straightforward way to achieve this. Currently, you always need to specify the break time window in advance, thus it cannot be determined dynamically or dependent on driving time.
Can one define multiple break activities in one VRP (one for each route, assuming the number of routes is fixed, so in this way one can specify the time window of the break activity based on route start time) and make use of route constraint (each break activity can only be assigned to its associated route) to achieve what OP requests?
When I read the examples (i.e., BreakExample and VariableStartAndWaitingTimeExample) listed in the issue track for breaks, I find each vehicle is set up with different breaks, e.g., in the latter example, the break time window for v2, v3 and v4 are the same (50,70), while that for v5 is different (300,350) - isn’t this specifying the time window of the break activity based on route start time?
And I guess you can always tighten the time window if you want to make the break start time more specific, e.g., 6 hours after the vehicle starts (i.e., as set by .setEarliestStart)?
You are correct, it specifies breaks dependent on start time, but NOT
dependent on actual driving time on the road. In many problems this
might be correlated, in some it is not. Just think of activities with
long service times.
But, I think there is one problem even when you set the vehicle start time (i.e., as set by .setEarliestStart). Because this start time is theoretical not the actual one. For example, one can set vehicle start time to be 5:00am, but the actual start time will be at 11:00am for the first available activity. So, I think this will affect the time window of the break if it is set to be between 8-9 am. I mean it will be skipped.
Yeah. Currently the vehicle will leave the depot at the vehicle start time set by .setEarliestStart and wait at the first activity if the arrival time is earlier than the activity start time. For example, consider a VRP in which there is only one activity whose time window is (12,15), one vehicle whose start time is set as 9, and the travel time between the depot and the activity is 1 time unit, then the vehicle will wait at the activity location for 2 time units.
If you want the vehicle to leave the depot as late as possible (at 11 in the above example), you will need variable departure time and min waiting time, the former of which is not yet available.
Old topic but increasingly important. Maybe there is a different way to look at this. Jsprit is a planning tool - not an execution tool so, as you mention, The time of the break can’t be accurately determined due to variances in the actual departure time of the vehicle. Also it is not just about travel time but also the time on site (service delivery time) because the regulations relate to work time - not just driving time.
I believe that this whole line of thinking is erroneous when looking at breaks based on driving time. Drivers have (increasingly) the EWD (electronic work diary) that they are compelled to use and that determines when they have to take the break. Therefore, in my view, all jsprit has to do is to “allow time” for the break in the journey at the appropriate accumulative time point.
This could be done when a job is inserted into the route by looking to see if the sum of the travel time and service time straddles a required break timing and add the required break time to the job as service or travel time.
Vehicle A has to travel for 4 hours to deliver a load and will take 1 hour to offload the load giving an activity time of 5 hours. The rules (arbitrary) say he must take a 15 minute break after 4.5 hours work. So add 15 minutes to either the travel time or the service delivery time of the job.
This approach ensures that the route has allowed for the mandatory break times during the route but still accurately determines the route timing.