public abstract class ListPopulation extends java.lang.Object implements Population
List
.Constructor and Description |
---|
ListPopulation(int populationLimit)
Creates a new ListPopulation instance and initializes its inner
chromosome list.
|
ListPopulation(java.util.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.
|
java.util.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.
|
java.util.Iterator<Chromosome> |
iterator()
Chromosome list iterator
|
void |
setChromosomes(java.util.List<Chromosome> chromosomes)
Sets the list of chromosomes.
|
void |
setPopulationLimit(int populationLimit)
Sets the maximal population size.
|
java.lang.String |
toString() |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
nextGeneration
public ListPopulation(java.util.List<Chromosome> chromosomes, int populationLimit)
chromosomes
- list of chromosomes in the populationpopulationLimit
- maximal size of the populationpublic ListPopulation(int populationLimit)
populationLimit
- maximal size of the populationpublic void setChromosomes(java.util.List<Chromosome> chromosomes)
chromosomes
- the list of chromosomespublic java.util.List<Chromosome> getChromosomes()
public void addChromosome(Chromosome chromosome)
addChromosome
in interface Population
chromosome
- the chromosome to add.public Chromosome getFittestChromosome()
getFittestChromosome
in interface Population
public int getPopulationLimit()
getPopulationLimit
in interface Population
public void setPopulationLimit(int populationLimit)
populationLimit
- maximal population size.public int getPopulationSize()
getPopulationSize
in interface Population
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Iterator<Chromosome> iterator()
iterator
in interface java.lang.Iterable<Chromosome>
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"