Giter Club home page Giter Club logo

tsp-with-genetic-algorithm's Introduction

Using Genetic Algorithm to Solve the Traveling Salesman Problem

Here, I have used the Genetic Algorithm to solve the popular TSP. You will need to give the map to the geneticAlgorithm method in form of a nested list. You can change the maximum number of iterations(number of populations), population size, probability of mutation and you can also mannually set the initial population. The algorithm terminates whenever it exceeds the iteration limit, or when the average fitness of a population does not get better after creating a new generation of population. In each iteration, two individuals of the current population are chosen based on a weighted random choice. Needless to say that their probability to be chosen is based on their fitness. Fitter they are, the less is their fit attribute(cost of the salesman search) and the higher is their chance to be chosen. Next, the two selected individuals create an offspring, using partially mapped crossover. The mentioned offspring will then go through a random mutation with a small probability and is finally ready to be added to the next population.

tsp-with-genetic-algorithm's People

Contributors

nikashahabi avatar

Watchers

 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.