Last-Mile Load OptimisationDeciding how much of each product a delivery van should carry to its retailers
Every carton put on a delivery van is loaded by hand, and every carton the retailers do not buy is unloaded by hand again. The model predicts how much of each product each retailer will buy, so vans carry what sells and far less stock is handled twice.
For
Japan Tobacco International (JTI), through Alumnus Software
When
2018 – 2020
My role
Built the van-loading models
Carton movements
18–26%fewer, across four sales regions
The problem
Each sales rep drives a van of stock along a planned route of shops. Every carton goes onto the van by hand. Load too much, and the stock rides round all day and comes off again, carton by carton, by hand. Load too little, and a shop goes without, which the client wanted to keep very rare.
So the question, for every rep, every product and every visit day, was how much to load. It covered four sales regions and 45 products in each.
What I built
It started as a proof of concept. The model became a multi-step method rather than a single model, with one structure shared by the four regions and its settings tuned for each region and product: 180 tuned sets in all.
How it works
Will this shop buy? A random forest predicts, for each shop and product, whether there will be a sale on the visit day.
How much? Regression models look at the past year, month and week, and the three answers are averaged. A second model, trained for special days, takes over on holidays, around Easter and after a spell of bad weather.
How much on the van? The shop forecasts are added up per van, and a safety margin from that van's own history goes on top.
Watched. Power BI dashboards tracked the results in near real time.
Two questions per shop, then one decision per van. The safety margin is added once, at the van, not to every shop. Drawn from the project code.
Hard parts and decisions
Four choices shaped the model. For each: what I could have done, and what I chose.
Two questions, not one
A shop does not buy every product on every visit, so most of the answers are zero.
Could have
Trained one regression model to predict the quantity directly, zeros included.
Chose
First predict whether a shop will buy; then, only for the shops that will, predict how much.
One structure, tuned 180 ways
Four regions and 45 products, each selling in its own way.
Could have
One model with one set of settings for everything.
Chose
The same structure everywhere, with its settings tuned for each region and product.
Cost
180 sets of settings to tune and keep up to date.
The safety margin goes on the van
The client wanted shops to run out very rarely, so the plan needed a margin. The question was where to put it.
Could have
Padded every shop's forecast, which adds up to a lot of spare stock.
Chose
Add up the shop forecasts per van, then add one buffer based on that van's own history: larger on Double and Triple Deal Days, and capped by limits for the type of day.
Cost
More rules to tune: the buffer, and a cap for each type of day.
Weather and holidays as inputs
Holidays, Easter and the weather all change what a shop buys, and past sales alone do not show it coming.
Could have
Used dates and past sales alone.
Chose
Scrape historical weather, flag bad-weather spells, count the days to Easter and mark holidays, with a separate model for special days.
Cost
A web scraper to keep running, and a second model to train.
On JTI's Double and Triple Deal Days, registered trade partners and retailers earn two or three times the usual promotional incentives (loyalty points, bonus stock or cash rebates) on qualifying wholesale orders, for a short, limited window. That is why the van's buffer is larger on those days.
Making it reliable
No peeking at the future. Every prediction is trained only on data from before the visit day it predicts.
No forced guesses. Shops with too little history get a simpler model instead of the main one.
Tested on held-out months, from January 2019, comparing the predicted load with what was actually sold.
Watched: Power BI dashboards tracked the KPIs in near real time.
Outcome
18–26%fewer carton movements, and 8 to 13 points less stock unloaded, across the four regions, with shops still very rarely out of stock.
It went into production on Dataiku, one of three products the team shipped for JTI.
My role and the team
I built the van-loading models, with random forests and XGBoost, as one of the first six members of Alumnus Software's data-science team, which grew to 39.