HOS compliant Truck Routes
Products Used: Route Optimization Flexible API
NextBillion.ai’s Route Optimization API provides users with a high degree of customization by leveraging over 50+ parameters to closely emulate the real-world constraints of route planning. One such feature is drive_time_layover_config
which is quite helpful in complying with Hours of Service regulations laid out for truck drivers. drive_time_layover_config
allows users to specify the maximum driving time after which the drivers need to take a break.
Once the request with details of rest/break configurations is submitted, the optimization service suggests optimal routes, task assignments and the break sequences to best meet the configured objective
To configure a Route Optimization request we will need to set up the locations involved, the tasks to be performed, vehicles to be used and the hours of service configurations. Let’s address them one by one below.
Configure optimization request
Locations
First we define the locations
object and add all the locations used in the problem along with a valid id
. Following is the the locations
object with all the coordinates to be used in this example:
Jobs & Shipments
Next, we define the delivery tasks that need to be performed in this example. We define the following properties for each task:
A unique “id” A “location_index” The “time_windows” within which the deliveries need to be performed. “delivery” amounts
Let’s take a look at the “jobs” JSON after the above properties are configured:
Vehicles
Next, we define a delivery truck that is responsible for fulfilling the above tasks. We define the properties of the delivery truck by adding:
- A unique ID
- Truck’s or the driver’s shift timings using the “time_window” parameter
- “capacity” of the load that the truck can accommodate
- “end_index” to denote the point where the truck would end its trip.
- The hours of service configurations that require the truck to take a break of 15 mins after driving for every 75 mins.
- We add a “max_continous_driving” time of 4500 secs (~ 75 mins)
- We add a layover_duration of 900 seconds (~15 mins)
Following is the vehicles
JSON with all the above properties configured:
Route Optimization POST request
Next we combine all the above components and submit the below JSON to the Route Optimization endpoint:
Route Optimization POST response
Once the above POST request is successfully submitted, a response similar to the following is received:
Retrieve optimization solution
Capture the task “id” from the POST response and use it in a subsequent GET request to retrieve the optimized solution asynchronously:
Route Optimization GET request
Route Optimization GET response
On retrieving the optimized result we get a summary of all key parameters along with the suggested route that the delivery truck takes to perform all the tasks.
Visit Route Optimization API documentation to know more about the available features.