public class ElitisticListPopulation extends ListPopulation
Constructor and Description |
---|
ElitisticListPopulation(int populationLimit,
double elitismRate)
Creates a new
ElitisticListPopulation instance and initializes its inner chromosome list. |
ElitisticListPopulation(List<Chromosome> chromosomes,
int populationLimit,
double elitismRate)
Creates a new
ElitisticListPopulation instance. |
Modifier and Type | Method and Description |
---|---|
double |
getElitismRate()
Access the elitism rate.
|
Population |
nextGeneration()
Start the population for the next generation.
|
void |
setElitismRate(double elitismRate)
Sets the elitism rate, i.e.
|
addChromosome, addChromosomes, getChromosomeList, getChromosomes, getFittestChromosome, getPopulationLimit, getPopulationSize, iterator, setChromosomes, setPopulationLimit, toString
public ElitisticListPopulation(List<Chromosome> chromosomes, int populationLimit, double elitismRate) throws NullArgumentException, NotPositiveException, NumberIsTooLargeException, OutOfRangeException
ElitisticListPopulation
instance.chromosomes
- list of chromosomes in the populationpopulationLimit
- maximal size of the populationelitismRate
- how many best chromosomes will be directly transferred to the next generation [in %]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 limitOutOfRangeException
- if the elitism rate is outside the [0, 1] rangepublic ElitisticListPopulation(int populationLimit, double elitismRate) throws NotPositiveException, OutOfRangeException
ElitisticListPopulation
instance and initializes its inner chromosome list.populationLimit
- maximal size of the populationelitismRate
- how many best chromosomes will be directly transferred to the next generation [in %]NotPositiveException
- if the population limit is not a positive number (< 1)OutOfRangeException
- if the elitism rate is outside the [0, 1] rangepublic Population nextGeneration()
elitismRate
percents of the best chromosomes are directly copied to the next generation.public void setElitismRate(double elitismRate) throws OutOfRangeException
elitismRate
- how many best chromosomes will be directly transferred to the next generation [in %]OutOfRangeException
- if the elitism rate is outside the [0, 1] rangepublic double getElitismRate()
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.