Zone Based Beverage Distribution

Product Used: Route Optimization API

Background

Consider a beverage distributor delivering energy drinks, soft drinks and bottled water from one warehouse in Chicago to 10 bars, restaurants and grocers. The distributor owns two trucks, each owning a territory (North Side and West Side), a small van that serves the downtown (the Loop), and a relief truck to cover overflow. Today the North Side has ordered 600 cases which is higher than the usual quantity. If the routing plan ignores existing territory divisions, drivers may end up in neighborhoods they don't know, or the relief truck can be sent to serve downtown stops it cannot make.

Problem Statements

To build a daily plan that respects territories and still delivers every order, beverage dispatchers need to overcome the following challenges:

Keeping drivers inside their territories

A beverage route driver does more than drop cases. Regular drivers learn specific delivery spots, cooler locations, and dock schedules. Distance or duration based route planning risks sending the West Side truck to unfamiliar North Side, causing delays, misplaced products, and their own West Side accounts keep waiting.

Covering overflow using right delivery vehicle

Order volume swings with weekends, game days and weather, so one territory often needs more than its truck holds. Today's 180-case North Side overflow has to go on the relief truck, a full-size vehicle. Downtown (the Loop) accounts depend on tight curbside loading zones and alleys, so only the small van can make those deliveries. Dispatchers have to use the relief truck wherever it helps while keeping it away from Loop stops, and checking this by hand every morning is slow and easy to get wrong.

Solution

NextBillion.ai's Route Optimization API supports zone-based task allocation, allowing dispatchers to draw territories once and then control, for each vehicle, the zones in which it may or may not deliver.

Draw territories as zones

Each territory is defined in zones with an id and a GeoJSON geometry of type “Polygon”. Keep jobs.zones is unset and the API automatically allocates each account to the zone that contains its location, so orders don't need to be tagged one by one. When a territory is redrawn, only the polygon changes. As an example, downtown (the Loop) is created as zone 3:

1
{
2
"id": 3,
3
"geometry": {
4
"type": "Polygon",
5
"coordinates": [
6
[
7
[-87.6400, 41.8740],
8
[-87.6235, 41.8740],
9
[-87.6235, 41.8870],
10
[-87.6400, 41.8870],
11
[-87.6400, 41.8740]
12
]
13
]
14
}
15
}

Tie each vehicle to its territory

vehicles.allowed_zones lists the only zones in which a vehicle can fulfil tasks. It is a hard constraint meaning the vehicle is restricted from taking up tasks anywhere else. In our example scenario, each route truck gets its own territory, and Loop Van gets zone 3.

1
{
2
"id": "Route Truck North",
3
"start_depot_ids": ["Beverage Warehouse"],
4
"end_depot_ids": ["Beverage Warehouse"],
5
"capacity": [420],
6
"allowed_zones": [1]
7
}

Cover overflows with right vehicle

vehicles.restricted_zones works the other way i.e. the vehicle cannot fulfil tasks in the listed zones but can take tasks anywhere else. Relief Truck can absorb overflow from any territory except the downtown (the Loop, configured as zone 3). The vehicle may still be routed through a restricted zone, so this setting controls where deliveries are made, not which streets are driven.

1
{
2
"id": "Relief Truck",
3
"start_depot_ids": ["Beverage Warehouse"],
4
"end_depot_ids": ["Beverage Warehouse"],
5
"capacity": [420],
6
"restricted_zones": [3]
7
}

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 10 accounts are planned, with unassigned at 0. Route Truck North delivers 180 cases to Delivery-North Account 1, and Relief Truck leaves fully loaded (load: 420) with the other three North Side accounts. Route Truck West serves only the three West Side accounts, and Loop Van delivers all three downtown (the Loop) accounts, none of which appear on Relief Truck's route. The dispatcher gets a plan that covers the overflow without a single territory or downtown access rule being checked by hand.