Table of Contents

Class RealValuedIndividual

Namespace
AiDotNet.Genetics
Assembly
AiDotNet.dll

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

genes ICollection<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

dimensionCount int

The number of dimensions (genes).

minValue double

The minimum value for initialization.

maxValue double

The maximum value for initialization.

random Random

Random 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

fitness double

The fitness score to set.

SetGenes(ICollection<RealGene>)

Sets the genes of this individual.

public void SetGenes(ICollection<RealGene> genes)

Parameters

genes ICollection<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

successRatio double

The ratio of successful mutations.