evolution
Class Population

java.lang.Object
  extended by evolution.Population
All Implemented Interfaces:
java.lang.Cloneable

public class Population
extends java.lang.Object
implements java.lang.Cloneable

Population which is a set of chromosomes


Constructor Summary
Population()
          Create new instance of population.
 
Method Summary
 void addChromosome(ChromosomeModel tempChromosome)
          Add chromosome to the population at the end.
 java.lang.Object clone()
          Create and return copy of population
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this network.
 ChromosomeModel getBestChromosome()
          Return reference to chromosome with best fitness function value
 ChromosomeModel getChromosome(int index)
          Return reference to chromosome specified by index
 int getChromosomeSize()
          Return size of chromosome
 int getPopulationSize()
          Return population size
 void removeAllChromosome()
          Clear population.
 void removeChromosome(int index)
          Remove chromosome specified by index.
 void replaceChromosome(int index, ChromosomeModel tempChromosome)
          Replece chromosome specified by index by chromosome
 java.lang.String toString()
          Return String representation of population
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Population

public Population()
Create new instance of population. Population size is set to 0

Method Detail

getPopulationSize

public int getPopulationSize()
Return population size

Returns:
population size

getChromosomeSize

public int getChromosomeSize()
Return size of chromosome

Returns:
size of chromosome

toString

public java.lang.String toString()
Return String representation of population

Overrides:
toString in class java.lang.Object
Returns:
Strin representation of population

getChromosome

public ChromosomeModel getChromosome(int index)
Return reference to chromosome specified by index

Parameters:
index - chromosome index
Returns:
reference to chromosome

addChromosome

public void addChromosome(ChromosomeModel tempChromosome)
Add chromosome to the population at the end. Population size increments

Parameters:
tempChromosome - Reference to chromosome

removeAllChromosome

public void removeAllChromosome()
Clear population. Population size is set to 0


removeChromosome

public void removeChromosome(int index)
Remove chromosome specified by index. Population size is decrease.

Parameters:
index - index of the chromosome

replaceChromosome

public void replaceChromosome(int index,
                              ChromosomeModel tempChromosome)
Replece chromosome specified by index by chromosome

Parameters:
index - chromosome which must by replace
tempChromosome - reference to new chromosome

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this network.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object to compare with
Returns:
true if this chromosome is the same as the obj argument; false otherwise

getBestChromosome

public ChromosomeModel getBestChromosome()
Return reference to chromosome with best fitness function value

Returns:
reference to chromosome

clone

public java.lang.Object clone()
Create and return copy of population

Overrides:
clone in class java.lang.Object
Returns:
copy of the population