Design Route Optimization

Hard45 min
1 / 30
understanding9 min read

Problem Statement: Fleet Route Optimization

Problem Statement: Fleet Route Optimization — route optimization interview depth

Problem Statement: Fleet Route Optimization

At its core, fleet route optimization is the Vehicle Routing Problem (VRP): assign thousands of delivery stops to hundreds of vehicles each day so that every vehicle follows an ordered sequence of stops that respects capacity, service time, and customer time windows, all while minimizing total drive time and fuel. This is not the textbook Traveling Salesman Problem — TSP threads one vehicle through every stop, whereas the real system juggles a heterogeneous fleet, a mix of hard and soft constraints, and an objective that trades drive time against lateness. The decisive architectural split is between offline batch planning (solve the whole day's routes before the shift starts) and online re-optimization (cheaply repair the live plan when new stops, traffic, or cancellations land mid-shift). Conflating the two is the classic failure: a batch solver runs for minutes over the full problem, but a mid-shift change needs a bounded, incremental repair that never strands a driver with a blank map.

LensDetail
Coreassign thousands of stops to hundreds of vehicles daily
Constraintrespect capacity, service time, and customer time windows
Outputminimize drive time and fuel while honoring SLA breaches as soft penalties
Opsexpose plan_id drivers can follow on mobile with live traffic refresh

Track plan_solve_p99_sec, matrix_build_minutes, stops_per_vehicle_p95, and replan_events_per_hour. Page when matrix age exceeds 15 minutes in peak lunch corridors.

Edge cases: Solver timeout returns last feasible plan; never blank-map drivers. Duplicate plan tokens must not spawn twin routes.

javaOne Dark Pro
1public record PlanRequest(String depotId, List<String> stopIds, Instant horizonStart, String matrixVersion) {}
pythonOne Dark Pro
1def stops_per_vehicle(stops: int, vehicles: int) -> float:
2 return stops / max(vehicles, 1)
typescriptOne Dark Pro
1export interface RoutePlan { planId: string; matrixVersion: string; vehicleRoutes: VehicleRoute[]; }

Why interviewers care

A strong answer frames this as a constrained optimization problem with an explicit objective, not a CRUD service: name the cost function, separate batch planning from incremental repair, and state exactly what the solver returns when it runs out of time. That vocabulary — feasibility, time windows, soft penalties, last-feasible-plan — is what an interviewer listens for.

Interview checkpoint

Keep one concrete outage ready: the solver blows its time budget on a 900-stop region at lunch peak, so rather than blank the drivers' maps you publish the last feasible plan and flag the unassigned stops explicitly — degrade, never disappear.

Key Highlights

  • assign thousands of stops to hundreds of vehicles daily
  • respect capacity, service time, and customer time windows
  • minimize drive time and fuel while honoring SLA breaches as soft penalties
  • expose plan_id drivers can follow on mobile with live traffic refresh
pro tip
Route optimization sec-01: pro-tip — tie decisions to matrix_version and plan tokens.
interviewer loves
Route optimization sec-01: interviewer-loves — tie decisions to matrix_version and plan tokens.
common mistake
Route optimization sec-01: common-mistake — tie decisions to matrix_version and plan tokens.
trade off
Route optimization sec-01: trade-off — tie decisions to matrix_version and plan tokens.

Section Rescue Kit

Buzzwords to use:

Cost matrix generationLarge Neighborhood Search

Safe statements:

  • "For Problem Statement: Fleet Route Optimization, I'll pin matrix_version before discussing solver choice."
  • "Let me quantify stops and vehicles before picking heuristic vs MILP."
Design Route Optimization - System Design | WinJob | WinJob