Top Description Fields Constructors Methods
org.apache.commons.math3.genetics

public Class ElitisticListPopulation

extends ListPopulation
Class Inheritance
Imports
java.util.Collections, .List, org.apache.commons.math3.exception.NotPositiveException, .NullArgumentException, .NumberIsTooLargeException, .OutOfRangeException, org.apache.commons.math3.exception.util.LocalizedFormats, org.apache.commons.math3.util.FastMath

Population of chromosomes which uses elitism (certain percentage of the best chromosomes is directly copied to the next generation).
Since
2.0

Field Summary

Modifier and TypeField and Description
private double
elitismRate

percentage of chromosomes copied to the next generation

Constructor Summary

AccessConstructor and Description
public
ElitisticListPopulation(final List<Chromosome>
list of chromosomes in the population
chromosomes
,
final int
maximal size of the population
populationLimit
,
final double
how many best chromosomes will be directly transferred to the next generation [in %]
elitismRate
)

Creates a new ElitisticListPopulation instance.

public
ElitisticListPopulation(final int
maximal size of the population
populationLimit
,
final double
how many best chromosomes will be directly transferred to the next generation [in %]
elitismRate
)

Creates a new ElitisticListPopulation instance and initializes its inner chromosome list.

Method Summary

Modifier and TypeMethod and Description
public double

Returns:

the elitism rate
getElitismRate
()

Access the elitism rate.

public Population

Returns:

the beginnings of the next generation.
nextGeneration
()

Implements org.apache.commons.math3.genetics.Population.nextGeneration.

Start the population for the next generation.

public void
setElitismRate(final double
how many best chromosomes will be directly transferred to the next generation [in %]
elitismRate
)

Sets the elitism rate, i.e. how many best chromosomes will be directly transferred to the next generation [in %].

Inherited from org.apache.commons.math3.genetics.ListPopulation:
addChromosomeaddChromosomesgetChromosomeListgetChromosomesgetFittestChromosomegetPopulationLimitgetPopulationSizeiteratorsetChromosomessetPopulationLimittoString

Field Detail

elitismRateback to summary
private double elitismRate

percentage of chromosomes copied to the next generation

Constructor Detail

ElitisticListPopulationback to summary
public ElitisticListPopulation(final List<Chromosome> chromosomes, final int populationLimit, final double elitismRate) throws NullArgumentException, NotPositiveException, NumberIsTooLargeException, OutOfRangeException

Creates a new ElitisticListPopulation instance.

Parameters
chromosomes:List<Chromosome>

list of chromosomes in the population

populationLimit:int

maximal size of the population

elitismRate:double

how many best chromosomes will be directly transferred to the next generation [in %]

Exceptions
NullArgumentException:
if the list of chromosomes is null
NotPositiveException:
if the population limit is not a positive number (< 1)
NumberIsTooLargeException:
if the list of chromosomes exceeds the population limit
OutOfRangeException:
if the elitism rate is outside the [0, 1] range
ElitisticListPopulationback to summary
public ElitisticListPopulation(final int populationLimit, final double elitismRate) throws NotPositiveException, OutOfRangeException

Creates a new ElitisticListPopulation instance and initializes its inner chromosome list.

Parameters
populationLimit:int

maximal size of the population

elitismRate:double

how many best chromosomes will be directly transferred to the next generation [in %]

Exceptions
NotPositiveException:
if the population limit is not a positive number (< 1)
OutOfRangeException:
if the elitism rate is outside the [0, 1] range

Method Detail

getElitismRateback to summary
public double getElitismRate()

Access the elitism rate.

Returns:double

the elitism rate

nextGenerationback to summary
public Population nextGeneration()

Implements org.apache.commons.math3.genetics.Population.nextGeneration.

Start the population for the next generation. The elitismRate percents of the best chromosomes are directly copied to the next generation.

Returns:Population

the beginnings of the next generation.

setElitismRateback to summary
public void setElitismRate(final double elitismRate) throws OutOfRangeException

Sets the elitism rate, i.e. how many best chromosomes will be directly transferred to the next generation [in %].

Parameters
elitismRate:double

how many best chromosomes will be directly transferred to the next generation [in %]

Exceptions
OutOfRangeException:
if the elitism rate is outside the [0, 1] range