Posts tagged Genetic Algorithm
Over the course of the last semester I did a project work with the title ‘Approximation of the Traveling Salesman Problem utilising a genetic algorithm in a parallel system‘. As this is a very complex title by itself, I will explain what this work was about in a few sentences. For further details please take a look at the documentation.
The main goal of this project was to develop an algorithm to approximate an optimal tour for the traveling salesman problem, which is in short as follows: A salesman wants to visit X cities under the following conditions:
- every city must be visited exactly once
- the tour has to be a round trip
This is a NP-complete problem, meaning there is no efficient algorithm known to solve it in a worthwhile timeframe. Since nobody wants to wait for several years to get an optimal tour, there are some approximation algorithms which are rather good. As multi-core processors are becoming more and more common, programming applications that utilize multiple cores has become an important trait.
This is where genetic algorithms come into play: Offering intrinstic parallelism they’re well suited for parallelization. Also, they are very general in nature: All that’s necessary is to encode the problem in a way the genetic alorithm can handle it. The algorithm does not need any problem-specific information, although it could be used to enhance the results.
The program was developed in Linux using eclipse CDT 5.0.1 and CMake 2.6, so this is the recommended environment to build and run it. It also utilizes OpenMP and TR1 for shared pointers, so make sure your compiler supports it. For further details, see How to build.
Building under Windows
By default the build environment is set to linux to compile. If you want to compile it under windows, you have to set the appropriate define in the config.h file:
//#define LINUX #define WIN_32
Also note that this is a console application, so make sure you’ve set your IDE to the correct system.
It was written to the best of my knowledge, though I can’t guarantee it’s perfectly free of errors. Furthermore, the disclaimer of this blog applies.