public abstract class ListPopulation extends Object implements Population
List.| Constructor and Description |
|---|
ListPopulation(int populationLimit)
Creates a new ListPopulation instance and initializes its inner chromosome list.
|
ListPopulation(List<Chromosome> chromosomes,
int populationLimit)
Creates a new ListPopulation instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChromosome(Chromosome chromosome)
Add the given chromosome to the population.
|
List<Chromosome> |
getChromosomes()
Access the list of chromosomes.
|
Chromosome |
getFittestChromosome()
Access the fittest chromosome in this population.
|
int |
getPopulationLimit()
Access the maximum population size.
|
int |
getPopulationSize()
Access the current population size.
|
Iterator<Chromosome> |
iterator()
Chromosome list iterator
|
void |
setChromosomes(List<Chromosome> chromosomes)
Sets the list of chromosomes.
|
void |
setPopulationLimit(int populationLimit)
Sets the maximal population size.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitnextGenerationpublic ListPopulation(List<Chromosome> chromosomes, int populationLimit)
chromosomes - list of chromosomes in the populationpopulationLimit - maximal size of the populationNumberIsTooLargeException - if the list of chromosomes exceeds the population limitNotPositiveException - if the population limit is not a positive number (< 1)public ListPopulation(int populationLimit)
populationLimit - maximal size of the populationNotPositiveException - if the population limit is not a positive number (< 1)public void setChromosomes(List<Chromosome> chromosomes)
chromosomes - the list of chromosomespublic List<Chromosome> getChromosomes()
public void addChromosome(Chromosome chromosome)
addChromosome in interface Populationchromosome - the chromosome to add.public Chromosome getFittestChromosome()
getFittestChromosome in interface Populationpublic int getPopulationLimit()
getPopulationLimit in interface Populationpublic void setPopulationLimit(int populationLimit)
populationLimit - maximal population size.public int getPopulationSize()
getPopulationSize in interface Populationpublic Iterator<Chromosome> iterator()
iterator in interface Iterable<Chromosome>Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.