Freshness Reach from Kitchen
Products Used: Isochrone API & Distance Matrix API
Background
Consider a fresh meal producer in Los Angeles cooking in two kitchens, one downtown and one in the valley. The producer serves multiple accounts ranging from cafes and groceries to hospital kitchens. To keep the meals fresh when delivered, the dispatchers need to ensure that meals reach every account within 30 minutes of dispatch. The valley kitchen opened to take pressure off the downtown one, and territories were split by hand leading to routing inefficiencies, violation of freshness window compliance and customer complaints.
Problem Statements
Two challenges that the dispatchers need to overcome in order to onboard serviceable accounts and route them to the right kitchen:
Knowing how much of the city a kitchen reaches
A territory drawn as a circle or a postcode merely tells which addresses fall under a given kitchen, not how much of the city can be covered by it inside the fresh window. The reach itself is shaped by the road types that the delivery vans use, traffic conditions at the time of trip etc. Postcode or radius based planning accepts accounts the kitchen cannot serve in time, leading to lost customers when stock arrives stale.
Deciding which kitchen serves a given account
When both kitchens can serve an account within the required freshness window, determining the optimal assignment presents a challenge. Dispatchers frequently rely on conventional heuristics like geographic proximity, established territory boundaries, or historical assignment patterns. However, these approaches can result in delivery time variations of 10 to 20 minutes, impacting final delivery efficiency.
Solution
NextBillion.ai's Isochrone API and Distance Matrix API support mapping a kitchen's reach inside a fresh window and choosing the optimal kitchen assignments.
Map the reach of a kitchen
To map a kitchen's reach, configure the Isochrone API by setting coordinates to the location of the kitchen and contours_minutes to the duration of the freshness window. The API returns a road-network boundary, enclosing every area reachable by a delivery vehicle in that timeframe. Go a step further and define the departure_time using the scheduled dispatch hour to account for real-time traffic conditions and produce realistic service limits. Any account outside the reachable boundary should not be onboarded. In our example scenario, the valley kitchen requests a single contour for 30 minutes:
Choose the right kitchen for each account
Put every kitchen in origins and every account in destinations of one Distance Matrix request. The API returns the duration, in seconds, for every account, so the dispatcher can choose the kitchen with a faster drive for a given account. For our example scenario, we configure the following origins and destinations:
Sample Request and Response
Following are the requests that we built for this case and the corresponding responses. The response is trimmed for brevity.
Isochrone API Request
Isochrone API Response
Note: Following is not a full response:
Distance Matrix API Request
Distance Matrix API Response
We can verify from the two responses that the boundary and the times answer both questions relevant to this scenario. The valley kitchen's contour marks 30 minutes identifying the extent of its reach. Whereas, the matrix helps discover that West Valley Grocery takes 703 seconds from the valley kitchen against 1,752 from downtown, and Mid City Grocery takes 995 seconds from downtown against 1,541 from the valley. The dispatcher can move each account on these numbers rather than on the territory it sits in.