Built to order

AI-Based Delivery Route Optimization using Genetic Algorithm

This project builds a delivery route optimizer that uses a genetic algorithm to plan multi-vehicle routes under capacity limits and customer time windows. It evolves route plans through selection, crossover and mutation on a Solomon C101-style instance, and reports total distance, vehicles used and time-window violations before and after optimization. A browser demo runs the algorithm on a 24-stop instance. Suitable for B.E./B.Tech final-year projects in Computer Science, IT and AI & Machine Learning.

Chat on WhatsApp — get a quotation

AI & Machine Learning GitJavaScript genetic algorithm engineHTML5 CSS3 SVG map interfacePython 3 offline optimizerSolomon C101 benchmark dataJSON route dataSoftware
AI-Based Delivery Route Optimization using Genetic Algorithm — project thumbnail preview
More project photos (2)

The problem

Delivery route optimization is the problem of assigning customer stops to vehicles and ordering each vehicle's visits so that total travel distance is minimal while every parcel fits its vehicle and every customer is visited inside their promised time window. A courier firm with dozens of daily stops cannot solve it by hand: possible orderings grow factorially, and a route that looks short on a map can still break a time window or overload a vehicle. Naive greedy planning — always driving to the nearest unvisited stop — produces workable routes but leaves distance on the table: extra fuel, extra driving hours and missed delivery slots. AI-Based Delivery Route Optimization using Genetic Algorithm tackles this with an evolutionary search: a population of route plans is scored on distance plus penalties for broken constraints, and the best plans are bred over generations until the routes stop improving. The result is a shorter, feasible delivery plan that a dispatcher can run.

SYSTEM FLOW

5 components 4 connections

Live flow
Drag to explore
100%
storageDelivery Instance

24 stops with parcel demands and time windows around a central depot.

Follow the working sequence

How it works

The optimizer works in two separate phases: a planning phase that runs the genetic algorithm, and an execution phase that follows the finished route plan. In the planning phase the system loads the delivery instance — 24 stops with parcel demands and time windows around a central depot — and builds a first route plan with a nearest-neighbour heuristic. That baseline becomes one member of the genetic algorithm's starting population; the other 79 members are random shuffles of the same stops. Over 150 generations the algorithm scores each candidate on total distance plus heavy penalties for capacity overloads and late arrivals, keeps the best plans, and breeds new ones by combining two parents' stop orders and swapping stops at random. When the best distance stops improving, the winning plan is split into per-vehicle routes and drawn on the map with its distance, vehicle count and violation count. Nothing is learned or updated after this point: drivers execute the fixed plan.

  1. The delivery instance is loaded: 24 stops in three clusters, each with a parcel demand of 1–4 parcels and a delivery time window between 08:00 and 18:00, plus one central depot.
  2. A nearest-neighbour heuristic builds the baseline plan by always driving to the closest unvisited stop, giving a 320.4 km reference route set to beat.
  3. The genetic algorithm seeds its population of 80 candidate plans with the baseline plus 79 random orderings of the same 24 stops.
  4. Each candidate is decoded into vehicle routes by cutting the stop order whenever the 12-parcel capacity or a time window would be broken, and scored on total distance plus a 1000-unit penalty per violation.
  5. Tournament selection picks parents, order crossover combines two parents' stop orders, and swap mutation exchanges two stops, producing the next generation while the best two plans survive unchanged.
  6. After 150 generations the best plan is kept: 306.8 km over 7 vehicles with 0 time-window violations, converged at generation 146.
  7. The winning plan is displayed as colour-coded routes on the map with a per-vehicle table, a convergence chart and the before/after comparison.

Tech stack:

  • JavaScript · genetic algorithm engine

  • HTML5 · CSS3 · SVG map interface

  • Python 3 · offline optimizer

  • Solomon C101 benchmark data

  • JSON route data

  • Git

  • Dataset: Solomon VRPTW benchmark, instance C101 (Solomon, 1987) — 100 customers plus 1 depot, clustered geography on a 500×500 coordinate space, demand 10–40 units per customer, vehicle capacity 200 units, service time 90 time units, short time windows. Best-known solution: 10 vehicles, 828.94 distance units (published benchmark value, SINTEF). The browser demo runs a clearly-labeled synthetic 24-stop C101-style instance generated from fixed seed 3199, not the C101 file itself.

  • Task: Vehicle routing with time windows (VRPTW) — assign stops to vehicles and order each vehicle's visits to minimize total travel distance subject to vehicle capacity and customer time windows.

  • Model: Genetic algorithm (metaheuristic optimizer, not a learned model) — order-based chromosome (a permutation of stops), tournament selection (k=3), order crossover OX (rate 0.85), swap mutation (rate 0.08), elitism (best 2 survive), population 80, 150 generations. There is no training phase and no learned weights; the algorithm searches at planning time and does not change after deployment.

  • Metrics: Total route distance (km), number of vehicles used, and time-window violations — all reported before and after optimization. Demo-measured on the 24-stop instance: baseline 320.4 km, optimized 306.8 km, 13.6 km saved (4.2%), 7 vehicles, 0 violations, convergence at generation 146 of 150. No accuracy percentage applies to an optimizer, so none is claimed.

Parameter Value
Demo instance size 24 stops + 1 depot (synthetic, fixed seed 3199)
Benchmark instance size 100 customers + 1 depot (Solomon C101)
Vehicle capacity 12 parcels (demo) · 200 units (C101)
Service time per stop 5 min (demo) · 90 time units (C101)
Vehicle speed 30 km/h (demo, design target)
Delivery window 08:00–18:00 (demo instance)
Population size 80 chromosomes (design target)
Generations 150 (design target)
Crossover rate 0.85, order crossover (design target)
Mutation rate 0.08, swap mutation (design target)
Baseline distance 320.4 km (demo-measured, nearest neighbour)
Optimized distance 306.8 km (demo-measured, genetic algorithm)
Distance saved 13.6 km, 4.2% (demo-measured)
Vehicles used 7 (demo-measured)
Time-window violations 0 (demo-measured)
Convergence Generation 146 of 150 (demo-measured)
Best-known C101 result 828.94 distance units with 10 vehicles (published benchmark value)
Demo runtime Approximately 1–2 s in the browser for the 24-stop instance (expected)

Project features

The strongest parts of this project are the optimizer itself, the honesty of its feasibility checks, and the way every claim can be verified in the demo. The genetic algorithm is a real working implementation — tournament selection, order crossover, swap mutation and elitism over 150 generations — not a diagram of one. Every candidate route is checked against the 12-parcel vehicle capacity and each customer's time window before it is scored, so a short route that breaks a promise is penalized, not celebrated. A nearest-neighbour baseline runs first, so the improvement is measured against a real alternative instead of asserted: on the demo's 24-stop instance the baseline covers 320.4 km and the optimized plan covers 306.8 km. Finally, the convergence chart and per-vehicle table expose the whole run, generation by generation.

  • [Genetic algorithm optimizer — Implemented] A real order-based genetic algorithm runs in the browser: tournament selection (k=3), order crossover (rate 0.85), swap mutation (rate 0.08) and elitism over a population of 80 for 150 generations.
  • [Capacity and time-window feasibility — Implemented] Every candidate plan is decoded into vehicle routes that respect the 12-parcel capacity and each stop's delivery window; late arrivals and overloads add a heavy penalty to the plan's score and are counted in the results.
  • [Baseline vs optimized comparison — Implemented] A nearest-neighbour heuristic builds the baseline first, so the genetic algorithm's improvement is measured against a real alternative: 320.4 km baseline vs 306.8 km optimized on the demo instance.
  • [Convergence chart — Implemented] A live chart plots the best total distance at each of the 150 generations, with milestones showing that most improvement lands in the first 25 generations.
  • [Per-vehicle route table — Implemented] Each vehicle's route is listed with its stop count, distance, parcel load and time-window status, so the plan can be checked vehicle by vehicle.
  • [Solomon C101-style benchmark instance — Implemented] The demo generates a clustered 24-stop instance modeled on Solomon's C101 benchmark (clustered geography, capacity limits, time windows) from a fixed seed, so every run is reproducible.
  • [Route plan export (CSV/JSON) — Optional customization] The optimized routes can be exported as CSV or JSON for use in a dispatch sheet or a further analysis notebook.
  • [Live-traffic and real-map routing — Future scope] Real road distances, live traffic and GPS-based re-planning are not part of the base build and would need a maps API and a different distance model.

What is included

  • Complete genetic algorithm source code (JavaScript browser demo + Python 3 offline optimizer)
  • Solomon C101 benchmark loader and the demo's synthetic instance generator (seed 3199)
  • Working browser demo with map, convergence chart and per-vehicle route table
  • Demo run data: baseline vs optimized distances, generation milestones, route table
  • Project report PDF (background, VRPTW theory, GA design, methodology, measured results)
  • PPT presentation for final review
  • Viva Q&A preparation document (genetic operators, VRPTW constraints, baseline comparison, convergence)

Limitations & prerequisites

  • The genetic algorithm is a heuristic: it improves routes but does not guarantee the optimal solution, and the 4.2% saving measured on the demo instance will vary with the instance.
  • The demo instance is synthetic — 24 stops with straight-line (Euclidean) distances where 1 map unit equals 1 km — not real road distances or live traffic.
  • No real map or GPS data is included in the base build; routes are drawn on a schematic map, not a street network.
  • Time windows are modeled in minutes from 08:00 with a fixed 30 km/h speed, so real traffic variation and variable service times are not modeled.
  • The optimizer runs once per planning session: it does not re-plan live during deliveries and does not learn from completed deliveries.
  • Scaling to the full 100-customer C101 instance increases runtime; the browser demo is sized at 24 stops so it runs in about 1–2 seconds.

Frequently Asked Questions

Which benchmark dataset is used?

Solomon's C101 vehicle-routing-with-time-windows instance from 1987: 100 customers plus a depot, clustered geography, vehicle capacity 200 units and service time 90 units, with a published best-known solution of 10 vehicles and 828.94 distance units, reported by SINTEF's VRPTW benchmark tables. The browser demo runs a smaller synthetic 24-stop instance modeled on C101 so it finishes in about 1–2 seconds, and the full C101 file is included for the offline Python optimizer.

How does the genetic algorithm actually work here?

Each candidate solution is an ordering of the delivery stops, decoded into vehicle routes that respect capacity and time windows, and scored on total distance plus a heavy penalty per violation. A population of 80 such orderings evolves over 150 generations through tournament selection, order crossover and swap mutation, with the best two plans surviving unchanged each generation. Decoding cuts the stop order into a new route whenever the next stop would overload the vehicle or miss its window, so every candidate the algorithm scores is a complete plan.

How much distance does it save — is that guaranteed?

On the demo's fixed 24-stop instance the genetic algorithm cut total distance from a 320.4 km nearest-neighbour baseline to 306.8 km, a measured saving of 13.6 km (4.2%) with 0 time-window violations, and the best distance stopped improving materially at generation 146 of 150. That figure is a measured result on one instance, not a guarantee: savings depend on the stop layout, time windows and fleet size. The algorithm is a heuristic, so it improves routes without proving optimality.

Does the system learn from deliveries after deployment?

No. The genetic algorithm is an optimizer, not a learning model: it searches for a good route plan at planning time, and once the plan is fixed it does not change, so completed deliveries never update anything because there are no learned weights to update. Re-planning means running the optimizer again on fresh data.

Can it handle my city's real map and traffic?

Not in the base build. The demo uses straight-line distances on a schematic map with a fixed 30 km/h speed and no traffic, which keeps the optimization transparent and reproducible, and real road distances would need a maps API and a different distance matrix. Live traffic and GPS re-planning would need a re-planning loop as well, and both are listed as future scope in the report, with the extra work and data each one needs.

Is this project suitable for a final-year project?

Yes — for Computer Science, IT and AI & Machine Learning programs. It demonstrates a real metaheuristic optimizer on a standard benchmark, honest feasibility handling with capacity and time windows, and a measured before/after comparison that gives the viva concrete numbers to discuss. The report also documents the benchmark, the operators and the convergence behaviour, so every design choice can be defended.

Components & software requirements
  • JavaScript · genetic algorithm engine
  • HTML5 · CSS3 · SVG map interface
  • Python 3 · offline optimizer
  • Solomon C101 benchmark data
  • JSON route data
  • Git
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Related guides

All guides
Get a quotation