EZRoutePlanner

Route planning basics

How route optimization works (in plain English)

What happens between pressing Optimize and seeing a route: four steps, the shortcuts that make them fast, and the extra rules that make some routing software expensive.

EZRoutePlanner teamUpdated 7 min read

The short answer

Route optimization is finding the order of stops, and for a fleet the split between vehicles, that makes a route as short or as fast as possible. Software does it in four steps: turn each address into coordinates, measure the distance between every pair of stops, search for a short order with fast methods such as nearest neighbour and 2-opt, then follow real roads to draw the route.

Step 1
Geocoding: addresses become coordinates
Step 2
Distance matrix: every stop to every other stop
Step 3
Ordering: smart shortcuts, not checking every order
Step 4
Directions: the chosen order on real roads
On this page

01

What is route optimization?

Route optimization is choosing the best order to visit a set of stops, given where you start and where you need to end. "Best" usually means the shortest distance or the least driving time. For a business with several vehicles it also means deciding which vehicle visits which stops.

It works alongside navigation, not instead of it. Your navigation app finds the best roads from one stop to the next; route optimization decides which stop comes next. The two get confused because both end with a line on a map.

02

What happens when you press Optimize?

Every route optimizer, from a free web tool to an enterprise dispatch system, runs some version of the same four steps.

What each step does
StepWhat it doesWhy it matters
1. GeocodingTurns each address into a latitude and longitudeA wrong pin gets a perfect route to the wrong place
2. Distance matrixMeasures the distance, or time, from every stop to every other stopEvery order is scored with these numbers
3. OrderingSearches for the order with the least total distance or timeThis is where the savings come from
4. DirectionsFollows real roads for the chosen order and measures each legTurns an order into a route you can drive
What each step does

1. Geocoding

Each address is matched against a database of streets and address points and becomes a pair of coordinates. It's the step people forget and the one behind most bad routes: a stop pinned in the wrong town drags the whole order with it. See why addresses land in the wrong place.

2. The distance matrix

Next comes a table of the distance between every pair of stops: 20 stops make a 20 × 20 grid with 380 entries that matter. Some optimizers fill it with road distances or drive times from a routing service. Others use straight-line distance, which is instant and ranks nearby stops much the same way in built-up areas. Road-based tables take longer to build and handle rivers, highways and one-way systems better.

3. Ordering

The hard part: finding a short order without checking every possible one. The next section covers how.

4. Directions

Finally the chosen order goes through a road-routing engine, the same kind your navigation app uses, which returns the line along real roads, the length of each leg and an estimated driving time.

03

How do optimizers find a good order so fast?

They don't try every order; there are far too many. A round trip through 15 places already has over 43 billion. Instead they use heuristics: methods that build a good route quickly and then improve it, trading a guarantee of perfection for an answer in a moment that's usually very close to the best.

  1. 1

    Build a first route

    Nearest neighbour starts at the base and always drives to the closest stop not yet visited. It's quick and sensible but greedy: it tends to leave scattered stops for the end, and the route crosses itself. Insertion methods instead grow a loop by adding each stop where it costs the least.

  2. 2

    Improve it with swaps

    2-opt takes two legs of the route and reverses the stretch between them whenever that makes the trip shorter. That removes crossings, and it repeats until no swap helps. Or-opt moves a short run of one to three stops to a better spot in the route.

  3. 3

    Search further, if there's time

    Heavier methods such as Lin–Kernighan, best known through the LKH program, chain many swaps together. Metaheuristics like simulated annealing, tabu search and genetic algorithms sometimes accept a worse route on purpose to escape a dead end. Exact solvers can prove the best possible route, at a much higher cost in computing time.

Free toolTraveling salesman solverDrop your own points and watch nearest neighbour build a loop, then 2-opt untangle it swap by swap.

04

How much does route optimization save?

It depends on how scrambled the stops were to begin with. Across our 48 example routes of 7–12 stops on real roads in 24 cities, optimizing stops that started in a random order cut the distance by a median 39% and the driving time by a median 36%.

Median distance saved
39%
Median driving time saved
36%
Example routes measured on real roads
48
© Mapbox © OpenStreetMap
In the order listed22 km · 52 min
© Mapbox © OpenStreetMap
Optimized13 km · 31 min−42%
An example route in Ottawa, Ontario: the stops in the order they were listed, then optimized, both driven on real roads.

If you already order your stops carefully by hand, expect less: the optimizer mostly catches the odd crossing or doubled-back leg. The bigger the list and the less familiar the area, the bigger the gain. Put a dollar figure on it with the route cost calculator.

05

What's the difference between TSP and VRP?

The traveling salesman problem (TSP) is one vehicle visiting every stop once by the shortest route. The vehicle routing problem (VRP) brings in a fleet: several vehicles, and a decision about which stops each one gets. Real-world versions add rules on top, and every rule makes the problem harder to solve.

Routing problems from simple to hard
ProblemThe question it answersTypical extra data
TSPIn what order should one vehicle visit these stops?A start, and a round trip or a fixed end
VRPWhich vehicle visits which stops, and in what order?Number of vehicles, a shared depot
Capacitated VRPThe same, without overloading any vehicleWeight, volume or parcel counts
VRP with time windowsThe same, arriving inside each customer's windowAppointment times, opening hours, shifts
Pickup and deliveryThe same, collecting each item before dropping it offPaired stops
Routing problems from simple to hard

That's a big part of why routing software ranges from free to hundreds of dollars a month. One day's stops for one vehicle is quick work for a computer. Twenty vans with time windows and capacities is genuinely hard, and it needs data you have to keep up to date: windows, visit lengths, vehicle sizes.

06

What does EZRoutePlanner's optimizer do, and not do?

EZRoutePlanner solves the single-route problem: one route at a time, in the shortest order it can find. Press Optimize Route and the stops are ordered by nearest neighbour followed by 2-opt improvements, with your start kept fixed and the end either back at the start (Round Trip) or at a stop you've pinned last.

It compares orders using the straight-line distance between stops, which is quick enough to run in your browser as you work, then draws the result on real roads with the distance of every leg. Paid plans add drive times and directions that avoid highways or tolls. Where a river or a highway separates two stops that look close, glance at the order and move a stop by hand if the roads disagree.

What the optimizer handles
HandlesDoesn't handle
Up to 30 stops per route free, 200 on paid plansTime windows or appointment times
A fixed start: your base or any addressLive traffic in the ordering
Round trips, or a pinned last stopSplitting stops between drivers automatically
Several color-coded routes on one map (paid)Vehicle capacity, weights or volumes
Every leg drawn on real roads with its distanceDriver shifts, breaks or scheduling
What the optimizer handles

For several drivers you make the split yourself: lasso each area on the map into its own route, then optimize each one. For a business with a few routes in a known area, that's often quicker than setting up a full VRP. See how to plan routes for multiple drivers.

Questions people ask

Is route optimization the same as GPS navigation?

No. Navigation finds the best roads from where you are to the next stop. Route optimization decides the order of all the stops before you leave. Most people use both: optimize the day, then navigate each leg.

Does route optimization use AI?

Mostly not. Route optimization is classic algorithms, refined over decades. EZRoutePlanner's optimizer is nearest neighbour plus 2-opt; it uses AI only on import, to work out which spreadsheet columns hold the address. Chatbots like ChatGPT are different: they suggest an order without measuring the roads, as planning a route with ChatGPT shows.

Does the optimizer always find the best possible route?

Not with a guarantee. Fast heuristics land very close to the best route for everyday stop counts, but proving the true optimum takes exact solvers and far more computing time than a daily route is worth.

Can I lock some stops in place?

In EZRoutePlanner the start always stays first, and you can pin the final stop so it stays last. Everything between them is reordered. You can still move a stop by hand after optimizing.

Why does my optimized route look odd in one spot?

Usually a geography quirk: two stops that are close as the crow flies but separated by a river, a rail line or a divided highway. Check those pins and, if the roads make a different order quicker, move the stop by hand.

How long does it take to optimize a route?

For a single route of everyday size, about a moment. Fleet-wide problems with time windows can take minutes, because the software is weighing many more rules.

Plan your next route in minutes.

Paste your addresses or drop in a spreadsheet, optimize the order with one click, and send it to your phone. Free to start, no credit card.

Free plan. No credit card. Works in any browser.

How Route Optimization Works (in Plain English)