Coder Social home page Coder Social logo

travelling-salesman-openmp's Introduction

Travelling Salesman OpenMP

Introduction

The Travelling Salesman Problem is a well known NP-Hard problem with a computational time complexity of O(n!). A more scalable solution of TSP is much more favourable even at the cost of optimality. Therefore an AI based solution that is fast and close to optimal seems much more attractive. This is an implementation of several genetic crossover algorithms to solve the problem. Clearly time is of critical importance in such a computationally dense problem and it makes a lot of sense to explore any avenues for parallelism. Hence the implementation makes use of the OpenMP library to provide maximal speedups.

Requirements

The code is a C++ implementation and therefore requires g++ with OpenMP support.

How to use

  • The project includes a makefile that can be used to create an executable named tsp.
  • The number of threads can be set in the environment.
    export OMP_NUM_THREADS=x
  • The executable accepts and requires an input file, output file and afforded time in seconds.
    ./tsp input_file_path output_file_path time_in_sec

The algorithms

  • The project implements chromosome crossover algorithms like Partially Mapped Crossover (PMX), Greedy Crossover (GX), Cycle Crossover (CX) and Edge Recombination Crossover (ERX).
  • This is followed by a roulette wheel selection of parents on the basis of their fitness for further crossovers.
  • The chromosomes are periodically mutated to prevent gene stagnation.
    Mutation is especially higher towards the end to evade any local maximas.
  • An additional heuristic : Maintained a list of 10 best chromosomes at
    any given point to reseed good solutions into the population time to time
    preventing their extinction.

travelling-salesman-openmp's People

Contributors

rachit95arora avatar

Stargazers

 avatar Paulinelly Oliveira avatar  avatar JYOTIRMOY MONDAL avatar Shardul Tripathi avatar

Watchers

 avatar  avatar

travelling-salesman-openmp's Issues

How to run on windows?

Hi,
tnx for your code. my question is that how to run this program on windows and how to run the makefile you prepare.
tnx.
best regards

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.