Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/suddi/tsp
Solution to the Travelling Salesman Problem using a genetic algorithm
https://github.com/suddi/tsp
c-plus-plus genetic-algorithm optimization traveling-salesman tsp
Last synced: about 2 months ago
JSON representation
Solution to the Travelling Salesman Problem using a genetic algorithm
- Host: GitHub
- URL: https://github.com/suddi/tsp
- Owner: suddi
- License: mit
- Created: 2015-03-20T07:42:56.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T17:36:23.000Z (almost 8 years ago)
- Last Synced: 2024-10-12T13:43:44.303Z (3 months ago)
- Topics: c-plus-plus, genetic-algorithm, optimization, traveling-salesman, tsp
- Language: C++
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TSP Genetic Algorithm #
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/7f6b74abf0924e6099ceec57eb8151c3)](https://www.codacy.com/app/suddir/TSP?utm_source=github.com&utm_medium=referral&utm_content=suddi/TSP&utm_campaign=Badge_Grade)
[![license](https://img.shields.io/github/license/suddi/TSP.svg?maxAge=2592000)](https://github.com/suddi/TSP/blob/master/LICENSE)This is a solution to the Travelling Salesman Problem using a genetic algorithm implementation.
This TSP program requires C++11.The application operates as two working parts:
1. **Map Generation**
1. **Solution**### Map Generation ###
To generate a map, we can start off by setting values in [`config.h`](config.h).
Here the relevant variables are `MAP_FILE`, `MAP_SIZE`, `NUM_CITIES`, `CITY_SYMBOL` and `EMPTY_SYMBOL`.After entering the settings we can compile the application by:
$ make
Now, to generate a map with the settings:
$ ./tsp createMap
### Solution ###
Once a map has been generated, we can proceed to solve it.
We can again set up the settings as desired in [`config.h`](config.h).If the settings are changed, we will need to compile the application again:
$ make
To run the solution:
$ ./tsp solveMap