The vehicle routing problem (VRP) is a combinatorial optimization problem that asks how a fleet of vehicles, starting from one or more depots, should serve a set of customers so that total routing cost is minimized while every operational constraint is respected. Within optimization for artificial intelligence, the VRP is a central benchmark for exact solvers, metaheuristics and learned heuristics, because it combines assignment decisions (which vehicle serves which customer) with sequencing decisions (in what order).
The problem was introduced in 1959 by George Dantzig and John Ramser as the truck dispatching problem. It generalizes the traveling salesman problem: with one uncapacitated vehicle, a VRP reduces to a TSP. As a result, the VRP is NP-hard, and practical instances with hundreds or thousands of stops are solved with heuristics that trade proven optimality for speed.
How the vehicle routing problem is formulated
A VRP is usually defined on a complete graph whose nodes are the depot and the customers and whose edges carry a travel cost, such as distance, time or money. Each customer has a demand, each vehicle has a capacity, and a solution is a set of routes that start and end at the depot and visit every customer exactly once.
The classical capacitated VRP (CVRP) is commonly written as an integer program with binary variables that indicate whether a vehicle travels along an edge. Degree constraints ensure that each customer is entered and left once, and capacity or subtour elimination constraints prevent routes that exceed vehicle capacity or form cycles detached from the depot. The table below lists the main building blocks of a formulation.
| Element | Meaning | Typical representation |
|---|---|---|
| Depot | Start and end point of routes | Node 0 in the graph |
| Customers | Locations that must be served | Nodes with demand values |
| Cost matrix | Travel cost between any two nodes | Distance or time matrix |
| Fleet | Available vehicles and their limits | Count, capacity, fixed cost |
| Decision variables | Which edges each route uses | Binary edge variables |
| Objective function | Quantity to minimize | Total distance, time or cost |
The objective is most often total travel distance, but operators also minimize the number of vehicles, total duration, overtime or a weighted mix. When several goals conflict, the task becomes a multi-objective optimization problem with a Pareto front of compromise plans.
Main variants of the VRP
The VRP is a family of problems rather than a single one, because real operations add constraints that change both the model and the best solution method. The variants below appear most often in research benchmarks and in commercial routing software.
| Variant | Added constraint or feature | Typical application |
|---|---|---|
| CVRP | Vehicle load capacity | Parcel and grocery delivery |
| VRPTW | Customer time windows | Scheduled home services |
| PDP | Paired pickup and delivery points | Courier and ride sharing |
| MDVRP | Several depots | Regional distribution networks |
| HFVRP | Heterogeneous fleet with different costs | Mixed vans and trucks |
| SDVRP | Split deliveries across vehicles | Fuel and bulk supply |
| Dynamic VRP | Requests arrive during execution | On-demand delivery |
| Stochastic VRP | Uncertain demand or travel time | Waste collection, traffic |
Time windows are the most consequential addition in practice. The vehicle routing problem with time windows (VRPTW) requires each visit to start within an interval, so a route that is short in distance may still be infeasible because it arrives too late. The Solomon benchmark instances from 1987 remain a standard test set for this variant.
Solution methods: exact, heuristic and learned
VRP solution methods fall into three groups that differ in guaranteed quality, speed and scalability. Exact methods prove optimality, heuristics find good solutions quickly, and learned methods use neural networks to imitate or guide heuristic decisions.
Exact approaches rely on branch and bound, branch and cut and especially branch-cut-and-price, which combines column generation over feasible routes with cutting planes. These methods solve many CVRP instances with a few hundred customers to proven optimality, although run time grows sharply with size and constraint complexity.
Heuristics dominate industrial use. Construction heuristics such as the Clarke and Wright savings algorithm build an initial plan in seconds. Local search operators such as 2-opt, relocate, exchange and cross then improve it, and metaheuristics such as tabu search, simulated annealing, adaptive large neighborhood search and hybrid genetic search escape local optima. Well-tuned metaheuristics routinely reach solutions within about 1% of the best known values on standard benchmarks.
| Approach | Strength | Limitation |
|---|---|---|
| Branch-cut-and-price | Proven optimal solutions | Slow beyond a few hundred stops |
| Savings heuristic | Very fast, simple to implement | Often several percent above optimum |
| Local search | Cheap, steady improvement | Gets stuck in local optima |
| Metaheuristics | Near-optimal at large scale | Need tuning and time limits |
| Neural construction | Fast inference after training | Weaker on constrained variants |
Machine learning research treats the VRP as a testbed for neural combinatorial optimization. Attention-based encoder-decoder models trained with reinforcement learning construct routes one stop at a time, and newer hybrids use learned models to select neighborhoods inside a classical search. These methods are competitive on small, uniform instances, but state-of-the-art metaheuristics still lead on large, heavily constrained real-world problems.
Applying VRP solvers in practice
Successful deployment depends more on accurate input data than on algorithm choice. Road network travel times, realistic service durations, correct capacities and true customer time windows determine whether a mathematically optimal plan works on the street.
Practitioners typically use an established solver library, such as Google OR-Tools, LKH-3 or VROOM, rather than writing a solver from scratch. The decision table below summarizes how planning situations map to sensible choices.
| Situation | Recommended approach | Reason |
|---|---|---|
| Small instance, strict audit | Exact solver with time limit | Optimality gap can be reported |
| Daily plan, hundreds of stops | Metaheuristic library | Good quality within minutes |
| Real-time dispatch | Insertion plus local repair | Responds within seconds |
| Many similar instances | Learned heuristic or warm start | Training cost is amortized |
| Strong uncertainty | Stochastic or robust model | Plans keep slack for variation |
Limitations and common mistakes
The VRP is a simplified model of reality, and most failures come from the gap between the model and operations rather than from the solver. Typical mistakes include the following.
- Using straight-line distances instead of road network times, which produces infeasible schedules.
- Ignoring driver breaks and legal working hours, which invalidates otherwise efficient routes.
- Treating soft preferences as hard constraints, which leaves no feasible solution.
- Comparing heuristics on a single benchmark instance, which hides high variance between runs.
- Reoptimizing too often in dynamic settings, which causes plan nervousness for drivers and customers.
Another misconception is that a reported solution is optimal. Unless the solver returns a lower bound and an optimality gap, a heuristic plan is only the best plan found within the time limit.
In plain words
Imagine a bakery with three vans and forty shops to supply each morning. The vehicle routing problem asks a simple question. Which van should go to which shop, and in what order? The goal is to drive as few kilometers as possible.
There are rules. Each van can carry only so much bread. Some shops open late. Drivers must be back by noon. With many shops, the number of possible plans becomes enormous. Computers therefore use clever shortcuts that find a very good plan quickly, even if nobody can prove it is the perfect one.
A real-world example
A regional grocery distributor serves about 350 stores from two warehouses with a fleet of 28 refrigerated trucks of two sizes. Each store has a two-hour delivery window, each truck has a pallet limit, and drivers may work at most ten hours, including a mandatory break. The planning team models this as a multi-depot VRP with time windows and a heterogeneous fleet.
Every evening, the system loads next-day orders and a road network travel time matrix, builds an initial plan with a savings heuristic and improves it for ten minutes with an adaptive large neighborhood search. Compared with the previous manually adjusted fixed routes, the optimized plans use two fewer trucks on average and reduce daily driving distance by roughly 10 to 15 percent, while late deliveries fall because time windows are modeled explicitly rather than estimated by dispatchers.