Zone Based Allocations
Zone based allocations refers to the ability of NextBillion.ai’s Route Optimization service to allow or prohibit certain vehicles from operating in a certain zone. The zones can be configured on the fly while building the input optimization request or can refer to geofence IDs created using Geofence API. Zone based allocations are a practical way to avoid overlapping coverage, longer traveling distance and other inefficiencies during route planning. On top of these benefits, it also helps in leveraging the knowledge and experience of drivers by making them operate in a familiar neighborhood, thereby improving the service delivery.
Setup
In this example we define 4 custom zones and 12 delivery tasks spread across these zones. We will use 4 vehicles to complete these tasks with each vehicle allowed to fulfill tasks in one zone only. We will start by configuring the locations and other entities one by one.
Locations
We start by adding all the locations
used in the problem along with a valid id
. The locations
object with all the points used in this example:
Jobs
Next we define the 12 delivery tasks. For each task we:
- add an unique identifier
- add a location index
- add a delivery quantity
- add zone IDs to which the task belongs to. Although, service can auto-allocate the tasks to specific zones based on the task’s location and zone geometries.
Following is the “jobs” JSON that we use
Zones
Next we would create custom boundaries to divide the serviceable area into 4 zones. Zones can be created on the fly by providing geoJSON attributes for each of the polygons or by using NextBillion.ai’s Geofence API and then using those geofence IDs as an input to zones.geofence_id
.
For our example, we use the geoJSON details of each of the zones and provide them as input in the zones
attribute.
Vehicles
Next, we add 4 vehicles that will be responsible for fulfilling the deliveries within the defined zones. To describe the vehicles and their properties we add:
- A unique ID for each vehicle
start_index
to denote the point from where the vehicle would startallowed_zones
to specify the zone where each of the vehicles is allowed to fulfill the deliveriescapacity
for each vehicle
Once the vehicle and their properties are defined, the resulting vehicles
JSON is:
Optimization POST Request
Now let’s put all these components together and create 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 take the ID and use the Optimization GET request to retrieve the result. Here is the GET request:
Optimization GET Response
Following is the optimized route plan:
Following image shows a visual representation of the above route plan
![documentation image](https://static.nextbillion.io/docs-next/docs/route-optimization/zone-allocation.webp)
Analyzing the Solution
From the result we observe that:
- All the tasks were assigned and the total cost of the route plan is 4247
- Each of the vehicles fulfill tasks from its assigned zones only, without any overlapping regions. However, depending on the starting point of the vehicles they can travel through restricted zones, but will not fulfill tasks in such zones.
The above example exhibits how NextBillion.ai’s Route Optimization Flexible API allows users to create custom zones and then choose which vehicles can fulfill tasks in what zones, ensuring streamlined operations and better service delivery. We encourage you to go ahead and try out different ways of configuring zones, using Geofence API, and letting the service auto-allocate tasks to the zone as per their geolocation and explore how the solution changes under different scenarios presented to Route Optimization Flexible API.
Learn more about the other powerful features and the related use cases that Route Optimization Flexible API can solve for you.