Skip to content

Commit eb3b8c5

Browse files
authored
Update README.md
1 parent 4d318a0 commit eb3b8c5

File tree

1 file changed

+65
-12
lines changed

1 file changed

+65
-12
lines changed

README.md

Lines changed: 65 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# Vehicle Routing Problem with Time Windows (VRPTW) Solver Comparison
22

3+
---
4+
35
## The Comparison results of different NP metahuristic algorithms for VRPTW
46

57
Running Algorithms on dataset: rc108.txt
68

7-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
9+
---
810

911
Best-Known Solution (BKS) Route Cost: 1114.2
1012

@@ -32,7 +34,7 @@ Route #10: 90
3234

3335
Route #11: 92 95 67 62 50 63 85 84 56 91 80
3436

35-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
37+
---
3638

3739
Hybrid Genetic Search (HGS) Route Cost: 1114.2
3840

@@ -60,7 +62,7 @@ Route #10: 90
6062

6163
Route #11: 69 98 88 53 78 73 79 60 55 70 68
6264

63-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
65+
---
6466

6567
Guided Local Search (GLS) Route Cost: 1266.9
6668

@@ -86,7 +88,7 @@ Route #9: 83 52 57 86 87 59 97 75 58 74
8688

8789
Route #10: 64 19 48 18 63 85 84 56 66
8890

89-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
91+
---
9092

9193
Ant Colony Optimization (ACO) Route Cost: 1321.8459204561746
9294

@@ -114,7 +116,7 @@ Route #10: 59 58 87 97 75 77
114116

115117
Route #11: 92 95 84 50 67
116118

117-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
119+
---
118120

119121
Simulated Annealing (SA) Route Cost: 1237.620141359753
120122

@@ -144,7 +146,7 @@ Route #11: 81 93 71 72 41 54
144146

145147
Route #12: 95 33 32 30 28 26 27 29 31 80
146148

147-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
149+
---
148150

149151
Algorithms - - No. of Routes - - Costs - - Gap(%) - - Runtime(seconds)
150152

@@ -158,19 +160,21 @@ Algorithms - - No. of Routes - - Costs - - Gap(%) - - Runtime(seconds)
158160

159161
SA - - -- - - - 12 - - - - - - - - - - 1237.6 - - 11.08 - - - 416.80780506134033
160162

161-
- - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - - -
163+
---
162164

163165
![3 HGS rc108](https://github.com/user-attachments/assets/afac9be9-37a1-4b4d-a7f8-5d346d653e2f) ![3 GLS rc108](https://github.com/user-attachments/assets/b8140b7f-30c2-4f65-9d55-24207754dd0f) ![3 ACO rc108](https://github.com/user-attachments/assets/3643d0e9-c3d4-418c-8ed7-efea8d94ede9) ![3 SA rc108](https://github.com/user-attachments/assets/3632158b-6131-4157-97bd-9cd4116bcecf)
166+
---
164167

165-
## Project Overview
168+
## Project Summary
166169

167-
This repository provides a comprehensive comparison and implementation of several heuristic and metaheuristic algorithms for solving the **Vehicle Routing Problem with Time Windows (VRPTW)**. Developed as part of a master's thesis, the project offers reproducible experiments, insightful analysis, and visualizations of solutions across different algorithms.
170+
This repository provides a comprehensive comparison and implementation of several heuristic and metaheuristic algorithms for solving the **Vehicle Routing Problem with Time Windows (VRPTW)**. Developed as part of an advanced study project, it showcases reproducible computational experiments, detailed analysis, and visualizations of solution quality for different algorithms. The target audience includes researchers, students, and practitioners interested in operations research, optimization, and applied machine learning.
168171

169172
---
170173

171174
## Table of Contents
172175

173-
- [Project Overview](#project-overview)
176+
- [Project Summary](#project-summary)
177+
- [Project Details](#project-details)
174178
- [Features](#features)
175179
- [Technologies Used](#technologies-used)
176180
- [Project Structure](#project-structure)
@@ -184,9 +188,9 @@ This repository provides a comprehensive comparison and implementation of severa
184188

185189
---
186190

187-
## Project Overview
191+
## Project Details
188192

189-
The VRPTW is a classic combinatorial optimization problem that extends the Vehicle Routing Problem (VRP) by adding time windows for customer visits. This project benchmarks and compares several well-known algorithms on standard datasets (e.g., Solomon's instances) and visualizes their performance.
193+
The Vehicle Routing Problem with Time Windows (VRPTW) is a classic combinatorial optimization problem that extends the basic Vehicle Routing Problem (VRP) by adding constraints on service time windows for each customer. The challenge is to determine optimal routes for a fleet of vehicles to service a set of customers within their specified time windows, minimizing total travel cost. This project benchmarks and compares several well-known metaheuristic algorithms on standard datasets (e.g., Solomon's instances) and visualizes their performance.
190194

191195
**Algorithms Compared:**
192196
- Hybrid Genetic Search (HGS)
@@ -225,7 +229,12 @@ The VRPTW is a classic combinatorial optimization problem that extends the Vehic
225229
├── main.py # Main script to run all algorithms and generate results
226230
├── solver.ipynb # Jupyter Notebook for interactive exploration
227231
├── aco/ # Implementation of Ant Colony Optimization
232+
│ ├── vrptw_base.py # Node and graph structures for ACO
233+
│ ├── basic_aco.py # Core ACO logic and route extraction
234+
│ ├── ant.py # Ant agent behaviors and movement
228235
├── gls/ # Implementation of Guided Local Search
236+
│ ├── base_solver.py # GLS algorithm and solver logic
237+
│ ├── instance_loader.py # Data loader for GLS
229238
├── sa/ # Simulated Annealing code
230239
├── hgs/ # Hybrid Genetic Search code
231240
├── bks.py # Processes Best-Known Solutions (BKS)
@@ -254,6 +263,8 @@ def solve_with_hgs(input_path, runtime):
254263
return result
255264
```
256265

266+
---
267+
257268
### 2. Guided Local Search (GLS)
258269
Enhances local search by penalizing overused solution components, implemented using OR-Tools, and allows for time-limited optimization.
259270

@@ -270,9 +281,34 @@ def solve_with_gls(input_path, runtime):
270281
return solver.get_solution()
271282
```
272283

284+
---
285+
273286
### 3. Ant Colony Optimization (ACO)
274287
A population-based metaheuristic that simulates ant foraging behavior using pheromone trails to discover optimal routes.
275288

289+
**Key Classes:**
290+
- `Node` (in `aco/vrptw_base.py`): Represents each location (customer or depot), including time windows and demand.
291+
- `Ant` (in `aco/ant.py`): Each ant constructs a route, considering vehicle load, time windows, and updates its path.
292+
- `BasicACO` (in `aco/basic_aco.py`): Core logic for iteratively building solutions and updating pheromones.
293+
294+
**Example Code Excerpt:**
295+
```python
296+
# Example: Extracting routes from the best path (aco/basic_aco.py)
297+
def get_best_route(self):
298+
routes = []
299+
route = []
300+
for node in self.best_path:
301+
if node != 0:
302+
route.append(node)
303+
else:
304+
if route:
305+
routes.append(route)
306+
route = []
307+
return routes
308+
```
309+
310+
---
311+
276312
### 4. Simulated Annealing (SA)
277313
A probabilistic algorithm that explores the solution space by occasionally accepting worse solutions, allowing escape from local minima.
278314

@@ -281,6 +317,7 @@ A probabilistic algorithm that explores the solution space by occasionally accep
281317
## How to Run
282318

283319
### 1. Environment Setup
320+
284321
```sh
285322
python -m venv .venv
286323
# Activate the virtual environment:
@@ -292,14 +329,22 @@ source .venv/bin/activate
292329
pip install -r requirements.txt
293330
```
294331

332+
---
333+
295334
### 2. Running the Algorithms
335+
296336
To run all algorithms and generate comparative results:
337+
297338
```sh
298339
python main.py
299340
```
300341

342+
---
343+
301344
### 3. Interactive Exploration
345+
302346
For a step-by-step interactive analysis:
347+
303348
```sh
304349
jupyter notebook solver.ipynb
305350
```
@@ -333,6 +378,8 @@ The following table summarizes the results of each algorithm on the `rc108.txt`
333378

334379
*All images are retained from the original README and illustrate the route solutions for each algorithm.*
335380

381+
*(See README for full image list)*
382+
336383
---
337384

338385
## Keywords
@@ -351,6 +398,12 @@ The following table summarizes the results of each algorithm on the `rc108.txt`
351398

352399
---
353400

401+
## Conclusion
402+
403+
This project serves as a hands-on, extensible, and educational platform for benchmarking and understanding metaheuristic algorithms applied to the VRPTW. You are encouraged to explore, modify, and extend the codebase for learning, research, or practical use cases.
404+
405+
---
406+
354407
## Contact
355408

356409
For questions, feedback, or collaboration:

0 commit comments

Comments
 (0)