rizarakhmat / GeneticAlgoritmTSP

Generic Algorithm parallel programming for TSP problem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeneticAlgoritmTSP

TSP with Genetic Algorithms

The purpose of the project was to solve Travelling Salesman Problem, known as TSP, by using a Genetic Algorithms approach and exploit parallelism. In addition to the sequential version used as a baseline, two parallel versions were developed, one using standard C++ threads and one using Fastflow. More information about the project and the design of the parallel versions can be found in the report.

To test the correctness of the three versions developed, I saved for a run of each version the current best route for each generation of the algorithm. In the following plots the length of the best path decrease as the algorithm goes on with the generation, so convergence algorithms were obtained.

Running the project

The project can be compiled and executed using Cmake 3.11 or GCC (remember to turn on -O3 optimization).

To compile

 $ make compile

To execute

- sequential version: ./demo 0 #NODES #POPULATION 0 #ITERATIONS
- thread version: ./demo 1 #NODES #POPULATION 1 #ITERATIONS
- fastflow version: ./demo 2 #NODES #POPLATION 2 #ITERATIONS

To execute graphical version (NOTE: you have to install the graphics.h library)

$ make compile-graph
$ ./demo 0 #NODES #POPULATION 0 #ITERATIONS

To compile debug version

$ make compile-debug

To compile with inforation about vectorized loops

$ make vectorized

To test the application (the parameters can be modified in the bash/test.sh file)

$ make test

Example of usage

$ ./demo 1 20 1000 4 1000

Results

Each version of the program was tested on an Intel Xeon PHI machine from 1 to 256 thread. The tests were done with 10 generation and 20000 chromosomes and considering [500, 1000, 2000] nodes in the graph.

Acknowledgments

This project was developed for the course of Parallel and Distributed Systems at the University of Pisa under the guide of Prof. Marco Danelutto and Prof. Patrizio Dazzi.

About

Generic Algorithm parallel programming for TSP problem


Languages

Language:C++ 82.0%Language:Shell 13.8%Language:Makefile 4.0%Language:C 0.2%