Documentation
¶
Overview ¶
Package floatarr provides a genotype type that is a slice of float64 values. It also provides functions for reproduction using these genotypes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Genotype ¶
type Genotype []float64
Genotype is a genotype that is a slice of float64 values.
func NewGenotype ¶
NewGenotype creates a new genotype with the given size, where each value is a random float64 with a normal distribution with the given standard deviation.
func (Genotype) PointCrossoverWith ¶
func (f64s Genotype) PointCrossoverWith(other goevo.PointCrossoverable) goevo.PointCrossoverable
PointCrossoverWith returns a new genotype that is a combination of this genotype and the other genotype.
func (Genotype) UniformStdMutate ¶
UniformStdMutate modifies the genotype by adding a random value from a normal distribution to each value with the given probability and standard deviation.
type UniformStdReproduction ¶
type UniformStdReproduction struct { // The probability of mutating each locus MutateProbability float64 // The standard deviation for the mutation MutateStd float64 }
UniformStdReproduction is a reproduction strategy for Float64sGenotype. It performs crossover and mutation.
func (*UniformStdReproduction) NumParents ¶
func (r *UniformStdReproduction) NumParents() int
NumParents returns 2, as this reproduction strategy requires 2 parents.
func (*UniformStdReproduction) Reproduce ¶
func (r *UniformStdReproduction) Reproduce(gs []Genotype) Genotype
Reproduce creates a new genotype by crossing over and mutating the given genotypes.