org.jgap
Class Population

java.lang.Object
  extended byorg.jgap.Population

public class Population
extends java.lang.Object

List of chromosomes held in the Genotype (or possibly later in the Configuration object

Since:
2.0
Author:
Klaus Meffert

Constructor Summary
Population()
           
Population(Chromosome[] chromosomes)
           
Population(int size)
           
 
Method Summary
 void addChromosome(Chromosome toAdd)
          Adds a Chromosome to this Population.
 void addChromosomes(Population a_population)
          Adds all the Chromosomes in the given Population.
 Chromosome determineFittestChromosome()
          Determines the fittest Chromosome in the population (the one with the highest fitness value) and memorizes it
 Chromosome getChromosome(int index)
          Returns a Chromosome at given index in the Population
 java.util.List getChromosomes()
           
 java.util.Iterator iterator()
           
 void setChromosome(int index, Chromosome a_chromosome)
          Sets in the given Chromosome on the given index in the list of chromosomes
 void setChromosomes(java.util.List a_chromosomes)
           
 int size()
           
 Chromosome[] toChromosomes()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Population

public Population(Chromosome[] chromosomes)

Population

public Population(int size)

Population

public Population()
Method Detail

addChromosome

public void addChromosome(Chromosome toAdd)
Adds a Chromosome to this Population. Does nothing when given null.

Parameters:
toAdd - the Chromosome to add
Since:
2.0

addChromosomes

public void addChromosomes(Population a_population)
Adds all the Chromosomes in the given Population. Does nothing on null or an empty Population.

Parameters:
a_population - the Population to add
Since:
2.0

setChromosomes

public void setChromosomes(java.util.List a_chromosomes)

setChromosome

public void setChromosome(int index,
                          Chromosome a_chromosome)
Sets in the given Chromosome on the given index in the list of chromosomes

Parameters:
index - the index to set the Chromosome in
a_chromosome - the Chromosome to be set in
Since:
2.0

getChromosomes

public java.util.List getChromosomes()
Returns:
the list of Chromosome's in the Population
Since:
2.0

getChromosome

public Chromosome getChromosome(int index)
Returns a Chromosome at given index in the Population

Parameters:
index - the index of the Chromosome to be returned
Returns:
Chromosome at given index in the Population
Since:
2.0

size

public int size()
Returns:
number of Chromosome's in the Population
Since:
2.0

iterator

public java.util.Iterator iterator()
Returns:
Iterator for the Chromosome list in the Population
Since:
2.0

toChromosomes

public Chromosome[] toChromosomes()
Returns:
the Population converted into a list of Chromosome's
Since:
2.0

determineFittestChromosome

public Chromosome determineFittestChromosome()
Determines the fittest Chromosome in the population (the one with the highest fitness value) and memorizes it

Returns:
the fittest Chromosome of the population
Since:
2.0