Package org.biojavax.ga
Interface GeneticAlgorithm
- All Superinterfaces:
Changeable
- All Known Implementing Classes:
AbstractGeneticAlgorithm
,SimpleGeneticAlgorithm
The class that runs the cycles of reproduction, evolution and selection,
potentially on multiple
Population
s
- Since:
- 1.5
- Version:
- 1.1
- Author:
- Mark Schreiber, Susanne Merz, Andreas Dräger
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChangeType
static final ChangeType
static final ChangeType
static final ChangeType
static final ChangeType
static final ChangeType
-
Method Summary
Modifier and TypeMethodDescriptionReturns the fitness function, i.e. the class that computes the fitness of each organism in a population.int
The registeredPopulation
void
run
(GAStoppingCriteria stoppingCriteria) Iterates the Algorithm until the stopping criteria are met.void
setCrossOverFunction
(CrossOverFunction function) Changes theCrossOverFunction
used to CrossOver Chromosomesvoid
The fitness function that will be used to compute the fitness of each organism.void
setMutationFunction
(MutationFunction function) Sets the currentMutationFunction
void
setPopulation
(Population pop) Sets thePopulation
ofOrganisms
to the Algorithm.void
setSelectionFunction
(SelectionFunction function) Changes theSelectionFunction
used to select candidates for the next generationMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
FITNESS_FUNCTION
-
POPULATION
-
FUNCTION
-
CROSS_OVER_FUNCTION
-
MUTATION_FUNCTION
-
SELECTION_FUNCTION
-
-
Method Details
-
setFitnessFunction
The fitness function that will be used to compute the fitness of each organism.- Parameters:
func
- theFitnessFunction
to be used- Throws:
ChangeVetoException
- if the change is vetoed.
-
getFitnessFunction
Returns the fitness function, i.e. the class that computes the fitness of each organism in a population.- Returns:
- the fitness function
-
setPopulation
Sets thePopulation
ofOrganisms
to the Algorithm.- Parameters:
pop
- the population to add.- Throws:
ChangeVetoException
- if new populations are not allowed.
-
getPopulation
The registeredPopulation
- Returns:
- the
Population
being operated on.
-
setSelectionFunction
Changes theSelectionFunction
used to select candidates for the next generation- Parameters:
function
- aSelectionFunction
- Throws:
ChangeVetoException
- if theSelectionFunction
is not allowed to be changed
-
getSelectionFunction
- Returns:
- the current
SelectionFunction
-
setCrossOverFunction
Changes theCrossOverFunction
used to CrossOver Chromosomes- Parameters:
function
- aCrossOverFunction
- Throws:
ChangeVetoException
- if theCrossOverFunction
is not allowed to be changed
-
getCrossOverFunction
- Returns:
- the current CrossOverFunction
-
setMutationFunction
Sets the currentMutationFunction
- Parameters:
function
- aMutationFunction
- Throws:
ChangeVetoException
- if theMutationFunction
change is Vetoed by a listener.
-
getMutationFunction
- Returns:
- the current
MutationFunction
-
getGeneration
int getGeneration()- Returns:
- the Current generation number
-
run
void run(GAStoppingCriteria stoppingCriteria) throws ChangeVetoException, IllegalAlphabetException, IllegalSymbolException 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 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.
-