JavaScript Genetic Algorithm

A small example showing off a genetic algorithm implementation in JavaScript. The algorithm takes the JavaScript object from the text box and determine what values should be passed to the fitness function to produce the smallest resulting value.

The included example tries to find the shortest path between a set of points (the travelling salesman problem).


Number of generations: [?]
Number of chromosomes in the population: [?]
Mutation rate: % [?]
Crossover rate: % [?]

Results

Chromosome: Fitness:

If you are using a browser that supports that canvas tag (webkit or gecko engine) you will see below a nice graph of the history of the best values.

History Graph

And the best value as painted by the fitness function itself:

Useful Links: