Class RealValuedIndividual
Represents an individual encoded with real-valued genes, suitable for numerical optimization problems.
public class RealValuedIndividual : IEvolvable<RealGene, double>
- Inheritance
-
RealValuedIndividual
- Implements
- Derived
- Inherited Members
Constructors
RealValuedIndividual(ICollection<RealGene>)
Creates a real-valued individual with the specified genes.
public RealValuedIndividual(ICollection<RealGene> genes)
Parameters
genesICollection<RealGene>The genes to initialize with.
RealValuedIndividual(int, double, double, Random)
Creates a new individual with random values within the specified range.
public RealValuedIndividual(int dimensionCount, double minValue, double maxValue, Random random)
Parameters
dimensionCountintThe number of dimensions (genes).
minValuedoubleThe minimum value for initialization.
maxValuedoubleThe maximum value for initialization.
randomRandomRandom number generator for initialization.
Methods
Clone()
Creates a deep clone of this individual.
public IEvolvable<RealGene, double> Clone()
Returns
- IEvolvable<RealGene, double>
A clone of this individual.
GetFitness()
Gets the fitness of this individual.
public double GetFitness()
Returns
- double
The fitness score.
GetGenes()
Gets the genes of this individual.
public ICollection<RealGene> GetGenes()
Returns
- ICollection<RealGene>
The collection of genes.
GetValuesAsArray()
Gets the values of all genes as an array.
public double[] GetValuesAsArray()
Returns
- double[]
An array of double values.
SetFitness(double)
Sets the fitness of this individual.
public void SetFitness(double fitness)
Parameters
fitnessdoubleThe fitness score to set.
SetGenes(ICollection<RealGene>)
Sets the genes of this individual.
public void SetGenes(ICollection<RealGene> genes)
Parameters
genesICollection<RealGene>The genes to set.
UpdateStepSizes(double)
Updates the step sizes according to Evolutionary Strategies 1/5 success rule.
public void UpdateStepSizes(double successRatio)
Parameters
successRatiodoubleThe ratio of successful mutations.