Skip to main content

Vehicle Routing Problem

CAPACITATED VRP · CANONICAL FORMULATION

Logistics · Transportation · Operational

Given a central depot, a fleet of vehicles each with finite capacity, and a set of customers with known demands and coordinates, the Capacitated Vehicle Routing Problem asks: which subset of routes starting and ending at the depot serves every customer exactly once, respects every vehicle's capacity, and minimises total travel distance? Introduced by Dantzig & Ramser (1959) under the title “The Truck Dispatching Problem,” CVRP is a strict generalisation of the travelling-salesman problem and is one of the most studied problems in operations research. This page presents the canonical two-index MILP formulation, an interactive Clarke & Wright (1964) savings solver on a Euclidean instance, and cross-links to applied instances across logistics, agriculture, healthcare, and construction.

Why CVRP matters

Three facts that anchor the problem

NP-hard
CVRP generalises both the TSP (set capacity to infinity and fleet size to one) and bin packing; no polynomial-time algorithm is known or expected.
Lenstra & Rinnooy Kan (1981) · doi:10.1002/net.3230110211
~10%
routing-cost savings are typical for fleets moving from manual route design to OR-based CVRP solvers — compounding on a sector responsible for a substantial share of global logistics spend.
Toth & Vigo (2014) Ch. 1 · doi:10.1137/1.9781611973594
60+ years
of continuous research since Dantzig & Ramser (1959), with dozens of variants (VRPTW, PDP, DARP, multi-depot, electric, stochastic) and a rich algorithmic toolkit from branch-cut-price to GNN heuristics.
Braekers, Ramaekers & Van Nieuwenhuyse (2016) · doi:10.1016/j.cie.2015.12.007

Problem definition

Inputs · decision · objective · constraints

Let $G = (V, E)$ be a complete graph on $n + 1$ nodes. Node $0$ is the depot; nodes $1, \ldots, n$ are customers. Each customer $i$ has a non-negative demand $q_i$, and each edge $(i,j)$ has a non-negative travel cost $c_{ij}$ (in symmetric CVRP, $c_{ij} = c_{ji}$). A homogeneous fleet of $K$ vehicles, each with capacity $Q$, operates from the depot. The decision is a set of routes (closed walks starting and ending at the depot) such that:

every customer is visited exactly once, the total demand on each route does not exceed $Q$, and the number of routes does not exceed $K$. The objective is to minimise the total travel cost over all routes. The problem is NP-hard in the strong sense — it contains the Hamiltonian tour problem as a special case.

Mathematical formulation

Two-index MILP · after Toth & Vigo (2014), Ch. 1

Notation

SymbolMeaning
$V = \{0,1,\ldots,n\}$node set — $0$ is the depot, $V' = V \setminus \{0\}$ the customers
$c_{ij}$travel cost on edge $(i,j)$, $i \ne j$
$q_i$demand of customer $i \in V'$
$Q$capacity of every vehicle (homogeneous fleet)
$K$number of vehicles available
$x_{ij} \in \{0,1\}$1 if edge $(i,j)$ is used by some vehicle, 0 otherwise
$u_i$auxiliary MTZ variable — cumulative load on entry to customer $i$

Objective

Minimise total travel cost
$$\min \; \sum_{i \in V} \sum_{j \in V,\, j \ne i} c_{ij} \, x_{ij}$$

Constraints

(1) Visit each customer exactly once — degree in/out
$$\sum_{j \in V,\, j \ne i} x_{ij} = 1 \quad \forall i \in V'$$ $$\sum_{i \in V,\, i \ne j} x_{ij} = 1 \quad \forall j \in V'$$
(2) Vehicle dispatch at depot — at most $K$ routes
$$\sum_{j \in V'} x_{0j} \le K, \qquad \sum_{i \in V'} x_{i0} \le K$$
(3) Capacity + subtour elimination (MTZ-style, Kara et al. 2004)
$$u_j \ge u_i + q_j - Q(1 - x_{ij}) \quad \forall i \in V',\, j \in V',\, i \ne j$$ $$q_i \le u_i \le Q \quad \forall i \in V'$$
(4) Binary domain
$$x_{ij} \in \{0,1\} \quad \forall (i,j),\, i \ne j$$

Alternative formulations. The original Dantzig-Fulkerson-Johnson (DFJ) subtour elimination cuts $\sum_{i \in S}\sum_{j \notin S} x_{ij} \ge \lceil \sum_{i \in S} q_i / Q \rceil$ for every non-empty $S \subset V'$ yields a stronger LP relaxation but exponentially many constraints — handled via branch-and-cut. A three-index formulation with an explicit vehicle index $k$ is easier to read but weaker in the LP. The set-partitioning formulation, solved by branch-cut-price (Fukasawa et al. 2006; Pessoa et al. 2020), is the state-of-the-art exact method.

Real-world to OR mapping

How the abstract formulation maps to applied instances

Real-world conceptOR symbol / role
Central warehouse or depotnode $0$
Customer / delivery stopnode $i \in V' = \{1,\ldots,n\}$
Parcel volume / mass demanded$q_i$
Van / truck payload capacity$Q$
Fleet size$K$
Road-network travel distance or time$c_{ij}$
“Van $k$ drives from stop $i$ to stop $j$”$x_{ij} = 1$ (some vehicle)

Interactive solver

Clarke-Wright savings on a Euclidean random instance

The Clarke & Wright (1964) savings algorithm is the most enduring constructive heuristic for CVRP. It starts with one route per customer (depot $\to i \to$ depot), then repeatedly merges the pair of routes producing the largest savings $s_{ij} = c_{0i} + c_{0j} - c_{ij}$, provided the merge remains capacity-feasible. The algorithm runs in $O(n^2 \log n)$ and is typically within 5–10% of the best-known solution on small-to-medium benchmarks. Use the controls below to generate random instances and watch Clarke-Wright build a routing.

Customers
10
Vehicle capacity
60
Random seed
7
Customers
Total demand
Routes
Total distance
Runtime

Standard benchmarks

Where the literature lives · where you can test your own algorithms

Three canonical benchmark libraries are used across CVRP research:

  • CVRPLIB (Uchoa et al. 2017) — the de-facto standard; 100 X-class instances with 100–1000 customers, plus legacy classes A, B, E, F, M, P. Best-known solutions continually updated. vrp.atd-lab.inf.puc-rio.br
  • Augerat (1995) — small classical instances A/B/P (30–80 customers) used as algorithm-debugging baselines. Included in CVRPLIB.
  • Christofides, Mingozzi, Toth (1979) — the 14 original CMT instances (50–200 customers). Now superseded by CVRPLIB but still cited.

All instances use the TSPLIB .vrp file format: coordinates, demands, capacity, and an optional depot specification. Exact solvers (branch-cut-price, e.g., VRPSolverEasy) routinely solve instances up to ~300 customers; metaheuristics (HGS, LKH-3) handle 1000+ customers within a few percent of optimal.

Key references

DOIs & permanent URLs

Dantzig, G. B., & Ramser, J. H. (1959).
“The truck dispatching problem.”
Management Science, 6(1), 80–91. doi:10.1287/mnsc.6.1.80
Clarke, G., & Wright, J. W. (1964).
“Scheduling of vehicles from a central depot to a number of delivery points.”
Operations Research, 12(4), 568–581. doi:10.1287/opre.12.4.568
Toth, P., & Vigo, D. (Eds.) (2014).
Vehicle Routing: Problems, Methods, and Applications (2nd ed.).
SIAM / MOS-SIAM Series on Optimization. doi:10.1137/1.9781611973594
Uchoa, E., Pecin, D., Pessoa, A., Poggi, M., Vidal, T., & Subramanian, A. (2017).
“New benchmark instances for the Capacitated Vehicle Routing Problem.”
European Journal of Operational Research, 257(3), 845–858. doi:10.1016/j.ejor.2016.08.012
Lenstra, J. K., & Rinnooy Kan, A. H. G. (1981).
“Complexity of vehicle routing and scheduling problems.”
Networks, 11(2), 221–227. doi:10.1002/net.3230110211
Kara, I., Laporte, G., & Bektaş, T. (2004).
“A note on the lifted Miller-Tucker-Zemlin subtour elimination constraints for the capacitated vehicle routing problem.”
European Journal of Operational Research, 158(3), 793–795. doi:10.1016/S0377-2217(03)00377-1
Fukasawa, R., Longo, H., Lysgaard, J., Aragão, M. P. de, Reis, M., Uchoa, E., & Werneck, R. F. (2006).
“Robust branch-and-cut-and-price for the capacitated vehicle routing problem.”
Mathematical Programming, 106(3), 491–511. doi:10.1007/s10107-005-0644-x
Pessoa, A., Sadykov, R., Uchoa, E., & Vanderbeck, F. (2020).
“A generic exact solver for vehicle routing and related problems.”
Mathematical Programming, 183, 483–523. doi:10.1007/s10107-020-01523-z
Vidal, T., Crainic, T. G., Gendreau, M., & Prins, C. (2014).
“A unified solution framework for multi-attribute vehicle routing problems.”
European Journal of Operational Research, 234(3), 658–673. doi:10.1016/j.ejor.2013.09.045
Braekers, K., Ramaekers, K., & Van Nieuwenhuyse, I. (2016).
“The vehicle routing problem: State of the art classification and review.”
Computers & Industrial Engineering, 99, 300–313. doi:10.1016/j.cie.2015.12.007
CVRPLIB.
Capacitated Vehicle Routing Problem Library.
Maintained by the Department of Production Engineering, PUC-Rio. vrp.atd-lab.inf.puc-rio.br

Routing a real fleet?
Let's talk about moving from heuristics to exact solvers.

Get in Touch
Data and numerical examples are illustrative. Pages on this site are educational tools, not production software.