Mixed Food Logistics

Product Used: Route Optimization API

Background

Consider a Las Vegas foodservice distributor delivering to casinos, hotel restaurants, bars, cafés, and a food court from a single warehouse. Orders combine heavy beverage containers with lightweight snacks and paper products, while some accounts also require frozen items. The fleet consists of two dry box trucks and one multi temp truck. Each truck's load capacity is bound by weight limits, total packages, and, for the multi temp vehicle, dedicated frozen space. A plan that optimizes for only one of the limits leaves unutilized capacities for others, and the same order looks small measured in one unit and large measured in another.

Problem Statements

To fill every truck each morning without overloading it, foodservice dispatchers need to overcome the following challenges:

Balancing weight against package space

A box truck runs out of space before it runs out of payload when it is loaded with cartons of snacks, napkins and light paper goods, and runs out of payload before space when it carries beverages. Distance or duration based route planning treats an order as a single quantity, so trucks arrive overweight or half empty, and dispatchers discover the mistake at the dock. Packing the heaviest accounts together sends one truck out over its limit, while packing the lightest together leaves a second truck underused.

Keeping frozen goods on a truck that can hold them

Only the multi temp truck has freezer space, while dry goods fit anywhere. An order can include frozen items alongside dry ones, and a plan that counts packages alone or distance alone may load a pallet of frozen food onto a dry truck, where it risks spoilage before the last stop. Dispatchers check freezer space account by account, which is slow and easy to get wrong on a morning with several frozen orders.

Solution

NextBillion.ai's Route Optimization API supports multi-dimensional capacity, allowing dispatchers to describe each truck and each order as a set of quantities and let the optimizer keep every dimension within limits.

Assign capacities per dimension for each truck

vehicles.capacity is an array of integers, with one entry for each load dimension the dispatcher wants to track. The API verifies each dimension independently, so that the total quantity assigned to one dimension never exceeds that truck's capacity for that dimension. In our example scenario, a total of 3 dimensions are used – weight (pounds), packages and frozen packages – in that order. The dry box trucks are configured for the first 2 dimensions. The multi-temp truck features dedicated freezer capacity, whereas the dry box trucks have no freezer capacity:

1
{
2
"id": "Dry Box Truck 1",
3
"start_depot_ids": ["Foodservice Warehouse"],
4
"end_depot_ids": ["Foodservice Warehouse"],
5
"capacity": [10000, 1600, 0]
6
},
7
{
8
"id": "Multi Temp Truck",
9
"start_depot_ids": ["Foodservice Warehouse"],
10
"end_depot_ids": ["Foodservice Warehouse"],
11
"capacity": [8000, 1400, 300]
12
}
13
}

Measure every order on the same dimensions

jobs.delivery takes an equally sized array, so each account states how much it needs in weight (pounds), packages and frozen packages. Keep dimension ordering consistent across vehicles and jobs. Frozen items are counted only when ordered and dry trucks have zero frozen capacity, preventing wrong assignments. In our example scenario, a buffet restaurant order requiring both dry and frozen items together would be configured as:

1
{ "id": "Delivery-Buffet Restaurant", "location_index": 6, "service": 1200, "delivery": [1500, 250, 180] }

Sample Request and Response

Following is a JSON request that we built for this case and the corresponding response. The response is trimmed for brevity.

API Request

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

API Response

1
{
2
"status": "Ok",
3
"result": {
4
"summary": "{...}",
5
"unassigned": "[...]",
6
"routes": "[...]"
7
}
8
}

All 9 accounts are planned, with unassigned at 0. Dry Box Truck 2 leaves the warehouse at 8,000 lb against its 10,000 lb limit, carrying the three heaviest beverage accounts, while Dry Box Truck 1 takes the three snack and paper accounts at 1,350 of its 1,600 packages. Multi Temp Truck starts at [7100, 1380, 280], inside every limit, and its frozen load falls to 0 once Delivery-Buffet Restaurant and Delivery-Steakhouse are served. The dispatcher gets a plan in which no truck is over in any dimension, without balancing weight and packages by hand.