Allocate tasks based on skills
Product Used: Route Optimization 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. Users can make use of the skills property to ensure that the correct tasks are assigned to agents based on the skills configured for them.
In this example, we will configure 6 tasks and 2 agents to fulfill those tasks. When configuring them we will also add the respective skills needed to fulfill each task. The optimization service will then ensure that only the right agent is assigned to each task and if an agent with the right skillset is not available then some tasks remain unassigned.
Configure optimization request
To configure a Route Optimization request we will need to set up the locations, vehicles involved and the tasks to be performed. Let’s address them one by one below.
Locations
First we define the locations
object and add all the locations used in the problem along with a valid id
. Following is the locations
object with all the coordinates to be used in this example:
Jobs
We define 6 tasks that need to be performed in this example. Following are the constraints that we set for these tasks:
- A unique “id” for each task
- “location_index” for each task
skills
needed to complete the task- Time taken to complete the task once the agent is at the task’s location i.e. the “service” time for each task.
Let’s take a look at the “jobs” after the above properties are configured:
Vehicles
Next, we add details about the 2 agents that are responsible for fulfilling the above tasks. For each agent, we add:
- A unique ID
- “start_index” to denote the point from where the agent starts.
- “skills” of the agent to ensure that only the correct tasks are assigned to them.
Following is the vehicles
JSON with all the above properties configured:
Route Optimization POST request
All the above components are now combined and submitted as a single 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
In the response, we see that the service has correctly assigned the right agent for each task based on the skills that are required to fulfill them. We can also see that some tasks that required skills not possessed by any of the available agents, remain unassigned.
Visit Route Optimization Flexible API documentations to know more about the available optimization features.