Series · 76 entries in 13 parts

Vehicle Routing, End to End

A complete reference on vehicle routing: from the TSP to production routing engines, in 13 parts.

17 of 76 published

Who it's for
Someone starting from zero who wants to understand VRP end to end.
Running example
berlin52 from TSPLIB: 52 cities, optimal tour length 7,542. Every post shows its gap to optimal.
Solvers, from Part 5
PyVRP (the ILS example); reinterpretcat/vrp in Rust (the ruin-and-recreate contrast)

Every post follows the same format

  1. Read first: prerequisites, each with a one-line refresher, and the question the post answers
  2. Intuition, built on a hand-worked example of 6–10 stops
  3. The formal idea, with just enough math
  4. Common misconceptions
  5. Try it in Python (Parts 0–4, plain Python, no libraries), then In PyVRP / in reinterpretcat/vrp from Part 5 on
  6. A short exercise

Parts 1–7 form a chain: each post ends with a limitation that the next post fixes. Parts 8–12 are reference parts you can read in any order.

Part 0 · 7 entries

Start here

Part 0 orients the reader before any algorithm appears.

  1. 0

    History and series map

    A timeline from Dantzig, Fulkerson and Johnson (1954) and Dantzig and Ramser (1959) through Clarke-Wright, Lin-Kernighan, Christofides, Concorde and HGS; where each part fits; suggested reading paths

    Read first: Nothing

  2. A

    Primer: graphs

    Nodes, edges, weights; directed vs. undirected; paths, cycles, spanning trees, matchings; distance matrices

    Read first: Nothing

  3. B

    Primer: algorithms and complexity

    Big-O; recursion; arrays, linked lists and heaps; polynomial vs. exponential growth

    Read first: Nothing

  4. C

    Primer: linear and integer programming

    Variables, constraints, objective; LP relaxation; simplex intuition; duality and reduced costs; integer variables

    Read first: Primer A

  5. D

    Primer: probability and statistics

    Random sampling; expectation and variance; distributions; comparing results across runs

    Read first: Nothing

  6. E

    Primer: Python, and reading Rust

    Enough Python for the code in each post; enough Rust syntax to follow reinterpretcat/vrp

    Read first: Nothing

    Planned
  7. ·

    Glossary and notation (reference page)

    Every term and symbol used in the series, linked from each post

    Read first: Nothing

Part 1 · 3 entries

The Traveling Salesman Problem

Part 1 defines the TSP, shows why it is hard, and introduces its family of variants.

  1. 1

    What is the TSP?

    Cities, tours, tour cost; a tour as a permutation; symmetric vs. asymmetric; shortest path (Dijkstra) is not the TSP

    Read first: Primer A

    Limitation that leads to the next post: How hard can it be?

  2. 2

    Why is the TSP hard?

    (n−1)!/2 tours; brute force on 8 cities; P vs. NP and NP-hardness, intuitively; optimal vs. good enough

    Read first: Post 1 · Primer B

    Limitation that leads to the next post: Real problems rarely look exactly like the TSP

  3. 3

    The TSP family

    Asymmetric TSP; multiple TSP (the bridge to VRP); TSP with time windows; prize-collecting TSP; orienteering

    Read first: Posts 1–2

    Limitation that leads to the next post: Can we still solve these exactly?

Part 2 · 5 entries

Exact methods

Part 2 covers the methods that prove a solution is optimal, and why they stop scaling.

  1. 4

    Dynamic programming: Held-Karp

    Subproblems over subsets of cities; O(n²·2ⁿ) time and memory

    Read first: Post 2 · Primer B

    Limitation that leads to the next post: Memory explodes past a few dozen cities

  2. 5

    Branch and bound

    Branching on edges; lower bounds (assignment, 1-tree, Lagrangian relaxation); pruning; search order

    Read first: Post 2 · Primer A

    Limitation that leads to the next post: Pruning is only as good as the bounds

  3. 6

    Integer programming formulations

    Decision variables per edge; degree constraints; subtour elimination (DFJ vs. MTZ); LP relaxation and the optimality gap

    Read first: Post 1 · Primer C

    Limitation that leads to the next post: Exponentially many subtour constraints

  4. 7

    Branch-and-cut and Concorde

    Adding violated cuts only when needed; how Concorde solves very large TSPs exactly

    Read first: Posts 5–6

    Limitation that leads to the next post: Hard to model rich side constraints

  5. 8

    Constraint programming for routing

    Variables, domains and propagation; how Google OR-Tools' routing solver uses CP with local search

    Read first: Posts 3, 5

    Limitation that leads to the next post: Too slow for daily operations at scale; we need fast answers

Part 3 · 2 entries

Fast first answers

Part 3 builds a tour quickly, with and without a guarantee on its quality.

  1. 9

    Construction heuristics

    Nearest neighbor; cheapest, nearest and farthest insertion; space-filling curves; speed vs. quality against the berlin52 optimum

    Read first: Posts 1–2

    Limitation that leads to the next post: No promise on how bad a tour can be

  2. 10

    Approximation algorithms

    Approximation ratio; MST-based 2-approximation; Christofides (at most 1.5× optimal); why guarantees need the triangle inequality; limits of approximability

    Read first: Post 9 · Primer A

    Limitation that leads to the next post: Tours still have obvious flaws, such as crossing edges

Part 4 · 5 entries

Local search

Part 4 improves a tour with small changes until no change helps.

  1. 11

    Neighborhoods and the 2-opt move

    Removing crossing edges by reversing a segment; delta evaluation (a move's cost change without re-scoring the tour)

    Read first: Post 9

    Limitation that leads to the next post: Only one kind of move

  2. 12

    More moves

    Or-opt, swap, relocate; first-improvement vs. best-improvement

    Read first: Post 11

    Limitation that leads to the next post: Search gets slow as tours grow

    Planned
  3. 13

    Making local search fast

    Neighbor lists; don't-look bits; tour data structures (arrays vs. linked lists)

    Read first: Post 12 · Primer B

    Limitation that leads to the next post: Simple moves miss deeper improvements

    Planned
  4. 14

    k-opt and Lin-Kernighan

    3-opt; variable-depth search; Lin-Kernighan; LKH, the strongest TSP heuristic

    Read first: Post 13

    Limitation that leads to the next post: The search still stops improving

    Planned
  5. 15

    Local optima

    Search landscapes; why local search gets stuck; why random restarts throw away good structure

    Read first: Post 12

    Limitation that leads to the next post: We need a way to escape

    Planned

Part 5 · 4 entries

Iterated local search on the TSP

Part 5 assembles ILS from four parts and tests it on berlin52.

  1. 16

    The ILS idea

    The four-part loop: starting solution, local search, perturbation, acceptance

    Read first: Post 15

    Limitation that leads to the next post: How do we kick the solution?

    Planned
  2. 17

    Perturbation

    The double-bridge move; choosing kick strength (too weak falls back, too strong is a random restart)

    Read first: Post 16

    Limitation that leads to the next post: When do we keep the new solution?

    Planned
  3. 18

    Acceptance criteria

    Accept only improvements, random walk, simulated-annealing style, late acceptance

    Read first: Post 16 · Primer D

    Limitation that leads to the next post: The parts are not yet combined

    Planned
  4. 19

    Putting ILS together

    Stopping criteria, tuning, results against the berlin52 optimum

    Read first: Posts 17–18

    Limitation that leads to the next post: Is ILS the only way to escape local optima?

    Planned

Part 6 · 12 entries

The metaheuristic family

Part 6 covers the other main ways to escape local optima, each compared with ILS on berlin52.

  1. 20

    Simulated annealing

    Temperature; cooling schedules; accepting worse moves with a probability

    Read first: Posts 15, 18 · Primer D

    How it escapes local optima: Accepts worse solutions early, less often over time

    Planned
  2. 21

    Tabu search

    Tabu list; tenure; aspiration criteria

    Read first: Post 15

    How it escapes local optima: Forbids recently undone moves so the search can't cycle back

    Planned
  3. 22

    Guided local search

    Edge features; penalties on frequently used costly edges

    Read first: Post 15

    How it escapes local optima: Changes the cost function to push the search away

    Planned
  4. 23

    Variable neighborhood search

    Systematic switching between neighborhoods; VND vs. VNS

    Read first: Posts 12, 15

    How it escapes local optima: A local optimum in one neighborhood may not be one in another

    Planned
  5. 24

    GRASP

    Greedy randomized construction plus local search; restricted candidate lists

    Read first: Posts 9, 15

    How it escapes local optima: Many different, good starting points

    Planned
  6. 25

    Ant colony optimization

    Pheromone trails; evaporation; building tours from learned edge preferences

    Read first: Post 9 · Primer D

    How it escapes local optima: Learns good edges from many constructed tours

    Planned
  7. 26

    Large neighborhood search: ruin-and-recreate and ALNS

    Destroy and repair operators; adaptive operator selection; how reinterpretcat/vrp works

    Read first: Posts 15, 19

    How it escapes local optima: Rebuilds a large part of the solution at once

    Planned
  8. 27

    Genetic and memetic algorithms

    Populations; crossover for tours (OX, EAX); mutation; adding local search (memetic)

    Read first: Post 15 · Primer D

    How it escapes local optima: Combines parts of different good solutions

    Planned
  9. 28

    Hyper-heuristics

    Heuristics that choose which heuristic to run next; reinterpretcat/vrp's rosomaxa

    Read first: Post 26

    How it escapes local optima: Learns which search strategy works best during the run

    Planned
  10. 29

    Matheuristics

    Combining exact solvers with heuristics; set-partitioning over routes found by a heuristic

    Read first: Posts 6, 26

    How it escapes local optima: Uses an exact solver to recombine heuristic solutions

    Planned
  11. 30

    Parallel search

    Parallel restarts; cooperating searches; reproducibility trade-offs

    Read first: Post 19

    How it escapes local optima: Explores many regions at once

    Planned
  12. 31

    Choosing a metaheuristic

    Single-solution vs. population methods; intensification vs. diversification; no free lunch

    Read first: Posts 20–30

    How it escapes local optima: Summary of the family

    Planned

Part 7 · 9 entries

From TSP to VRP

Part 7 extends the same ideas to many vehicles, capacity and time windows, ending with how PyVRP does it.

  1. 32

    From one tour to many routes

    The capacitated VRP (CVRP); giant tour + split (cutting one tour into routes that fit vehicles)

    Read first: Posts 3, 19

    Limitation that leads to the next post: How do we build good routes directly?

    Planned
  2. 33

    VRP construction heuristics

    Clarke-Wright savings; sweep; cluster-first route-second vs. route-first cluster-second

    Read first: Posts 9, 32

    Limitation that leads to the next post: Moves only work inside one route

    Planned
  3. 34

    Capacity and moves between routes

    Relocate, swap, 2-opt* and CROSS-exchange across routes; feasibility checks

    Read first: Posts 12, 32

    Limitation that leads to the next post: Strict feasibility blocks good moves

    Planned
  4. 35

    Searching through infeasible solutions

    Penalizing constraint violations instead of forbidding them; adjusting penalty weights

    Read first: Post 34

    Limitation that leads to the next post: The pieces need to run as one search

    Planned
  5. 36

    ILS for the CVRP

    The Part 5 loop with perturbations adapted for routes

    Read first: Posts 19, 33–35

    Limitation that leads to the next post: Real customers have time windows

    Planned
  6. 37

    Adding time windows

    VRPTW; forward time slack; segment concatenation to keep move evaluation fast

    Read first: Post 36

    Limitation that leads to the next post: Can a population do better than one solution?

    Planned
  7. 38

    Hybrid Genetic Search (HGS)

    Population of feasible and infeasible solutions; OX crossover + split; local search as education; diversity management; SWAP*

    Read first: Posts 27, 36–37

    Limitation that leads to the next post: How do we prove a VRP solution is optimal?

    Planned
  8. 39

    Exact methods for VRP

    Set partitioning; column generation; pricing with resource-constrained shortest paths; branch-cut-and-price

    Read first: Posts 7, 37 · Primer C

    Limitation that leads to the next post: How do production-grade solvers combine all this?

    Planned
  9. 40

    How PyVRP's ILS works

    Map each part to what readers built; why PyVRP moved from HGS to ILS

    Read first: Posts 36–38 · Primer E

    Limitation that leads to the next post: Real problems come in many variants

    Planned

Part 8 · 14 entries

The VRP variant atlas

Part 8 gives each major variant its own post: what changes in the model, which methods adapt, and where it shows up in practice.

  1. 41

    Pickup and delivery, and dial-a-ride

    Paired stops; precedence; ride-time limits

    Read first: Post 37

    Where it shows up: Couriers, food delivery, ride-sharing, patient transport

    Planned
  2. 42

    Multi-depot VRP

    Assigning customers to depots; depot-aware moves

    Read first: Post 36

    Where it shows up: Networks with several warehouses or hubs

    Planned
  3. 43

    Heterogeneous fleet and fleet sizing

    Vehicle types with different capacity and cost; fleet mix decisions

    Read first: Post 36

    Where it shows up: Mixed fleets of bikes, vans and trucks

    Planned
  4. 44

    Open VRP and backhauls

    Routes that don't return to the depot; deliveries before pickups

    Read first: Post 36

    Where it shows up: Contracted drivers; returns collection

    Planned
  5. 45

    Split delivery

    One customer served by several vehicles

    Read first: Post 36

    Where it shows up: Large orders, bulk distribution

    Planned
  6. 46

    Multi-trip VRP

    Vehicles reloading at the depot during a shift

    Read first: Post 37

    Where it shows up: Urban delivery with small vehicles

    Planned
  7. 47

    Periodic VRP

    Planning visits over several days with visit frequencies

    Read first: Post 36

    Where it shows up: Maintenance, sales visits, waste collection

    Planned
  8. 48

    Prize-collecting and team orienteering

    Choosing which customers to serve; profit vs. cost

    Read first: Posts 3, 36

    Where it shows up: Optional visits, limited capacity days

    Planned
  9. 49

    Time-dependent VRP

    Travel times that change with time of day; FIFO property

    Read first: Post 37

    Where it shows up: Urban traffic, rush hours

    Planned
  10. 50

    Electric and green routing

    Battery range; charging stops; emissions as an objective

    Read first: Post 37

    Where it shows up: EV fleets, sustainability targets

    Planned
  11. 51

    Location-routing and two-echelon VRP

    Choosing depot locations together with routes; hubs and satellites

    Read first: Post 42

    Where it shows up: Network design, city logistics

    Planned
  12. 52

    Inventory routing

    Deciding when and how much to deliver as well as the routes

    Read first: Post 47 · Primer C

    Where it shows up: Vendor-managed inventory, fuel and gas delivery

    Planned
  13. 53

    Arc routing

    Serving streets instead of points; Chinese postman; capacitated arc routing

    Read first: Posts 3, 36 · Primer A

    Where it shows up: Garbage collection, street sweeping, meter reading

    Planned
  14. 54

    Drones, crowdsourcing and on-demand delivery

    Truck-and-drone routing; crowdsourced drivers; instant delivery

    Read first: Post 41

    Where it shows up: Emerging last-mile models

    Planned

Part 9 · 4 entries

Objectives, uncertainty and scale

Part 9 covers what changes when there is more than one goal, when the future is uncertain, and when instances get very large.

  1. 55

    Multi-objective routing

    Cost vs. vehicles vs. service quality vs. emissions; weighted sums; ranked (lexicographic) objectives; Pareto fronts

    Read first: Post 36

    Planned
  2. 56

    Stochastic and robust routing

    Uncertain demands and travel times; chance constraints; recourse; robust plans

    Read first: Post 37 · Primer D

    Planned
  3. 57

    Dynamic and real-time routing

    Orders arriving during the day; re-optimization; plan stability; policies instead of single plans

    Read first: Posts 37, 56

    Planned
  4. 58

    Large-scale routing and decomposition

    Clustering; splitting big problems into regions; boundary effects; solving 10,000+ stops

    Read first: Posts 26, 36

    Planned

Part 10 · 5 entries

Routing in the real world

Part 10 covers what it takes to run routing in production, beyond the algorithm.

  1. 59

    Where the distance matrix comes from

    Shortest-path algorithms on road networks (Dijkstra, A*, contraction hierarchies); OSRM and similar engines; asymmetric distances; n² matrix cost at scale

    Read first: Post 1 · Primer A

    Planned
  2. 60

    Real-world constraints

    Skills, breaks, shifts, vehicle–order compatibility, priorities and workload balancing, shown in reinterpretcat/vrp

    Read first: Posts 26, 37

    Planned
  3. 61

    Data quality

    Geocoding errors; service-time estimation; demand and capacity units; how bad inputs break good algorithms

    Read first: Post 37

    Planned
  4. 62

    Plans vs. what drivers actually do

    Driver knowledge and route adherence; lessons from the Amazon Last Mile Routing Research Challenge

    Read first: Post 37

    Planned
  5. 63

    Architecture of a production routing engine

    Request flow; matrix service; solver service; time limits and anytime behavior; re-planning; explaining routes to operations teams

    Read first: Posts 59–62

    Planned

Part 11 · 3 entries

Evaluation and the solver landscape

Part 11 covers how to judge solvers fairly and which ones exist.

  1. 64

    Benchmarks and evaluating solvers

    TSPLIB, CVRPLIB, Solomon, Gehring-Homberger, PyVRP/Instances; gap to best-known solution; fair comparison (time limits, seeds, hardware); PyVRP vs. reinterpretcat/vrp

    Read first: Posts 19, 40 · Primer D

    Planned
  2. 65

    Parameter tuning and experimental design

    Automatic tuning (e.g. irace); avoiding overfitting to benchmarks; statistical comparison

    Read first: Post 64 · Primer D

    Planned
  3. 66

    The solver landscape

    Open source: OR-Tools, PyVRP, reinterpretcat/vrp, VROOM, jsprit, Timefold, LKH-3; commercial solvers; how to choose

    Read first: Posts 26, 40

    Planned

Part 12 · 3 entries

The frontier

Part 12 covers where the field is going and what is still unsolved.

  1. 67

    Learning-based methods

    Attention models and POMO; reinforcement learning; learned guidance inside classical solvers; where they stand against HGS and ILS

    Read first: Post 36 · Primer D

    Planned
  2. 68

    LLMs and routing

    LLM-generated heuristics and operators; large routing models; what is hype and what works

    Read first: Post 67

    Planned
  3. 69

    Open problems and lessons from competitions

    DIMACS 12th Implementation Challenge; EURO meets NeurIPS 2022; open research questions

    Read first: Posts 38–39

    Planned