public final class SimpleGeneticAlgorithm extends AbstractGeneticAlgorithm
GeneticAlgorithm
interface it
is not intended that this class be overidden, hence it is final. It is much
better to overide AbstractGeneticAlgorithm
.population
CROSS_OVER_FUNCTION, FITNESS_FUNCTION, FUNCTION, MUTATION_FUNCTION, POPULATION, SELECTION_FUNCTION
Constructor and Description |
---|
SimpleGeneticAlgorithm() |
SimpleGeneticAlgorithm(Population pop,
MutationFunction mutFunc,
CrossOverFunction xFunc,
SelectionFunction selFunc) |
Modifier and Type | Method and Description |
---|---|
List |
getCrossResults()
Get a List containing details of all the cross over events during the run.
|
int |
getGeneration()
The current generation
|
void |
run(GAStoppingCriteria stoppingCriteria)
Iterates the Algorithm until the stopping criteria are met.
|
getCrossOverFunction, getFitnessFunction, getMutationFunction, getPopulation, getSelectionFunction, initPopulation, setCrossOverFunction, setFitnessFunction, setMutationFunction, setPopulation, setSelectionFunction
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
public SimpleGeneticAlgorithm()
public SimpleGeneticAlgorithm(Population pop, MutationFunction mutFunc, CrossOverFunction xFunc, SelectionFunction selFunc)
public int getGeneration()
public List getCrossResults()
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.List
of GACrossResult objects.public void run(GAStoppingCriteria stoppingCriteria) throws ChangeVetoException, IllegalAlphabetException, IllegalSymbolException
GeneticAlgorithm
stoppingCriteria
- determines when to stop.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.Copyright © 2014 BioJava. All rights reserved.