KatInterview

Designing an ML-Driven Workload Allocator for Delivery Drivers

Machine LearningModel answer
HardModel answerMachine Learningoptimizationgradient-boostingcold-start

Last updated

Design a system that forecasts stop service times with ML and feeds them to a constrained optimizer to split a shift's deliveries across drivers, balancing punctuality and fairness.

A last-mile delivery station has always split each shift's parcels among drivers by hand. You are asked to replace this with an automated allocation system that decides how much work each driver gets on each shift.

The system should maximize on-time delivery while keeping workloads fair across drivers.

Describe a complete design that covers:

  1. Objective. One or more objective functions. For example, reward on-time probability and penalize overtime and distance, with a fairness term or constraint on workload spread.
  2. Constraints. Shift length, vehicle capacity (weight and volume), delivery windows, geographic contiguity of each driver's area, required skills or certifications, and the observed distribution of time spent at stops.
  3. Data and features. For example, stop density, hour- and weather-dependent travel-time forecasts, parcel size class, stop difficulty, and each driver's historical productivity.
  4. Algorithm. Predict per-stop service time with an ML model (such as gradient boosting), then pass the predictions to a constrained optimizer (integer or linear programming, or min-cost flow).
  5. Operational robustness.
    • How you handle brand-new drivers with no history (cold start).
    • How you protect the system against distribution shift.
    • A fast rebalancing heuristic for last-minute spikes in volume or driver availability.
  6. End-to-end loop. Pseudocode for forecast, optimize, simulate, assign, and monitor, plus what the system does if the optimizer fails or times out.

State any assumptions about scale and latency, and explain the trade-offs behind your choices.

Hints

Hint 1

Decide what fairness means before modeling: equalizing predicted work hours is very different from equalizing parcel counts. Also plan against an upper quantile (e.g. P80) of service time rather than the mean.

Hint 2

Split the problem: group stops into small geographic clusters, assign clusters to drivers with an integer program, then sequence each route with a routing heuristic. This keeps the optimization tractable at tens of thousands of stops.

Hint 3

For the operational pieces, think about shrinkage toward a cohort average for new drivers, monitoring quantile coverage to detect drift, a freeze-and-repair heuristic for spikes, and a deterministic greedy fallback when the solver fails.