/SimpleGeneticAlgorithm

Simple example of how a genetic algorithm works.

Primary LanguageJavaScript

Simple Genetic Algorithm using JS

Simple example of how a genetic algorithm works.

Run the index.html file to see how would a genetic algorithm work. The logs are in the console, don't forget to check.

The Algorithm consists in the creation of a population of 16 individuals, each of them with a genetic code (an array of size 16 with booleans values). We select the best individual (better fitness) and make another generation from their genetic code. The algorithm runs until it gets four perfect parents (fitness = 16), wich means that the next generations would be always of perfect indivuals.