You are here

Genetic Algorithm for the Traveling Salesman Problem

Genetic algorithms simulate genetics and evolution. A solution to a problem is viewed as a "life form", or a "Chromosome". Then many solutions are created. The better solutions live to "mate" with other "better solutions". Therefore, the whole population gradually evolves to an ideal solution.

The "Traveling Salesman Problem" (TSP) is a common problem applied to artificial intelligence. The TSP presents the computer with a number of cities, and the computer must compute the optimal path between the cities. This applet uses a genetic algorithm to produce a solution to the "Traveling Salesman Problem".

Genetic Algorithm

  1. Enter the number of cities the salesman much cross through.
  2. Enter the population size, 1000 is good for 50 cities. Enter too small a population and a solution will not be found.
  3. Enter the mutation percent, this is what percent of the population will be "mutated", which is a random element introduced into the genetic makeup.
  4. Click Start, and watch the genetic algorithm try and find the optimal path.

[Download Source Code]
[Learn More about Artificial Intelligence]



Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer