Package org.biojavax.ga
Interface GeneticAlgorithm
-
- All Superinterfaces:
Changeable
- All Known Implementing Classes:
AbstractGeneticAlgorithm,SimpleGeneticAlgorithm
public interface GeneticAlgorithm extends Changeable
The class that runs the cycles of reproduction, evolution and selection, potentially on multiplePopulations- Since:
- 1.5
- Version:
- 1.1
- Author:
- Mark Schreiber, Susanne Merz, Andreas Dräger
-
-
Field Summary
Fields Modifier and Type Field Description static ChangeTypeCROSS_OVER_FUNCTIONstatic ChangeTypeFITNESS_FUNCTIONstatic ChangeTypeFUNCTIONstatic ChangeTypeMUTATION_FUNCTIONstatic ChangeTypePOPULATIONstatic ChangeTypeSELECTION_FUNCTION
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CrossOverFunctiongetCrossOverFunction()FitnessFunctiongetFitnessFunction()Returns the fitness function, i.e. the class that computes the fitness of each organism in a population.intgetGeneration()MutationFunctiongetMutationFunction()PopulationgetPopulation()The registeredPopulationSelectionFunctiongetSelectionFunction()voidrun(GAStoppingCriteria stoppingCriteria)Iterates the Algorithm until the stopping criteria are met.voidsetCrossOverFunction(CrossOverFunction function)Changes theCrossOverFunctionused to CrossOver ChromosomesvoidsetFitnessFunction(FitnessFunction func)The fitness function that will be used to compute the fitness of each organism.voidsetMutationFunction(MutationFunction function)Sets the currentMutationFunctionvoidsetPopulation(Population pop)Sets thePopulationofOrganismsto the Algorithm.voidsetSelectionFunction(SelectionFunction function)Changes theSelectionFunctionused to select candidates for the next generation-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Field Detail
-
FITNESS_FUNCTION
static final ChangeType FITNESS_FUNCTION
-
POPULATION
static final ChangeType POPULATION
-
FUNCTION
static final ChangeType FUNCTION
-
CROSS_OVER_FUNCTION
static final ChangeType CROSS_OVER_FUNCTION
-
MUTATION_FUNCTION
static final ChangeType MUTATION_FUNCTION
-
SELECTION_FUNCTION
static final ChangeType SELECTION_FUNCTION
-
-
Method Detail
-
setFitnessFunction
void setFitnessFunction(FitnessFunction func) throws ChangeVetoException
The fitness function that will be used to compute the fitness of each organism.- Parameters:
func- theFitnessFunctionto be used- Throws:
ChangeVetoException- if the change is vetoed.
-
getFitnessFunction
FitnessFunction getFitnessFunction()
Returns the fitness function, i.e. the class that computes the fitness of each organism in a population.- Returns:
- the fitness function
-
setPopulation
void setPopulation(Population pop) throws ChangeVetoException
Sets thePopulationofOrganismsto the Algorithm.- Parameters:
pop- the population to add.- Throws:
ChangeVetoException- if new populations are not allowed.
-
getPopulation
Population getPopulation()
The registeredPopulation- Returns:
- the
Populationbeing operated on.
-
setSelectionFunction
void setSelectionFunction(SelectionFunction function) throws ChangeVetoException
Changes theSelectionFunctionused to select candidates for the next generation- Parameters:
function- aSelectionFunction- Throws:
ChangeVetoException- if theSelectionFunctionis not allowed to be changed
-
getSelectionFunction
SelectionFunction getSelectionFunction()
- Returns:
- the current
SelectionFunction
-
setCrossOverFunction
void setCrossOverFunction(CrossOverFunction function) throws ChangeVetoException
Changes theCrossOverFunctionused to CrossOver Chromosomes- Parameters:
function- aCrossOverFunction- Throws:
ChangeVetoException- if theCrossOverFunctionis not allowed to be changed
-
getCrossOverFunction
CrossOverFunction getCrossOverFunction()
- Returns:
- the current CrossOverFunction
-
setMutationFunction
void setMutationFunction(MutationFunction function) throws ChangeVetoException
Sets the currentMutationFunction- Parameters:
function- aMutationFunction- Throws:
ChangeVetoException- if theMutationFunctionchange is Vetoed by a listener.
-
getMutationFunction
MutationFunction 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.
-
-