Machine Learning for Store Delivery Scheduling

Design Replenishment Strategies to Optimize Inventory and Reduce Number of Deliveries from your Warehouse

Machine Learning for Store Delivery Scheduling
Photo by Alex Mecl / Unsplash

Design Replenishment Strategies to Optimize Inventory and Reduce Number of Deliveries from your Warehouse

Article originally published on Medium.

💌 New articles straight in your inbox for free: Newsletter

I. Replenishment Strategy & Sequence

1. Demand Planning & Delivery Schedule


  • Transactions from 2013–01–01 to 2017–12–31
  • 913,000 sales transactions
  • 50 unique SKU
  • 10 Stores
  • 4 days or replenishment per week: Monday, Wednesday, Friday, Sunday
  • 24 hours lead-time between order creation and delivery from the warehouse
  • Store opening from 10:00 am to 08:00 pm
  • Delivery from the warehouse at 09:00 pm
Machine Learning for Store Delivery Scheduling
Replenishment Sequence — (Image by Author)

Following our lead-time requirements, replenishment orders have to be created by the store the day before after store closing.

Our replenishment algorithm will measure the inventory level

  • 10:00 am: before store opening
  • 08:00 pm: after store closing and before delivery (if replenishment day)
Inventory level recorded at 10:00 am before store opening — (Image by Author)

Target: Inventory Day n+1 (10:00 am) = alpha x Capacity (alpha in [0, 1])

  1. Day n-1: Prepare Replenishment
    Data Input: Inventory Day n-1 (09:00 pm), Sales Forecast Day_n, Day_n+1, Day n +2
  2. Target: Inventory of Day n+2 (08:00 pm)
    Fix inventory level before the following delivery: (09:00 pm) Day n+ 2
  3. Demand Planning
    Day_n replenishment needs to cover the demand of Day_n, Day_n+1 and Day_n+2 to reach the inventory level target at the end of Day_n+2 before the next delivery.
  4. Constraint
    Inventory after delivery must be lower than the Maximum Capacity
Demand planning equation — (Image by Author)
Constraint Equation — (Image by Author)

2. KPI setting for Simulation of different strategies

Inventory Shortage Incidents
Our replenishment strategy will be evaluated on its capacity to accurately estimate replenishment quantity to reach inventory target day n+2. This estimation can be underestimated:


Example of Inventory Shortage Incident — (Image by Author)
  1. Day n-1: Prepare Replenishment Orders
    - Warehouse starts preparing orders
  2. Day n: Shipments received at the end of the day
    - Inventory reduced by daily transactions
    - Orders received at the end of the day
  3. Day n+1: Inventory Shortage
    - Inventory level inherited from Day n is not enough to meet Day n+2 demand before shipments arrive at the end of the day.

Average Inventory Level (%)
By day,
100 x Storage Qty (Pcs) / Storage Maximum Capacity (Pcs)

Inventory Optimization: reach the lowest value possible without getting Inventory Shortage Incidents

Reducing Replenishment Frequency
Using the sales forecast, a replenishment strategy can reduce the number of replenishments.

Example of Replenishment Frequency Reduction — (Image by Author)

The example above shows an example of replenishment day skipped; day n inventory is higher than minimum inventory and enough to meet day n+1 demand.

Remark: This KPI is highly dependent on Inventory Level (%); with a low inventory level it is hard to skip a replenishment without risking shortage incidents.

II. Replenishment Method 1: Full Storage Capacity

We’ll start first with a simple replenishment strategy, replenishment order quantity is calculated based on:

  • Day n-1: Replenishment Order at Day n-1
    Input Data: Inventory_Day_n-1 (09:00 pm), Capacity(item)
  • Order Quantity to reach maximum capacity
Replenishment Formula — (Image by Author)
  1. Initial Data

Create Sales DataFrame, Inventory Record, Capacity by Item and Replenishment Data


  • Maximum Storage Capacity = 10 x Maximum Daily Sale (can be tuned later)
  • Replenishment Days: ‘Monday’, ‘Wednesday’, ‘Friday’, ‘Sunday’

2. Method 1

Demand = Capacity_Max - Inventory_Day_n-1 (09:00 pm)

3. Run Simulation by Day

Sales Transactions, Inventory Replenishment, Inventory ≥0

Simulation Results

  • Capacity = 10 x Maximum Daily Sales
  • Replenishment Days: ‘Monday’, ‘Wednesday’, ‘Friday’, ‘Sunday’
Storage Utilization (%) = Stock_Quantity/Capacity_Max — (Image by Author)
Average replenishment quantity (Pcs/Line) — (Image by Author)
Inventory Shortage Incidents: 0
Number of Replenishment Skipped: 0

IV. Conclusion and next steps

1. Conclusion

Method 1 is simple and can be optimized. As expected, we have average storage utilization close to 100% and 0 replenishment days skipped.

The average replenishment quantity graph is also showing us that sales transactions trends are periodic and follow a trend.

2. Next steps

  • Inventory level: target the lowest inventory level ensuring no inventory shortage incidents
  • Order Frequency: using our forecasting model to reduce replenishment

About Me

Let’s connect on Linkedin and Twitter, I am a Supply Chain Engineer that is using data analytics to improve logistics operations and reduce costs.


[1] Store Item Demand Forecasting Challenge (Kaggle), Link

[2] Samir Saci, Machine Learning for Retail Demand Forecasting

Machine Learning for Retail Demand Forecasting | Samir Saci
Comparative study of Demand Forecasting Methods for a Retail Store (XGBoost Model vs. Rolling Mean)