https://github.com/lazovelko/genetic-algorithm-for-the-traveling-salesman-problem
A population based stochastic algorithm for solving the Traveling Salesman Problem.
https://github.com/lazovelko/genetic-algorithm-for-the-traveling-salesman-problem
genetic-algorithm population stochastic-algorithm traveling-salesman tsp
Last synced: 2 months ago
JSON representation
A population based stochastic algorithm for solving the Traveling Salesman Problem.
- Host: GitHub
- URL: https://github.com/lazovelko/genetic-algorithm-for-the-traveling-salesman-problem
- Owner: LazoVelko
- Created: 2017-02-11T03:21:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T05:20:23.000Z (over 8 years ago)
- Last Synced: 2025-04-08T07:42:50.910Z (2 months ago)
- Topics: genetic-algorithm, population, stochastic-algorithm, traveling-salesman, tsp
- Language: Java
- Size: 348 KB
- Stars: 41
- Watchers: 3
- Forks: 19
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Genetic-Algorithm-for-the-Traveling-Salesman-Problem
A population based stochastic algorithm for solving the Traveling Salesman Problem.
The settings and results are as follows:
```
Seed: -5895073454024526343
----------Genetic Algorithm Properties----------
Number of Cities: 48
Population Size: 500
Max. Generation: 500
k Value: 3
Elitism Value: 1
Force Uniqueness: false
Local Search Rate: 0.0
Crossover Type: UNIFORM_ORDER
Crossover Rate: 90.0%
Mutation Type: INSERTION
Mutation Rate: 4.0%
-----------Genetic Algorithm Results------------
Average Distance of First Generation: 157724
Average Distance of Last Generation: 36070
Best Distance of First Generation: 122547
Best Distance of Last Generation: 34873
Area Under Average Distance: 32335049
Area Under Average Distance: 26186089
```Also produces a graph with the progress over time:

This program is also capable of producing a 2D heat map for determining the optimal parameters but I have not included an image of this.
## Usage
Navigate to Main.class after compiling and run the following command:
```
java Main
```