-
Notifications
You must be signed in to change notification settings - Fork 1
Evolution
The Evolution class is passed, configs, a population and an optional population moniter. The function of this class is to call actions on the population and its Individuals to coordinate the process of evolution. At the minute there are just two major types of evolution defined in this function; Microbial and Standard/Classic.
Standard evolution is most akin to human style evoution and has the following sequence of events;
Select two random members ind_1, ind_2 = @population.get_mates
Create a new member by recombination of the two members genomes ind_new = ind_1.mate ind_2
Compete the new member against another random member ind_new.fight contestant
If the new member wins (is fitter) then replace the contestant with the new member, else discard it.@population.replace_individual( contestant, winner ) unless contestant== winner
Microbial evolution is most akin to the evolution of viral life forms. This version is based on my Sussex uni lecture Dr. Inman Harvey’s one line micorbial algorithm, however this is not the one line approach!
Select two random members and sort by fitness ind_1, ind_2 = sort_by_fitness(@population.get_mates)
Create a new member by recombination of the two members genome with a >50% cross over (new member has more genetic material from fittest parent). ind_new = ind_1.mate ind_2
config[:cross_over_rate] should be >0.5 <br/>
Overwrite the weaker parent with the new member <code>
population.replace_individual( ind_2, ind_new )
This is analogus to a viral life form inserting its DNA into another and overwriting the other DNA with its own. using a cross over rate of less than 50% will work but is much slower, 70% (0.7) is a good value to use.
For now the desision of which evolution to use if determined by the setting for recombination.
if @config[:recomb_method].to_s =~ /microbial/
If the microbial recombination method is used the the microbial sequence is used.
The number of generations to run the GA for is defined in @config[:generations]