jaga.evolve
Class StandardEvolver

java.lang.Object
  |
  +--jaga.evolve.StandardEvolver
All Implemented Interfaces:
Evolver, java.io.Serializable

public class StandardEvolver
extends java.lang.Object
implements Evolver

A Generational GA with fixed length genotype, fixed size population implementation of the Evolver.

See Also:
Serialized Form

Constructor Summary
StandardEvolver(int populationSize, int initialGenotypeLength, GeneticOperator[] operators, double[] operatorProbabilities, Selector selector, int numOfElites)
          Creates a StandardEvolver.
StandardEvolver(int populationSize, int initialGenotypeLength, GeneticOperator[] operators, double[] operatorProbabilities, Selector selector, int numOfElites, Genotype[] seeds)
          Creates a StandardEvolver.
 
Method Summary
 void evolve()
          runs the evolution process on the population performing: selection, recombination & mutation and elitism
 int getGenerations()
          returns an int whose value is the number of times the evolve() method was called after the latest poolOfMud() call.
 Genotype getGenotype(int i)
          gets the genotype at index i in the population
 Population getPopulation()
          returns current generation (never called during evolve)
 int getPopulationSize()
          returns the size of the population this Evolver deals with.
 void insertGenotype(Genotype g)
          inserts this genotype into the current population.
 Genotype pickGenotype()
          uses the evolver's selector to pick a genotype from the population (probably the previous generation, not from one currently evolving)
 void poolOfMud()
          Creates the initial random individuals by: 1) Getting a decent randoizer 2) generating [populationSize] random BitSets of length [initialGenotypeLength]
 void setPopulation(Population pop)
          Sets this evolvers current generation population to this one.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardEvolver

public StandardEvolver(int populationSize,
                       int initialGenotypeLength,
                       GeneticOperator[] operators,
                       double[] operatorProbabilities,
                       Selector selector,
                       int numOfElites)
Creates a StandardEvolver.
Parameters:
initialGenotypeLength - the length of genotypes created in the pool of mud. These may drift from then on if genetic operators that change size are used.
operators - array of GeneticOperator objects to be used.
operatorProbabilities - the probability with which each individual should reproduce using each of these operators - same array order.

StandardEvolver

public StandardEvolver(int populationSize,
                       int initialGenotypeLength,
                       GeneticOperator[] operators,
                       double[] operatorProbabilities,
                       Selector selector,
                       int numOfElites,
                       Genotype[] seeds)
Creates a StandardEvolver.
Parameters:
initialGenotypeLength - the length of genotypes handled in this evolver.
operators - array of GeneticOperator objects to be used.
operatorProbabilities - the probability with which each individual should reproduce using each of these operators - same array order.
seeds - Genotypes to be inserted into the initial population.
Method Detail

poolOfMud

public void poolOfMud()
Creates the initial random individuals by: 1) Getting a decent randoizer 2) generating [populationSize] random BitSets of length [initialGenotypeLength]
Specified by:
poolOfMud in interface Evolver

evolve

public void evolve()
runs the evolution process on the population performing: selection, recombination & mutation and elitism
Specified by:
evolve in interface Evolver

getPopulationSize

public int getPopulationSize()
Description copied from interface: Evolver
returns the size of the population this Evolver deals with.
Specified by:
getPopulationSize in interface Evolver

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

pickGenotype

public Genotype pickGenotype()
Description copied from interface: Evolver
uses the evolver's selector to pick a genotype from the population (probably the previous generation, not from one currently evolving)
Specified by:
pickGenotype in interface Evolver

getPopulation

public Population getPopulation()
returns current generation (never called during evolve)
Specified by:
getPopulation in interface Evolver

getGenerations

public int getGenerations()
returns an int whose value is the number of times the evolve() method was called after the latest poolOfMud() call.
Specified by:
getGenerations in interface Evolver

getGenotype

public Genotype getGenotype(int i)
gets the genotype at index i in the population
Specified by:
getGenotype in interface Evolver

insertGenotype

public void insertGenotype(Genotype g)
inserts this genotype into the current population. In this case it'll insert it at the beginning because it knows elites are at the end.
Specified by:
insertGenotype in interface Evolver

setPopulation

public void setPopulation(Population pop)
Sets this evolvers current generation population to this one.
Specified by:
setPopulation in interface Evolver