Vehicle routing problem

Also known as: VRP

On this page 7

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.

ElementMeaningTypical representation
DepotStart and end point of routesNode 0 in the graph
CustomersLocations that must be servedNodes with demand values
Cost matrixTravel cost between any two nodesDistance or time matrix
FleetAvailable vehicles and their limitsCount, capacity, fixed cost
Decision variablesWhich edges each route usesBinary edge variables
Objective functionQuantity to minimizeTotal distance, time or cost
Core elements of a VRP model

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.

VariantAdded constraint or featureTypical application
CVRPVehicle load capacityParcel and grocery delivery
VRPTWCustomer time windowsScheduled home services
PDPPaired pickup and delivery pointsCourier and ride sharing
MDVRPSeveral depotsRegional distribution networks
HFVRPHeterogeneous fleet with different costsMixed vans and trucks
SDVRPSplit deliveries across vehiclesFuel and bulk supply
Dynamic VRPRequests arrive during executionOn-demand delivery
Stochastic VRPUncertain demand or travel timeWaste collection, traffic
Common VRP variants and what they add

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.

ApproachStrengthLimitation
Branch-cut-and-priceProven optimal solutionsSlow beyond a few hundred stops
Savings heuristicVery fast, simple to implementOften several percent above optimum
Local searchCheap, steady improvementGets stuck in local optima
MetaheuristicsNear-optimal at large scaleNeed tuning and time limits
Neural constructionFast inference after trainingWeaker on constrained variants
Comparison of VRP solution approaches

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.

SituationRecommended approachReason
Small instance, strict auditExact solver with time limitOptimality gap can be reported
Daily plan, hundreds of stopsMetaheuristic libraryGood quality within minutes
Real-time dispatchInsertion plus local repairResponds within seconds
Many similar instancesLearned heuristic or warm startTraining cost is amortized
Strong uncertaintyStochastic or robust modelPlans keep slack for variation
Choosing a VRP approach by situation

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.