General Information
Project name: Automation of courier resource planning in a delivery service.
Period: March 2025 — September 2025 (pilot deployment).
Team: LamArt — 1 mathematician, 1 data engineer.
Project type: Product development: research, prototyping, and deployment of an automated courier shift scheduling system.
Context and Background
Initial situation. A pizza chain (~100 locations, ~300 couriers) with in-house delivery. Courier scheduling balances two opposing requirements: too few couriers — orders take longer, customers abandon due to wait times; too many couriers — work is diluted, each earns less (payment per delivered order). Logistics planners manually balanced couriers across zones and shifts based on experience.
Reasons for launching the project. Manual planning did not scale — it grew with order volume and hit a ceiling before the service itself. Planners spent several hours building schedules, did not account for courier preferences or ratings, leading to no-shows on confirmed shifts.
Goals and objectives. Translate demand forecasts into courier requirements using a unified rule; assemble schedules automatically, leaving validation to the planner; reduce no-shows on confirmed shifts; maintain shift cost within delivery quality constraints.
Expected outcomes. Automated schedule generation; a unified requirement calculation rule; reduced no-shows; scalability to new cities.
Implementation Process
Key stages.
- Demand forecasting. A time series model predicts order volume two days ahead by logistics zone and hour. Forecast accuracy ~10% MAPE. Recalculated daily.
- Orders to couriers. Queueing theory with a finite queue and finite waiting time (customer leaves when waiting time expires). Business constraints are specified: target average delivery time and acceptable share of undelivered orders. Historical data provides average delivery time per zone and no-show rate.
- Shift planning. Stable matching problem — a modification of the Gale-Shapley algorithm. On one side: time slots. On the other: couriers with ratings and stated availability preferences. Couriers receive invitations and confirm; unfilled slots go to a second pass.
- Shift cost estimation. A regression ML model predicts payouts based on order volume and structure, courier count and composition, geography, shift timing, tariffs, and historical cost of similar shifts. The cheapest option satisfying delivery quality constraints is selected.
- Validation. The schedule is approved by a logistics planner. The business sets parameters explicitly: target delivery time and acceptable undelivered order share.
Technologies used. Python, ClickHouse (historical data storage and aggregation), time series, regression model, Gale-Shapley algorithm, queueing theory.
Methodology. Stable matching with party preferences; queueing theory with finite waiting time; ML regression for cost estimation; explicit business parameters replacing implicit planner experience.
Challenges and obstacles.
- Demand forecasting. Sharp demand spikes due to weather, holidays, and promotions broke the model. Had to factor in seasonality, calendar events, and promotional activities as separate variables.
- Couriers. Couriers stated preferences, received slots, then didn't show up. Solved with a second algorithm pass the day before the shift to fill remaining slots.
- Data quality from the client. Zone boundaries were not logged initially, courier payout rules kept changing. Had to build data collection and validation processes in parallel with development.
Results and Conclusions
Actual results. Deployed to ~100 pizzerias, ~300 couriers in pilot operation.
- No-show rate on confirmed shifts reduced by 20% through accounting for courier preferences and ratings.
- Planner time for schedule creation reduced from several hours to several minutes (validation only).
- Courier distribution across zones and shifts is assembled automatically by a unified rule.
- The approach scales to new cities and zones without proportional growth in planner workload.
Deviations from plan. Originally planned direct shift cost calculation, but due to dependency on an external order distribution algorithm, an ML proxy model had to be built.
Qualitative indicators. The trade-off between shift cost and delivery quality is set explicitly through two business parameters, not by intuition. Courier preferences and ratings are accounted for systematically, reducing no-shows.
Lessons Learned and Recommendations
Key successes. The framing "a courier is not a resource unit but a party with preferences" changed the approach: shift planning via stable matching instead of classical demand coverage reduced no-shows by 20% without additional cost. Explicit business parameters (delivery time, undelivered share) allowed the business to manage the cost-quality trade-off directly, without developer involvement.
Challenges overcome. The main difficulties were not in algorithms but in data and people. Demand forecasting broke on sharp spikes from weather and promotions. Couriers confirmed slots and didn't show up — solved with a second algorithm pass the day before. Data quality from the client was poor — zone boundaries weren't logged, payout rules kept changing.
Recommendations for future projects. Build analytics infrastructure from day one — without it, neither forecasting, ML models, nor monitoring work. Formalize business parameters as explicit model inputs rather than implicit planner knowledge — this gives the business a control lever and reduces dependency on specific people.
Key success factors. Mathematical depth (queueing theory, stable matching) combined with practical ML (regression on historical data); a compact team (2 people) controlling the full stack from data to deployment; close collaboration with logistics planners for business parameter validation.
Case Tags
resource planning, queueing theory, stable matching, Gale-Shapley algorithm, time series, regression, ClickHouse, delivery, logistics, schedule automation
