Order Grouping
NextBillion.ai’s Route Optimization Flexible API offers a simple but useful feature, called order grouping, that enhances the driver experience by conveniently planning a common stop for multiple tasks located closeby. Users can configure a diameter which will be used to group all tasks falling within the given range and treat them as a single stop. For scenarios involving multiple tasks in a condo, or in a building, or a housing complex, users can utilize this feature to resolve all such locations to a single stop saving time and driver’s effort to park the vehicle at multiple stops. Let’s build an example to implement this feature
Setup
We have a total of 5 delivery jobs out of which 3 are located quite close to each other. We will use a single vehicle to fulfill all these deliveries.
Locations
We will start by adding all the locations
used in the problem along with a valid id
. The locations
object with all the coordinates used in this example:
Jobs
Next we define 5 delivery jobs by specifying:
- A unique identifier for each task
- Location indexes for each task
- Delivery quantities for each task
- Service time for each task
Let’s take a look at the jobs
JSON after the above properties are configured:
Vehicles
Next, we add the details of the vehicles that will be responsible for fulfilling the tasks. We configure:
- A unique ID
- Vehicle’s capacity
- Start_index to denote the point from where the vehicle would start.
Following is the vehicle JSON that is used:
Options
And lastly, we configure the criteria to group the tasks that are close by. For our example, we specify a diameter of 200 meters to group any tasks located close to each other :
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:
The following images give a visual representation of how this feature works.
Without Order Grouping
With Order Grouping
Analyzing the Solution
Looking at the result we observe that:
- All the tasks were successfully assigned with a total travel cost of 1410
- The 3 delivery tasks, Delivery 1, 2 & 3, located close to each other were treated as a single stop. The location of the common stop was returned by the field
projected_location
in the solution.
This example exhibits how NextBillion.ai’s Route Optimization Flexible API can be used to group nearby tasks to save time, get efficient route plans and deliver a good driver experience. Readers can go ahead and try out different configurations of grouping criteria and task locations or just remove the grouping constraint and compare travel costs to 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.