Initializes a new instance of the Population class.

Namespace:  AForge.Genetic
Assembly:  AForge.Genetic (in AForge.Genetic.dll) Version: 2.2.4.0 (2.2.4.0)

Syntax

C#
public Population(
	int size,
	IChromosome ancestor,
	IFitnessFunction fitnessFunction,
	ISelectionMethod selectionMethod
)

Parameters

size
Type: System..::.Int32
Initial size of population.
ancestor
Type: AForge.Genetic..::.IChromosome
Ancestor chromosome to use for population creatioin.
fitnessFunction
Type: AForge.Genetic..::.IFitnessFunction
Fitness function to use for calculating chromosome's fitness values.
selectionMethod
Type: AForge.Genetic..::.ISelectionMethod
Selection algorithm to use for selection chromosome's to new generation.

Remarks

Creates new population of specified size. The specified ancestor becomes first member of the population and is used to create other members with same parameters, which were used for ancestor's creation.

Exceptions

ExceptionCondition
System..::.ArgumentExceptionToo small population's size was specified. The exception is thrown in the case if size is smaller than 2.

See Also