/GeneticAlgorithms

Basic genetic algorithms!

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

GeneticAlgorithms

In computer science and operations research, a genetic algorithm (GA) is a metaheuristic inspired by the process of natural selection that belongs to the larger class of evolutionary algorithms (EA). Genetic algorithms are commonly used to generate high-quality solutions to optimization and search problems by relying on bio-inspired operators such as mutation, crossover and selection. For more information.

Infinite monkey theorem:

Infinite monkey theorem

  • The infinite monkey theorem states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare. In fact the monkey would almost surely type every possible finite text an infinite number of times. However, the probability that monkeys filling the observable universe would type a complete work such as Shakespeare's Hamlet is so tiny that the chance of it occurring during a period of time hundreds of thousands of orders of magnitude longer than the age of the universe is extremely low (but technically not zero). For more information about Infinite monkey theorem please check the wikipedia page.

Basic Results:

Goal phrase: To be or not to be
Best phrase: St be<y^Un`aY C<JO - Fitness:22.22222222222222
Generation Number: 1
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: zuKbec[r nVLmBxIH` - Fitness:27.77777777777778
Generation Number: 2
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: ^p Vw VityKaMNo be - Fitness:33.33333333333333
Generation Number: 3
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: Tompe orEMKBttK J> - Fitness:44.44444444444444
Generation Number: 4
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: Tonbw opGsodvZ@ bG - Fitness:44.44444444444444
Generation Number: 5
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: RozCh cr ^rt RoFbe - Fitness:50.0
Generation Number: 6
Population Number: 1500
Mutation Rate (%): 2.0

.
.
.

Goal phrase: To be or not to be
Best phrase: To Ze or not toSbe - Fitness:88.88888888888889
Generation Number: 35
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: To be or not tL be - Fitness:94.44444444444444
Generation Number: 36
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: To De or not to be - Fitness:94.44444444444444
Generation Number: 37
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: To beXor not to be - Fitness:94.44444444444444
Generation Number: 38
Population Number: 1500
Mutation Rate (%): 2.0

Goal phrase: To be or not to be
Best phrase: To be or not to be - Fitness:100.0
Generation Number: 39
Population Number: 1500
Mutation Rate (%): 2.0