Rutger Vos
and 1 contributors

NAME

Algorithm::Genetic::Diploid::Experiment - manages an evolutionary experiment

METHODS

new

Constructor takes named arguments. Provides defaults for mutation_rate (0.05), crossover_rate (0.60), reproduction_rate (0.35) and ngens (50).

initialize

Sets up the experiment based on the provided arguments:

 'individual_count' => number of individuals in the population, default is 50
 'chromosome_count' => number of chromosome pairs per individual, default is 1
 'gene_count'       => number of genes per chromosome, default is 1
optimum

Should be overridden in order to define an optimum fitness value at the provided generation.

factory

Getter and setter for a Algorithm::Genetic::Diploid::Factory object (or subclass thereof), which instantiates other objects.

env

Getter and setter for a data object that gets passed to the gene functions

reproduction_rate

Getter and setter for the fraction of individuals in the population that gets to reproduce

mutation_rate

Amount of change to apply to the weight and/or function of a gene.

crossover_rate

Getter and setter for the proportion of genes that crossover

ngens

Getter and setter for the number of generations in the experiment

population

Getter and setter for the Algorithm::Genetic::Diploid::Population object

run

Runs the experiment!

genecount

Returns the number of distinct genes that remained after an experiment.