Giter VIP home page Giter VIP logo

genetic-tsp's Introduction

genetic-tsp

This repository contains several parallel implementations of a genetic algorithm for the Travelling Salesman Problem (TSP). For detailed information about the project, see report.pdf.

Makefile

The project contains a Makefile to produce the executables and the object files of the project. Running make all will be enough to get everything ready. To replicate the same experiments and plots in the report, run make exp. If you need to, remember to change the algorithm parameters at the start of the script experiment.sh (default: experiment with 3000 individuals).

Producing a graph file

Most of the executables need a .csv file containing the representation of the input graph. The file representing the graph used in the experiments is already contained in the project directory (complete.csv). To create a new complete graph with n nodes and random weights in graph.csv, run:

./csv graph.csv n

Testing the single versions

To test every genetic algorithm against the bruteforce algorithm, run the script test.sh. To test the sequential version, execute:

./tspseq complete.csv 1000 0.9 0.1 20 123

To run a parallel version, for example the ParallelFor one, run:

./tsppar_fffor complete.csv 1000 0.9 0.1 20 4 123

Running the experiments

To replicate the complete experiment, run the bash script experiment.sh as follows:

bash experiment.sh exp_dir 0,1,2,3,4 1 4 64 123

Again, if you need to, remember to change the algorithm parameters placed at the start of the script.

Plots

To produce plots, use the python script as follows:

python3 data_analysis.py exp_dir

where exp_dir is the output directory of the script experiment.sh.

genetic-tsp's People

Contributors

emanuelecosenza avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.