Product Context
SwiftRoute is a same-day delivery platform that matches incoming delivery jobs to a fleet of drivers across 40 cities. The dispatch system must assign each order to the best vehicle and continuously adapt routes as traffic, cancellations, and new jobs arrive.
Scale
| Signal | Value |
|---|
| DAU | 8M customers, 220K active drivers/day |
| Peak order creation QPS | 18K jobs/sec globally |
| Concurrent active vehicles | 95K |
| Daily completed jobs | 32M |
| Service area graph | 12M road segments across all cities |
| Per-dispatch latency budget (p99) | 800ms end-to-end |
Task
Design an end-to-end ML-powered dispatch optimization system. Your solution should address:
- How you would frame the problem: assignment, ETA prediction, route optimization, and re-dispatch under changing conditions
- A multi-stage architecture for candidate vehicle retrieval, dispatch ranking, and final constrained re-ranking / optimization
- What algorithms or models you would use at each stage, and when you would prefer heuristics / OR methods over learned models
- Offline and online data pipelines, including labels, feature freshness, and feedback loops
- Evaluation strategy across offline simulation and online experimentation
- Failure modes, monitoring, and rollback plans
Constraints
- Hard SLA: 98% of jobs must be assigned within 2 seconds of order creation
- Driver app location updates arrive every 3-5 seconds and can be noisy or missing
- Traffic conditions shift quickly during rush hour; ETA features older than 2 minutes are often stale
- Some cities require explainable dispatch decisions for regulatory audits
- Serving cost must stay under $0.003 per dispatch decision
- The system must degrade gracefully to a rules-based dispatcher if ML services are unavailable