Resize population to the new specified size.

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

Syntax

C#
public void Resize(
	int newPopulationSize,
	ISelectionMethod membersSelector
)

Parameters

newPopulationSize
Type: System..::.Int32
New size of population.
membersSelector
Type: AForge.Genetic..::.ISelectionMethod
Selection algorithm to use in the case if population should get smaller.

Remarks

The method does resizing of population. In the case if population should grow, it just adds missing number of random members. In the case if population should get smaller, the specified selection method is used to reduce the population.

Exceptions

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

See Also