Skip to content

CoreyPickett/Capacitated-Vehicle-Routing-Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ป Capacitated Vehicle Routing Problem (CVRP)

A group optimisation project implementing a Simulated Annealing metaheuristic to solve the Capacitated Vehicle Routing Problem (CVRP). The project explores neighbourhood operator design, stochastic search behaviour, and performance evaluation using TSPLIB benchmark instances. Completed as part of the thirdโ€‘year university statistics course "Deterministic & Stochastic Optimisation".

๐Ÿ’ป Technologies

  • SageMath
  • TSPLIB Benchmark datasets
  • Jupyter Notebook

๐Ÿš€ Features

  • Implementation of Simulated Annealing for CVRP
  • Neighbourhood Operators (N1, N2, N1N2)
  • Custom parser for .vrp files
  • Precomputed Euclidean distance matrix for faster evaluation
  • Benchmarking across all instances used (eil22, eil23, eil30, eil33)

๐Ÿ“‹ The Process

The CVRP is a classic NPโ€‘Hard optimisation problem where the goal is to construct minimumโ€‘cost routes that start and end at a depot, visit each customer exactly once, and respect vehicle capacity constraints. Our project implemented a singleโ€‘agent stochastic metaheuristic to approximate highโ€‘quality solutions.

We designed two neighbourhood operators:

  • N1: swaps two customers within the same route
  • N2: swaps customers between different routes A combined variant was also created, N1N2, selecting between the two with equal probability

Simulated Annealing was chosen due to its ability to escape local minima through controlled randomisation. Each method was run for 5000 iterations, with a cooling rate of 0.995, and evaluated over 100 independent runs.

The final report analyses solution quality, operator behaviour, and the tradeโ€‘off between exploration and exploitation in stochastic optimisation.

๐Ÿง  What I learned

  • How to implement a stochastic metaheuristic from scratch
  • Design of neighbourhood operators and understanding their impact on search behaviour
  • Parsing and structuring TSPLIB CVRP data
  • Balancing feasibility constraints with optimisation moves
  • Visualising multi-route solutions clearly
  • Evaluating stochastic algorithms through repeated runs and performance summaries

๐Ÿ™‹ My Contribution

This project was completed as a team of three with my specific contributions including:

  • Implementing components of the Simulated Annealing algorithm
  • Debugging neighbourhood operators
  • Designing the final report structure
  • Writing the Introduction, Objectives, and Algorithm & Implementation sections of the final report

๐Ÿ“Š Key Results

  • All three methods significantly improved route cost compared to the initial greedy solution
  • N1 provided stable, incremental improvements
  • N2 enabled broader exploration but was more disruptive and inconsistent
  • N1N2 consistently produced the best overall performance across all instances
  • Simulated Annealing scaled effectively across all instances

๐Ÿ“ˆ Future Improvements

  • Implement more advanced operators such as cros-exchange
  • Tune parameters of SImulated Annealing
  • Compare against other metahueristics (Tabu Search, Genetic Algorithm)
  • Evaluate Average ratehr than best performance
  • Extend to larger datasets

About

A group optimisation project implementing a Simulated Annealing metaheuristic to solve the Capacitated Vehicle Routing Problem (CVRP).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors