org.biojavax.ga.impl
Class AbstractGeneticAlgorithm

java.lang.Object
  extended by org.biojava.utils.AbstractChangeable
      extended by org.biojavax.ga.impl.AbstractGeneticAlgorithm
All Implemented Interfaces:
Changeable, GeneticAlgorithm
Direct Known Subclasses:
SimpleGeneticAlgorithm

public abstract class AbstractGeneticAlgorithm
extends AbstractChangeable
implements GeneticAlgorithm

Base class from which most implementations of GeneticAlgorithm will inherit.

Since:
1.5
Version:
1.0
Author:
Mark Schreiber

Field Summary
protected  Population population
           
 
Fields inherited from interface org.biojavax.ga.GeneticAlgorithm
CROSS_OVER_FUNCTION, FUNCTION, MUTATION_FUNCTION, POPULATION, SELECTION_FUNCTION
 
Constructor Summary
protected AbstractGeneticAlgorithm()
           
 
Method Summary
 CrossOverFunction getCrossOverFunction()
           
 MutationFunction getMutationFunction()
           
 Population getPopulation()
          The registered Population
 SelectionFunction getSelectionFunction()
           
 void setCrossOverFunction(CrossOverFunction function)
          Changes the CrossOverFunction used to CrossOver Chromosomes
 void setMutationFunction(MutationFunction function)
          Sets the current MutationFunction
 void setPopulation(Population pop)
          Sets the Population of Organisms to the Algorithm.
 void setSelectionFunction(SelectionFunction function)
          Changes the SelectionFunction used to select candidates for the next generation
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojavax.ga.GeneticAlgorithm
getGeneration, run
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Field Detail

population

protected Population population
Constructor Detail

AbstractGeneticAlgorithm

protected AbstractGeneticAlgorithm()
Method Detail

setPopulation

public final void setPopulation(Population pop)
                         throws ChangeVetoException
Description copied from interface: GeneticAlgorithm
Sets the Population of Organisms to the Algorithm.

Specified by:
setPopulation in interface GeneticAlgorithm
Parameters:
pop - the population to add.
Throws:
ChangeVetoException - if new populations are not allowed.

getPopulation

public final Population getPopulation()
Description copied from interface: GeneticAlgorithm
The registered Population

Specified by:
getPopulation in interface GeneticAlgorithm
Returns:
the Population being operated on.

setSelectionFunction

public final void setSelectionFunction(SelectionFunction function)
                                throws ChangeVetoException
Description copied from interface: GeneticAlgorithm
Changes the SelectionFunction used to select candidates for the next generation

Specified by:
setSelectionFunction in interface GeneticAlgorithm
Parameters:
function - a SelectionFunction
Throws:
ChangeVetoException - if the SelectionFunction is not allowed to be changed

getSelectionFunction

public final SelectionFunction getSelectionFunction()
Specified by:
getSelectionFunction in interface GeneticAlgorithm
Returns:
the current SelectionFunction

setCrossOverFunction

public final void setCrossOverFunction(CrossOverFunction function)
                                throws ChangeVetoException
Description copied from interface: GeneticAlgorithm
Changes the CrossOverFunction used to CrossOver Chromosomes

Specified by:
setCrossOverFunction in interface GeneticAlgorithm
Parameters:
function - a CrossOverFunction
Throws:
ChangeVetoException - if the CrossOverFunction is not allowed to be changed

getCrossOverFunction

public final CrossOverFunction getCrossOverFunction()
Specified by:
getCrossOverFunction in interface GeneticAlgorithm
Returns:
the current CrossOverFunction

setMutationFunction

public final void setMutationFunction(MutationFunction function)
                               throws ChangeVetoException
Description copied from interface: GeneticAlgorithm
Sets the current MutationFunction

Specified by:
setMutationFunction in interface GeneticAlgorithm
Parameters:
function - a MutationFunction
Throws:
ChangeVetoException - if the MutationFunction change is Vetoed by a listener.

getMutationFunction

public final MutationFunction getMutationFunction()
Specified by:
getMutationFunction in interface GeneticAlgorithm
Returns:
the current MutationFunction