Driver breaks
Both the SWAT Optimization API and Integration API support driver breaks, allowing dynamic allocation to align with operational needs or legal requirements. For example, Route Optimization can incorporate the length of required breaks after specific driving durations into its execution plan while respecting other set constraints. Two main use cases apply, which can be used in a mutually exclusive manner when simulating the addition of driver breaks to optimization:
Parameters discussed below are a part of Optimization (Stateless) API payload, that are applied to a vehicle .
{
"agent_id": "78e07d0f-abbc-4c7d-921e-54ba7bab1041",
"capacity": {
"goods": 13
},
"characteristics": {},
"lat": 1.3309909478620003,
"lon": 103.86845911685897,
// Single and multi break case
"dynamic_break_duration": 3600,
// Single break case
"dynamic_break_min_path_duration": 120,
"dynamic_break_start_time": "2019-08-24T14:15:22Z",
"dynamic_break_end_time": "2019-08-24T14:15:22Z",
// Multi break case
"dynamic_break_avg_time_between_breaks": 360,
"dynamic_break_max_latency": 0,
"max_pickup_locations": 10
}
The planned driver break is ultimately added to the node's slack and is regarded as standard slack (waiting time) at a node for route optimization purposes.
Setting dynamic_break_avg_time_between_breaks to a specific value determines whether to use single or multiple driver break mode. When this value is unset, single driver break is applied. Otherwise, multiple breaks mode is applied. Driver breaks are applied at the node level, not the booking level.
Driver breaks are permitted only at nodes
assigned to the vehicle. The time allocated for driver breaks is added to the node's slack time. The break node is selected from one of the nodes in the path with the greatest slack. The break node cannot be the first or the last in the path. If slacks are identical, the break node is selected to be as close as possible to the middle of the path inprebook_cvrptw mode or to have minimal possible demand in prebook mode.
Driver break is a hard constraint. If a requirement to have an allocated driver break is in force, some bookings may be refused if they are no longer meeting additional time constraints assumed by the driver break.
Single break
Single break scenario assumes that there is only one or no break allowed for a single vehicle trip (optimization run) for a vehicle. Driver break is managed by four parameters:
dynamic_break_durationin secondsdynamic_break_min_path_durationin secondsdynamic_break_start_timeas date\time stampdynamic_break_end_timeas date\time stamp
The dynamic_break_duration parameter specifies the duration of the break that should be scheduled. The dynamic_break_min_path_duration parameter controls when or if a driver break will be scheduled. The break will be scheduled only if the vehicle travelled for longer tha n dynamic_break_min_path_duration.
If the expected vehicle path duration is less than dynamic_break_min_path_duration, no driver break is added. However, if the parameter is zero, a driver break is always scheduled because any vehicle path duration is greater than zero. dynamic_break_min_path_duration takes into account the combined vehicle travel time, nodes' slack time, and nodes' service time during its calculation.
If the vehicle path has only a single node, no driver break will be added.
The dynamic_break_start_time and dynamic_break_end_time parameters define a time window within which the driver break can be scheduled. It's possible to specify only the maximum or minimum time boundary, in which case only that constraint will be enforced.
Multiple breaks
Multiple break scenario assumes that there could be multiple, one or no breaks allocated to a vehicle for a single trip (optimization run). Driver break is managed by three parameters in this case:
dynamic_break_avg_time_between_breaksin secondsdynamic_break_durationin secondsdynamic_break_max_latencyin seconds
The dynamic_break_duration parameter specifies the duration of the breaks that should be scheduled. Each planned break will have the same duration.
The dynamic_break_avg_time_between_breaks parameter governs the maximum average time a vehicle can drive without a break. It encompasses the cumulative vehicle travel time, node slack time, and node service time in its computation. There is no prescribed minimum interval between breaks, thereby allowing for multiple consecutive breaks at the same node.
Using dynamic_break_max_latency, a driver's break constraint can be transformed into a more flexible constraint that tolerates tardiness. This value specifies the maximum allowable delay for the break.
Interpreting results from the vehicle assignments
In the Optimization (Stateless) API, drivers' break schedules can be found within the vehicle assignments list, which enumerates all nodes assigned to a vehicle .
A booking requires association with two nodes (pickup and drop-off). Due to route optimization, a vehicle may perform multiple pickups and drop-offs. Consequently, vehicle route assignment is handled at the node level. The Optimization (Stateless) API provides a sequential list of nodes assigned to the vehicle, not bookings.
The following example showcases two breaks assigned at the node. The value denoted by slack signifies the aggregate waiting time at that particular node, which in this instance incorporates 2*<dynamic_break_duration>+node_slack value.
{
"booking_uid": "some_booking", // Booking UID this node belongs to
"dynamic_break": 2,
"lat": 30.0,
"location_code": null,
"location_name": null,
"lon": 130.0,
"matrix_timestamp": null,
"node_type": "pickup",
"scheduled_cumulative_distance": 0,
"scheduled_ts": "2022-08-01T14:34:18.600504+00:00",
"service_time": 0,
"slack": 18349.5,
"stop_id": "warehouse",
"uid": "some_uid" // This node's UID
}
If the dynamic_break break is set to null, no break is scheduled at that node.
FAQ
Some common use cases are explained below
Q: How do I model a situation where a driver has to take a 30-minute break when a trip exceeds 4 hours, assuming there's only one driver break during the trip?
A: The vehicle assigned to the driver must have the following parameters configured. If the planned vehicle path is less than four hours, no breaks will be scheduled. Additionally, breaks can be allocated at any point along the path (attached to a node) because start and end-time constraints are not set.
{
// ...
"dynamic_break_duration": 1800,
"dynamic_break_min_path_duration": 14400
// ...
}
Q: Can you provide examples of scenarios involving multiple driver breaks with varying slack and service times, given that the break duration (dynamic_break_duration) is set to 30 minutes and the time between breaks (dynamic_break_avg_time_between_breaks) is set to 4 hours?
A: Please see the following time diagrams
Scenario 1: Travel 5h
Scenario 2: Slack 5h + Travel 5h
Scenario 3: Slack 2h + Travel 3h
Scenario 4: Service 1h + Slack 1h + Travel 3h
Scenario 5: Multi-stop
Playground
You can try out the Driver Break concept using the playground below.
The example defines a vehicle with a dynamic_break_duration of 3600 seconds (1 hour).