Package 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
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
-
Field Summary
Fields inherited from class org.biojavax.ga.impl.AbstractGeneticAlgorithm
populationFields inherited from interface org.biojavax.ga.GeneticAlgorithm
CROSS_OVER_FUNCTION, FITNESS_FUNCTION, FUNCTION, MUTATION_FUNCTION, POPULATION, SELECTION_FUNCTION -
Constructor Summary
ConstructorsConstructorDescriptionSimpleGeneticAlgorithm(Population pop, MutationFunction mutFunc, CrossOverFunction xFunc, SelectionFunction selFunc) -
Method Summary
Modifier and TypeMethodDescriptionGet a List containing details of all the cross over events during the run.intThe current generationvoidrun(GAStoppingCriteria stoppingCriteria) Iterates the Algorithm until the stopping criteria are met.Methods inherited from class org.biojavax.ga.impl.AbstractGeneticAlgorithm
getCrossOverFunction, getFitnessFunction, getMutationFunction, getPopulation, getSelectionFunction, initPopulation, setCrossOverFunction, setFitnessFunction, setMutationFunction, setPopulation, setSelectionFunctionMethods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Constructor Details
-
SimpleGeneticAlgorithm
public SimpleGeneticAlgorithm() -
SimpleGeneticAlgorithm
public SimpleGeneticAlgorithm(Population pop, MutationFunction mutFunc, CrossOverFunction xFunc, SelectionFunction selFunc)
-
-
Method Details
-
getGeneration
The current generation- Returns:
- an int giving the generation number
-
getCrossResults
Get a List containing details of all the cross over events during the run. Ifrun(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
Listof GACrossResult objects.
-
run
public void run(GAStoppingCriteria stoppingCriteria) throws ChangeVetoException, IllegalAlphabetException, IllegalSymbolException Description copied from interface:GeneticAlgorithmIterates 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 lockedIllegalAlphabetException- 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.
-