class Population(T)
- Population(T)
- Reference
- Object
Overview
Keeps track of population, generations, selection.
Defined in:
population.crConstructors
Instance Method Summary
- #best_solution
-
#evolve!
Selects chromosomes for breeding (using
#select_pair
), creates the next generation. - #generation
- #max_fitness
-
#mutate?
A bit naive perhaps, but easy to override.
-
#seed(population : Array(T) = [] of T)
Seed the genesis generation.
-
#select_pair
Select a pair of chromosomes using proportional selection.
-
#winner
Calls fitness function on ALL chromosomes, and returns highest.
Constructor Detail
Instance Method Detail
def evolve!
#
Selects chromosomes for breeding (using #select_pair
), creates the next generation.
Adds random mutation depending on #mutate?
def winner
#
Calls fitness function on ALL chromosomes, and returns highest. Be mindful of the expense.