org.biojavax.ga.impl
Class SimpleGeneticAlgorithm
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.ga.impl.AbstractGeneticAlgorithm
org.biojavax.ga.impl.SimpleGeneticAlgorithm
- All Implemented Interfaces:
- Changeable, GeneticAlgorithm
public final class SimpleGeneticAlgorithm
- extends AbstractGeneticAlgorithm
A simple implementation of the GeneticAlgorithm
interface it
is not intended that this class be overidden, hence it is final. It is much
better to overide AbstractGeneticAlgorithm
.
- Since:
- 1.5
- Version:
- 1.1
- Author:
- Mark Schreiber, Susanne Merz, Andreas Dräger
Methods inherited from class org.biojavax.ga.impl.AbstractGeneticAlgorithm |
getCrossOverFunction, getFitnessFunction, getMutationFunction, getPopulation, getSelectionFunction, initPopulation, setCrossOverFunction, setFitnessFunction, setMutationFunction, setPopulation, setSelectionFunction |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SimpleGeneticAlgorithm
public SimpleGeneticAlgorithm()
SimpleGeneticAlgorithm
public SimpleGeneticAlgorithm(Population pop,
MutationFunction mutFunc,
CrossOverFunction xFunc,
SelectionFunction selFunc)
getGeneration
public int getGeneration()
- The current generation
- Returns:
- an int giving the generation number
getCrossResults
public List getCrossResults()
- Get a List containing details of all the cross over events during the run.
If
run(GAStoppingCriteria stoppingCriteria) has not yet been called
the list will be empty
.
This implementation only stores a buffer of the last 100 crosses for memory
reasons.
- Returns:
- a
List
of GACrossResult objects.
run
public void run(GAStoppingCriteria stoppingCriteria)
throws ChangeVetoException,
IllegalAlphabetException,
IllegalSymbolException
- Description copied from interface:
GeneticAlgorithm
- Iterates the Algorithm until the stopping criteria are met. For saftey
implementations should synchronize on this method.
- Parameters:
stoppingCriteria
- determines when to stop.
- Throws:
ChangeVetoException
- if the Population being modified is locked
IllegalAlphabetException
- if the MutationFunction chosen attempts to modify a Symbol from
one of the Chromosomes to a Symbol outside of its Alphabet.
IllegalSymbolException
- if the MutationFunction chosen is using the wrong Alphabet.