jaga.evolve
Class Population
java.lang.Object
|
+--jaga.evolve.Population
- All Implemented Interfaces:
- java.io.Serializable
- public class Population
- extends java.lang.Object
- implements java.io.Serializable
A collection of genotypes.
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
POP_DECL
public static final java.lang.String POP_DECL
GEN_DECL
public static final java.lang.String GEN_DECL
IND_DECL
public static final java.lang.String IND_DECL
Population
public Population()
- Creates new Population
Population
public Population(int genNr)
getGenotype
public Genotype getGenotype(int idx)
add
public void add(Genotype g)
addRandom
public void addRandom(Genotype g)
size
public int size()
getPopVector
public java.util.Vector getPopVector()
- Should return clone of genotypes, or
return new Vector( genotypes );
findFittest
public int[] findFittest(int howMany)
- finds the fittest individuals of the population
- Parameters:
howMany
- of the fittest to return- Returns:
- an array of their positions in the population array
(made public static to test)
getFittest
public Genotype[] getFittest(int howMany)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
insertGenotype
public void insertGenotype(Genotype g)
- Replaces first individual in pop by g. Good to put migrators in when
population unsorted.
sort
public void sort()
getGeneration
public int getGeneration()
getAvgFitness
public double getAvgFitness()
readFromFile
public void readFromFile(java.lang.String fileName)