Skip to content
/ TSPViz Public

Visualization of TSP solver using genetic algorithms

License

Notifications You must be signed in to change notification settings

gibasm/TSPViz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSPViz - Travelling Salesperson Problem vizualizer

CI/Build

The app is meant as an educational, fun to watch vizualization of genetic algorithms used to solve the Travelling Salesperson Problem. tspviz sample screenshot

Usage:

  1. Get/create a *.tsp file:

Sample symmetric TSP instances to test can be found on Heidelberg University's website.

Warning: TSPViz supports only instances in TSPLIB95 EUC_2D format!

  1. Create a config.ini file in the directory of your *.tsp file(s).

Here's a sample solver config file's content (config.ini):

algorithm_type = GA
iterations = 30000
population_size = 100
crossover_method = OX
mutation_method = SWAP
p_mutation = 0.4
  • GA - genetic algorithm

  • p_mutation - probability of mutation

  1. Run:
tspviz <instance>.tsp

or if you want to see the current best path cost in the terminal:

tpsviz <instance>.tsp -d

Building & testing

Dependencies:

  • git
  • CMake >= 3.15 (for GNU/Linux also Make)
  • spdlog 1.x
  • SDL 2.x
  • C++ toolchain with C++17 support

Steps (GNU/Linux):

  1. Make sure you've got all of the dependencies installed on your system.

  2. Open a terminal and type:

git clone <url to this repo> 
  1. Go to the cloned repository's directory and create a directory named build

  2. Type:

cmake ..

then:

make
  1. Run the app

  2. Test by typing:

ctest