Interface Population
- All Superinterfaces:
Iterable<Chromosome>
- All Known Implementing Classes:
ElitisticListPopulation
,ListPopulation
A collection of chromosomes that facilitates generational evolution.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChromosome
(Chromosome chromosome) Add the given chromosome to the population.Access the fittest chromosome in this population.int
Access the maximum population size.int
Access the current population size.Start the population for the next generation.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getPopulationSize
int getPopulationSize()Access the current population size.- Returns:
- the current population size.
-
getPopulationLimit
int getPopulationLimit()Access the maximum population size.- Returns:
- the maximum population size.
-
nextGeneration
Population nextGeneration()Start the population for the next generation.- Returns:
- the beginnings of the next generation.
-
addChromosome
Add the given chromosome to the population.- Parameters:
chromosome
- the chromosome to add.- Throws:
NumberIsTooLargeException
- if the population would exceed the population limit when adding this chromosome
-
getFittestChromosome
Chromosome getFittestChromosome()Access the fittest chromosome in this population.- Returns:
- the fittest chromosome.
-