Home / Science / Maths, statistics and computing / Operations research / Vehicle routing for small instancesTool #586

Vehicle routing problem solver (CVRP): Clarke-Wright savings, 2-opt, or-opt and exact routes for up to 12 customers

Plan delivery routes from one depot: give the customers as map coordinates or a distance table, their demands, the vehicle capacity and the number of vehicles. Clarke-Wright savings with 2-opt and or-opt improvement, the exact shortest plan for up to 12 customers, a route map and a stop-by-stop table. Checked against brute force and an integer program.

Keep it one tap away for everyday use.

Bookmark Vehicle routing for small instances?

Press Ctrl + D now. Your browser opens its own bookmark box, where you choose the name and folder.

  1. Places
  2. Capacity
  3. Routes
  4. Stops
Nothing is uploadedWorks offline once open

Depot and customers

x and y in any one unit (km on a map grid, for example); distances are straight lines. Up to 200 customers.

Vehicles: 0 or blank means as many as needed. Every vehicle starts and ends at the depot.

What it does

The vehicle routing problem asks how a few vehicles, each starting and ending at one depot, should visit every customer so the total distance is as short as possible, without any vehicle carrying more than its capacity. It is the everyday problem of a delivery round, a school bus run or a service engineer’s week, and a standard topic in operations research courses.

This tool solves small instances in your browser:

  • Clarke-Wright savings: start with one vehicle per customer, then join routes in order of the distance saved, d(depot, i) + d(depot, j) − d(i, j), while the load still fits.
  • 2-opt: reverse a stretch of a route when that makes it shorter (it removes crossings).
  • Or-opt: move one to three neighbouring stops to a better place, in the same route or another vehicle with room.
  • Exact order: every route of up to 12 stops is put in its shortest possible order by Held-Karp dynamic programming.
  • Exact plan: with 12 customers or fewer, it also finds the shortest possible plan of all, within the number of vehicles you allow, and tells you how far the heuristic was from it.

How to use it

  1. Choose Coordinates and give one place per line: name, x, y, demand. The first line is the depot. Or choose Distance table and paste a square table of road distances or travel times (the first row and column are the depot), then the customers’ demands.
  2. Set the vehicle capacity (in the same unit as the demands: crates, kg, passengers) and the vehicles available (0 for as many as needed).
  3. Read the routes on the map and in the table: each route’s stops in order, its load and its length. Download the stop-by-stop list as CSV, or the map and table as an image, PDF or Word file.

Worked example

The example has a depot in the middle of a 100 × 100 km grid and 10 shops wanting 37 crates in all. With vans of capacity 15 and 3 vans, the shortest possible plan is 3 routes, total distance 404.1 km: Depot → Shop 8 → Shop 9 → Shop 1 → Shop 2 → Depot (14 crates, 161.1 km), Depot → Shop 10 → Shop 3 → Shop 4 → Depot (10 crates, 101.9 km) and Depot → Shop 7 → Shop 6 → Shop 5 → Depot (13 crates, 141.1 km). Here the savings method already finds this optimum. Set the vans to 2 and the tool explains that 37 crates cannot fit in two vans of 15.

Limits

  • Up to 200 customers. The exact plan is for 12 customers or fewer; above that the answer is a good plan, not a proven best one, and if it needs more vehicles than you have, the tool says so.
  • One depot, one vehicle type, and a customer’s demand is never split between vehicles. Time windows, driving-hour limits and pick-ups are not modelled.
  • With coordinates, distances are straight lines. For real roads, paste a distance table.

Frequently asked questions

Why are the map positions odd for a distance table? Without coordinates, the picture is drawn from the distances (multidimensional scaling), so it is approximate. The route lengths in the table are exact.

What if my distance table is not symmetric? Each pair uses the average of its two directions, and the page says so.

Is my data stored? No. Everything runs in your browser and nothing is stored or sent anywhere.

Where the numbers come from

  • Standard methods, written by fibub: Clarke and Wright's savings algorithm (1964), 2-opt and or-opt local search, Held-Karp dynamic programming for the shortest tour, subset dynamic programming for the exact capacitated plan, classical multidimensional scaling for the picture.
  • Checked against brute force over every stop order, and against an integer program solved with scipy.optimize.milp (HiGHS, BSD licence) on 41 instances including the example: exact totals equal.
  • The depot, shops and crate numbers in the example are made up for this tool.

Standard scientific values, such as constants, atomic weights and melting points, are facts found in every textbook; we name where ours were checked. If you are an author or publisher and want a value, a credit or a table changed or removed, tell us and we will act quickly.

Last updated 2026-11-09.

Related tools

Graph editor with algorithms #556 Draw a graph or paste an edge list (weighted, directed or not) and run Dijkstra, Bellman-Ford, breadth- and depth-first search, Kruskal and Prim spanning trees, maximum flow with the minimum cut, greedy and DSatur colouring, degree, betweenness and closeness centrality, or a topological order. Results are highlighted on the drawing. Checked against networkx. Linear and integer programming solver #582 Type a linear or integer program as plain text (maximize or minimize, constraints, bounds, whole-number and yes/no variables) and get the optimal solution, shadow prices, reduced costs, the simplex tableaux step by step, and a picture for two variables. Runs in your browser. Transportation and assignment problem solver #583 Solve a transportation problem from a starting plan (northwest corner, least cost or Vogel's approximation) to the optimum with the MODI method, showing every step, the u and v potentials and dummy rows for unbalanced problems. Or solve an assignment problem with the Hungarian method, minimising cost or maximising profit. Checked against scipy. Queueing calculator #584 Average waits, queue lengths, utilisation and the chance of waiting for the standard queue models, how many servers or agents you need for a target wait, and a discrete-event simulation that checks the formulas. Runs in your browser. Project scheduling: CPM, PERT and Gantt #585 List your tasks, durations and predecessors (finish-to-start, start-to-start, finish-to-finish, with lags) and get the critical path, earliest and latest dates, float, a Gantt chart, and with three-point estimates the PERT chance of finishing by a date, checked by simulation. Runs in your browser. 1D Schrödinger solver #923 Choose a textbook potential, type a formula or draw your own, and get the lowest energy levels and wavefunctions of the one-dimensional Schrödinger equation by the matrix (finite-difference) method, with the exact levels alongside for the box, harmonic oscillator, finite well, Morse, linear and Pöschl–Teller potentials.