Order Incompatibility

An important business criteria for logistics providers is handling the cargo safely which can sometimes entail not mixing cargo of certain types when transporting them. Order Incompatibility feature of NextBillion.ai’s Route Optimization is designed to efficiently solve such cases involving multiple types of loads. Once the load types of each pickup/delivery are configured along with the information about incompatible load types, the optimization engine suggests a route plan in which vehicles carrying a particular load type will not be assigned to fulfill another pickup/delivery involving an incompatible load type.

Let’s take a look at the following example where we generate an optimized routing plan for a business which manages deliveries involving different types of cargo and some of them are incompatible with each other.

Setup

We have 8 deliveries to be made using 3 vehicles which start from a fixed depot location. Each of the deliveries have a load type and accompanying incompatible load types. Let’s configure the jobs, vehicles and location attributes one by one below.

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:

1{
2 "locations": [...]
3}

Jobs

Next, we define the 8 delivery jobs in our problem statement. For each delivery we add:

  • A unique identifier
  • Location index
  • Load type and the corresponding incompatible load type(s)
  • Delivery quantities

Following is the JSON we use in this example:

1{
2 "jobs": [...]
3}

Vehicles

Now we configure 3 delivery vans that will be responsible for fulfilling the tasks. We specify:

  • A unique ID for each vehicle
  • start_index to denote the depot location from where all vehicles start with right cargo loaded on them for deliveries
  • capacity to indicate the amount of load that can be carried

Once the vehicle and their properties are defined, the resulting vehicles JSON is:

1{
2 "vehicles": [...]
3}

Optimization POST Request

When all the above components are put together we get the final POST request that we will submit to the optimizer.

1curl --location 'https://api.nextbillion.io/optimization/v2?key=<your_api_key>' --header 'Content-Type: application/json' --data '{...}'

Optimization POST Response

Once the request is made, we get a unique ID in the API response:

1{
2"id": "11a74d5345bc13693a9e8d6dd3ef6aea",
3"message": "Optimization job created",
4"status": "Ok"
5}

Optimization GET Request

We use the request ID and retrieve the result through the Optimization GET request. Following is the GET request:

1curl --location 'https://api.nextbillion.io/optimization/v2/result?id=11a74d5345bc13693a9e8d6dd3ef6aea
2&key=<your_api_key>'

Optimization GET Response

Following is the optimized route plan:

1{
2"description": "Order Incompatibility Example",
3"result": {
4"code": 0,
5"summary": {...},
6"unassigned": [....],
7"routes": [....]
8}
9}

Following image shows a visual representation of the above route plan.

docs-image

Analyzing the Solution

Looking at the result we can observe that:

  • All task were fulfilled and the total cost of the solution is 1165
  • All 3 vehicles were used to cater to different load compatibility constraints of the items to be delivered
  • Vehicle 1 caters to deliveries involving “groceries” & “dairy” type items, vehicle 2 caters to “fragile” type and vehicle 3 caters to “materials” type items.
  • The Delivery tasks 6, 7, 8 do not mention the incompatible types but were still grouped with other deliveries which shared their “load_types”.
  • We can also observe that “Delivery 4” was not configured with a load type, instead only the incompatible load types were provided. Consequently, it was fulfilled by a vehicle which did not fulfill deliveries involving the incompatible load types, which in this case is, Vehicle 1.

The above example exhibits how NextBillion.ai’s Route Optimization Flexible API uses the order incompatibility configurations to solve the problem and suggests the optimized route plan. We encourage you to go ahead and try out different configurations of load types, and varying distribution of delivery / pickup tasks 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.