-
Notifications
You must be signed in to change notification settings - Fork 1
Evolution
I have implemented evolution as a class which is inherited by the class Population and provides the basic functions of evolution in the context of the population.
p = Population.new
p.evolve
The steps of general evolution after initialization are: selection, reproduction and competition, through not necessarily in that order. In “human” style evolution 2 Individuals are selected at random and they reproduce, creating a new Individual. The competition step involves the new Individual competing with a random member from the population for a place in the population. In “microbial” style evolution 2 Individuals are selected at random. These then compete and the winner overwrite a % of the looses DNA with their own.
In both cases all stages (selection, reproduction and competition) are repeated every “generation” or GA cycle. Which style of evolution is used depends on the option for recombination in the config hash.
Microbial evolution is selected if the recomb_method contains the string microbial, otherwise standard evolution is used.
if @config[:recomb_method].to_s =~ /microbial/
The number of generations to run the GA for is defined in
@config[:generations]
Unless stated the current generation and winner or that generation will be output to the terminal. To speed run time and quiet the output messages verbose mode can be turned off by using:
p.evolve quiet => true