org.encog.ml.ea.train
Interface EvolutionaryAlgorithm
-
- All Known Implementing Classes:
- BasicEA, MLMethodGeneticAlgorithm.MLMethodGeneticAlgorithmHelper, TrainEA
public interface EvolutionaryAlgorithmThis interface defines the basic functionality of an Evolutionary Algorithm. An evolutionary algorithm is one that applies operations to a population of potential "solutions".
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description voidaddOperation(double probability, EvolutionaryOperator opp)Add an operation.voidaddScoreAdjuster(AdjustScore scoreAdjust)Add a score adjuster.voidcalculateScore(Genome g)Calculate the score for a genome.voidfinishTraining()Called when training is finished.GenomeComparatorgetBestComparator()Get the comparator that is used to choose the "true best" genome.GenomegetBestGenome()GeneticCODECgetCODEC()doublegetError()intgetIteration()intgetMaxIndividualSize()intgetMaxTries()OperationListgetOperators()PopulationgetPopulation()java.util.List<AdjustScore>getScoreAdjusters()CalculateScoregetScoreFunction()SelectionOperatorgetSelection()GenomeComparatorgetSelectionComparator()Get the comparator that is used to choose the "best" genome for selection, as opposed to the "true best".booleangetShouldIgnoreExceptions()SpeciationgetSpeciation()booleanisValidationMode()voiditeration()Perform a training iteration.voidsetBestComparator(GenomeComparator bestComparator)Set the comparator that is used to choose the "true best" genome.voidsetPopulation(Population thePopulation)Set the population.voidsetSelection(SelectionOperator selection)Set the selection operator.voidsetSelectionComparator(GenomeComparator selectionComparator)Set the comparator that is used to choose the "best" genome for selection, as opposed to the "true best".voidsetShouldIgnoreExceptions(boolean b)Determines if genetic operator exceptions should be ignored.voidsetSpeciation(Speciation m)Set the speciation method.voidsetValidationMode(boolean validationMode)Determine if the genomes should be validated.
-
-
-
Method Detail
-
addOperation
void addOperation(double probability, EvolutionaryOperator opp)Add an operation.- Parameters:
probability- The probability of using this operator.opp- The operator to add.
-
addScoreAdjuster
void addScoreAdjuster(AdjustScore scoreAdjust)
Add a score adjuster. Score adjusters are used to adjust the adjusted score of a genome. This allows bonuses and penalties to be applied for desirable or undesirable traits.- Parameters:
scoreAdjust- The score adjustor to add.
-
calculateScore
void calculateScore(Genome g)
Calculate the score for a genome.- Parameters:
g- The genome to calculate the score for.
-
finishTraining
void finishTraining()
Called when training is finished. This allows the EA to properly shut down.
-
getBestComparator
GenomeComparator getBestComparator()
Get the comparator that is used to choose the "true best" genome. This uses the real score, and not the adjusted score.- Returns:
- The best comparator.
-
getBestGenome
Genome getBestGenome()
- Returns:
- The current best genome. This genome is safe to use while the EA is running. Genomes are not modified. They simply produce "offspring".
-
getCODEC
GeneticCODEC getCODEC()
- Returns:
- The CODEC that is used to transform between genome and phenome.
-
getError
double getError()
- Returns:
- The current score. This value should either be minimized or maximized, depending on the score function.
-
getIteration
int getIteration()
- Returns:
- The current iteration number. Also sometimes referred to as generation or epoch.
-
getMaxIndividualSize
int getMaxIndividualSize()
- Returns:
- The maximum size an individual genome can be. This is an arbitrary number defined by the genome. Lower numbers are less complex.
-
getMaxTries
int getMaxTries()
- Returns:
- The maximum number to try certain genetic operations. This prevents endless loops.
-
getOperators
OperationList getOperators()
- Returns:
- The operators.
-
getPopulation
Population getPopulation()
- Returns:
- The population.
-
getScoreAdjusters
java.util.List<AdjustScore> getScoreAdjusters()
- Returns:
- The score adjusters. This allows bonuses and penalties to be applied for desirable or undesirable traits.
-
getScoreFunction
CalculateScore getScoreFunction()
- Returns:
- The score function.
-
getSelection
SelectionOperator getSelection()
- Returns:
- The selection operator. Used to choose genomes.
-
getSelectionComparator
GenomeComparator getSelectionComparator()
Get the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.- Returns:
- The selection comparator.
-
getShouldIgnoreExceptions
boolean getShouldIgnoreExceptions()
- Returns:
- True if exceptions that occur during genetic operations should be ignored.
-
getSpeciation
Speciation getSpeciation()
- Returns:
- The speciation method.
-
isValidationMode
boolean isValidationMode()
- Returns:
- True if any genome validators should be applied.
-
iteration
void iteration()
Perform a training iteration. Also called generations or epochs.
-
setBestComparator
void setBestComparator(GenomeComparator bestComparator)
Set the comparator that is used to choose the "true best" genome. This uses the real score, and not the adjusted score.- Parameters:
bestComparator- The best comparator.
-
setPopulation
void setPopulation(Population thePopulation)
Set the population.- Parameters:
thePopulation- The population.
-
setSelection
void setSelection(SelectionOperator selection)
Set the selection operator.- Parameters:
selection- The selection operator.
-
setSelectionComparator
void setSelectionComparator(GenomeComparator selectionComparator)
Set the comparator that is used to choose the "best" genome for selection, as opposed to the "true best". This uses the adjusted score, and not the score.- Parameters:
selectionComparator- The selection comparator.
-
setShouldIgnoreExceptions
void setShouldIgnoreExceptions(boolean b)
Determines if genetic operator exceptions should be ignored.- Parameters:
b- True if exceptions should be ignored.
-
setSpeciation
void setSpeciation(Speciation m)
Set the speciation method.- Parameters:
m- The speciation method.
-
setValidationMode
void setValidationMode(boolean validationMode)
Determine if the genomes should be validated. This takes more time but can help isolate a problem.- Parameters:
validationMode- True, if validation mode is enabled.
-
-
DMelt 3.0 © DataMelt by jWork.ORG