Routing Profiles
Managing a fleet with a variety of vehicle types—such as cars, trucks, and minivans—often requires separate route planning requests for each vehicle type, leading to unnecessary complexity and inefficiency. NextBillion.ai Route Optimization allows users to define multiple Routing Profiles to plan routes for mixed vehicle fleets in a single request.
This tutorial will guide you through how to set up and configure routing profiles, where you can define unique routing constraints and preferences for each vehicle type, including travel mode, departure time and more. Each vehicle can be tagged to a profile, enabling seamless, optimized route planning for an entire fleet with varied vehicle types, saving time and improving operational efficiency in the process.
Setup
We have a total of 10 delivery jobs to be fulfilled by a fleet of mixed vehicle types. The fleet has 2 types of vehicles in it - minivans and cars. For each of the vehicle profiles, we will define its routing characteristics and then use them when defining actual vehicles. Let’s start with configuring the locations, delivery jobs with their revenues, and the vehicles one by one in the following sections.
Locations
First, we define the locations
object and add all the location coordinates used in the problem along with a valid id
. The locations
object used in this example:
Jobs
Next, we define the 10 delivery jobs in our problem statement. For each of these tasks, we add:
- A unique identifier
- Location index
- Delivery quantities
- A service time
Following is the JSON we use in this example:
Routing Profiles
Next we set up the routing profiles for all types of vehicles in the fleet. As per our problem statement, we have to define 2 types of profiles - “car” and “minivan”.
The “car” type profile has a travel mode of car and needs to avoid highways. Whereas, the “minivan” type profile is of truck type and has specific weight and size dimensions. The “minivan” also needs to avoid tolls and should not make any left turns.
Following is the JSON script to configure these routing profiles:
Do observe that we have defined routing.mode = car
and routing.traffic_timestamp = 1724679300
outside profiles
attribute. These routing properties apply to vehicles with default profiles i.e. vehicles which do not belong to any defined route profiles. Check the next section, to know how we define vehicles with default profiles.
Vehicles
Now we configure each of the vehicles in the fleet and tag them to a routing profile defined earlier. To configure the van properties, we specify:
- A unique ID
start_index
&end_index
to indicate the starting and ending locations of the routecapacity
indicating the storage capacity of the vehicleprofile
to tag the vehicle to the routing profile defined in the previous step
Once the vehicle and its properties are defined, the resulting vehicles
JSON is:
Notice that for “Vehicle_4_default”, we haven’t specified any profiles
. This vehicle is automatically assigned to the “default” profile and is subject to default routing properties. The default routing properties are defined as part of options.routing
attribute and not as part of any profiles
.
Optimization POST Request
When all the above components are put together we get the final POST request that we will submit to the optimizer.
Optimization POST Response
Once the request is made, we get a unique ID in the API response:
Optimization GET Request
We use the request ID and retrieve the result through the Optimization GET request. Following is the GET request:
Optimization GET Response
Following is the optimized route plan:
Following image shows a visual representation of the above route plan.
Caption: Route Plan for different routing profiles
Analyzing the Solution
Looking at the result we can observe that:
- All 3 vehicles were used to fulfill all the tasks.
- One “car” type and a “default” type vehicle was used for 2 deliveries each, while the “minivan” type vehicle was used for remaining 6 deliveries.
- We can see the “minivan” takes a route (blue route in the image representation) which always avoids left turns as defined by its routing profile.
- The solution also returns the details of all the profiles - namely “car”, “minivan” and “default” - used while generating the solution.
The above example exhibits how NextBillion.ai’s Route Optimization API allows making use of multiple routing profiles to generate most efficient routes for a fleet with a variety of vehicle types. We encourage you to go ahead and try out different configurations of profiles, number of tasks / vehicles and explore how the solution changes under different scenarios presented to Route Optimization API.
Learn more about the other powerful features and the related use cases that Route Optimization Flexible API can solve for you.