Skip to content
This repository has been archived by the owner. It is now read-only.
/ EC_TSP Public archive

Traveling Salesman Problem implementation for the Evolutionary Computing course at ITMO University (Fall 2019)

Notifications You must be signed in to change notification settings

benit8/EC_TSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traveling Salesman Problem

Here you'll find my implementation of a solver for the traveling salesman problem, using a genetic algorithm. The goal of this task is to find the shortest path between a set of cities, defined as points in a 2D space.

I implemented my solution in C++ (with SFML for the graphic visualisation), on a Linux environment. The default make command builds without the graphics. You can compile the graphic version with the command make graph.

Run the program with the path to a .tsp file (samples can be found in tours)

./tsp tours/xqf131.tsp

If you run the graphic version, make sure the program is run from the repository's root, the binary needs the font file located in res.

In graphic mode, when reaching the defined maximum number of generations, the simulation is paused but you can resumed it by pressing the space bar. In normal mode, the program just exists.

Results

My base parameters are:

  • Generations: 1000
  • Population size: 100
  • Elite size: 20
  • Mutation rate: 0.0005

Upon launch, the best distance begins around 4k then quickly drops to around 1.4k (or less), from there it slows down progressively but continues its progress until it reaches about 1k. Of course this result is not satisfying enough, so we're going to tweak the parameters:

  • Generations: 3000
  • Population size: 200
  • Elite size: 40

With these (and some luck) we can get under the 900 distance mark. With 10k generations, the algorithm gets to a bit above 700. Pushing to the 20k generations brings us under the 700 mark.

Graphic version with a distance under 700

About

Traveling Salesman Problem implementation for the Evolutionary Computing course at ITMO University (Fall 2019)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published