Route Optimization Flexible Tutorials


Basic Route Optimization

In this example we will play around with basic constraints offered in NextBillion.ai’s Route Optimization Flexible API. The constraints covered here are time windows of jobs, vehicle shift timings, skills needed to complete the tasks and capacities involved to carry out pickup/delivery type tasks. We specifically demonstrate how the time windows are used to determine the job sequence & assignment and if the time windows are such that they could not be honored then the task would be left unassigned. We will also see how the starting and ending stops for the vehicle are configured when they are assigned to depots versus when they are not assigned to depots.

Constraints: Maximum Waiting Time

In this example, we learn about the hard constraint of maximum waiting time. NextBillion.ai’s Route Optimization Flexible API provides options to control how long the driver must wait after arriving at the task's location. It is worth noting that this is a hard constraint and applies to all the tasks given in the problem. This feature is helpful when users want to manage the wait times of their drivers or when achieving the lowest wait times is a crucial business goal (for example, consumer-facing services). Let's look at how to incorporate this functionality into an optimization request.

Custom Cost Matrix

In this example, we cover an interesting feature of assigning user-defined travel costs of traveling from one point to another. NextBillion.ai’s Route Optimization Flexible API would then use these custom costs to arrange the job fulfillment in a way such that the overall costs are minimum.

Custom Objective: Equal Task Distribution

Custom Objective is a valuable feature that empowers users to pursue unique objectives which are significantly different from the typical approach of minimizing travel costs. This feature allows users to tune the optimization algorithm to achieve following objectives:

Re-Optimization: New Tasks

NextBillion.ai’s Route Optimization Flexible API offers a powerful re-optimization feature which allows the users to re-optimize a set of existing or new tasks by readjusting some variables, if needed.

Re-Optimization: Unassigned Tasks

NextBillion.ai’s Route Optimization Flexible API offers a powerful re-optimization feature which allows the users to fulfill previously unassigned tasks by readjusting some variables. These variables can be the number of vehicles included in the optimization request, modifying the shift timings or capacities of the vehicles involved or changing the task time windows or any other strategy that would increase the chances of higher task assignments.

Task Sequencing

Relations are used to specify the association between different tasks that should be performed in a certain order. NextBillion.ai’s Route Optimization Flexible API offers three types of relations that the users can enforce:

Vehicle costs

In this example, we learn about the vehicle cost attributes. NextBillion.ai’s Route Optimization Flexible API currently provides two types of vehicle costs - fixed and per_hour costs. Fixed costs are the cost of using the vehicle irrespective of how long the vehicle remains in use. Driver fee, license fee, taxes etc can be thought of as fixed costs. If only the fixed cost of the vehicle is provided then it will be added to the travel_cost of the route.

Soft Constraints

The Soft Constraints feature enables users to complete more tasks by treating specific time-related limitations as flexible. NextBillion.ai’s Route Optimization Flexible API currently allows vehicle shift timings and task time windows to be made flexible up to a configurable degree. This functionality is useful in commercial scenarios where job completion ratio is the most crucial measure and time constraints are not strict. Let’s build an example to understand how these constraints work.

Vehicle: Max Travel Cost and Max Tasks

In this example we will learn about some useful vehicle constraints. NextBillion.ai’s Route Optimization Flexible API provides options to control the maximum number of tasks that a vehicle can serve and also the maximum travel cost that it can incur. These parameters can be used to limit the usage of vehicles and prevent them against unexpected high costs, potential breakdowns or just control the fuel consumptions.