anthill.genie.impl
Class GeneticFrameworkImpl

java.lang.Object
  |
  +--anthill.util.Printable
        |
        +--anthill.genie.impl.GeneticFrameworkImpl
All Implemented Interfaces:
GeneticFramework

public class GeneticFrameworkImpl
extends Printable
implements GeneticFramework

Basic implementation of the GeneticFramework interface.

Version:
$Revision$
Author:
Alberto Montresor

Field Summary
protected  GeneticCode bestCode
          Fittest genetic code
protected  double bestFitness
           
protected  double cullRate
          Percentage deemed unfit for reproduction
protected  double eliteRate
          Percentage of population carried forward unchanged from each generation
protected  Factory factory
          Factory used to instantiate objects
protected  int generations
          Number of generations to be computed
protected  double mutRate
          Mutation rate
protected  int numcodes
          Number of genetic codes constituting the population
protected  int numgenes
          Number of genes (bit sequences) constituting a genetic code
protected  gajit.Population people
          Population of evolved genetic codes
protected  int sizegenes
          Size of a single gene
 
Constructor Summary
GeneticFrameworkImpl(Factory factory, int numcodes, int numgenes, int sizegenes, double mutRate, double eliteRate, double cullRate, int generations)
          Instantiates a new genetic framework
 
Method Summary
 void evolve()
          Tries to evolve a population of genetic codes, using the configuration parameters contained in this instance.
 GeneticCode getFittest()
          Return the genetic code with the best fitness.
 gajit.Population getPopulation()
          Return the population of evolved genetic codes.
 
Methods inherited from class anthill.util.Printable
toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

protected Factory factory
Factory used to instantiate objects

numcodes

protected int numcodes
Number of genetic codes constituting the population

numgenes

protected int numgenes
Number of genes (bit sequences) constituting a genetic code

sizegenes

protected int sizegenes
Size of a single gene

mutRate

protected double mutRate
Mutation rate

eliteRate

protected double eliteRate
Percentage of population carried forward unchanged from each generation

cullRate

protected double cullRate
Percentage deemed unfit for reproduction

generations

protected int generations
Number of generations to be computed

people

protected gajit.Population people
Population of evolved genetic codes

bestCode

protected GeneticCode bestCode
Fittest genetic code

bestFitness

protected double bestFitness
Constructor Detail

GeneticFrameworkImpl

public GeneticFrameworkImpl(Factory factory,
                            int numcodes,
                            int numgenes,
                            int sizegenes,
                            double mutRate,
                            double eliteRate,
                            double cullRate,
                            int generations)
Instantiates a new genetic framework
Method Detail

evolve

public void evolve()
Tries to evolve a population of genetic codes, using the configuration parameters contained in this instance.
Specified by:
evolve in interface GeneticFramework
Parameters:
out - print stream used to log information about the evolution; if print stream is null, no log file is generated.

getPopulation

public gajit.Population getPopulation()
Return the population of evolved genetic codes.
Specified by:
getPopulation in interface GeneticFramework

getFittest

public GeneticCode getFittest()
Return the genetic code with the best fitness.
Specified by:
getFittest in interface GeneticFramework