abstract class Talgene::Generation(T)
- Talgene::Generation(T)
- Reference
- Object
Overview
A convenience abstract class to avoid some boilerplate over the implementation of a
#advance
method.
Included Modules
Defined in:
models/generation.crConstructors
-
.new(population : Array(T))
Creates a new
Talgene::Generation
instance with supplied array of individuals.
Instance Method Summary
-
#best_fitness
Convenience method to fetch the best fitness yielded from the population.
-
#fittest : T
Returns the population individual that scored the best fitness.
-
#population : Array(T)
Returns the population of this generation.
Instance methods inherited from module Talgene::Advanceable(Talgene::Generation(T))
advance(count : Int)advance : T(T) advance
Constructor Detail
def self.new(population : Array(T))
#
Creates a new Talgene::Generation
instance with supplied array of individuals.
Instance Method Detail
def best_fitness
#
Convenience method to fetch the best fitness yielded from the population. Same as
fittest.fitness
def fittest : T
#
Returns the population individual that scored the best fitness. Once this is computed, the value is cached for future calls.
Expects T
implements #fitness
. See Talgene::Fittable
.