org.encog.ml.ea.train.basic
public class BasicEA extends Object implements EvolutionaryAlgorithm, MultiThreadable, EncogShutdownTask, Serializable
| Constructor and Description |
|---|
BasicEA(Population thePopulation,
CalculateScore theScoreFunction)
Construct an EA.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addChild(Genome genome)
Add a child to the next iteration.
|
void |
addOperation(double probability,
EvolutionaryOperator opp)
Add an operation.
|
void |
addScoreAdjuster(AdjustScore scoreAdjust)
Add a score adjuster.
|
void |
calculateScore(Genome g)
Calculate the score for a genome.
|
static void |
calculateScoreAdjustment(Genome genome,
List<AdjustScore> adjusters)
Calculate the score adjustment, based on adjusters.
|
void |
finishTraining()
Called when training is finished.
|
GenomeComparator |
getBestComparator()
Get the comparator that is used to choose the "true best" genome.
|
Genome |
getBestGenome() |
EvolutionaryOperator |
getChampMutation() |
GeneticCODEC |
getCODEC() |
double |
getEliteRate() |
double |
getError() |
int |
getIteration() |
int |
getMaxIndividualSize() |
int |
getMaxOperationErrors() |
int |
getMaxTries() |
Genome |
getOldBestGenome() |
OperationList |
getOperators() |
Population |
getPopulation() |
RandomFactory |
getRandomNumberFactory() |
RuleHolder |
getRules() |
List<AdjustScore> |
getScoreAdjusters() |
CalculateScore |
getScoreFunction() |
SelectionOperator |
getSelection() |
GenomeComparator |
getSelectionComparator()
Get the comparator that is used to choose the "best" genome for
selection, as opposed to the "true best".
|
boolean |
getShouldIgnoreExceptions() |
Speciation |
getSpeciation() |
int |
getThreadCount() |
boolean |
isValidationMode() |
void |
iteration()
Perform a training iteration.
|
void |
performShutdownTask() |
void |
reportError(Throwable t)
Called by a thread to report an error.
|
void |
setBestComparator(GenomeComparator theComparator)
Set the comparator.
|
void |
setChampMutation(EvolutionaryOperator champMutation) |
void |
setCODEC(GeneticCODEC theCodec)
Set the CODEC to use.
|
void |
setEliteRate(double eliteRate) |
void |
setIteration(int iteration)
Set the current iteration number.
|
void |
setMaxOperationErrors(int maxOperationErrors) |
void |
setMaxTries(int maxTries) |
void |
setPopulation(Population thePopulation)
Set the population.
|
void |
setRandomNumberFactory(RandomFactory randomNumberFactory) |
void |
setRules(RuleHolder rules)
Set the rules holder to use.
|
void |
setSelection(SelectionOperator selection)
Set the selection operator.
|
void |
setSelectionComparator(GenomeComparator theComparator)
Set the comparator that is used to choose the "best" genome for
selection, as opposed to the "true best".
|
void |
setShouldIgnoreExceptions(boolean b)
Determines if genetic operator exceptions should be ignored.
|
void |
setSpeciation(Speciation speciation)
Set the speciation method.
|
void |
setThreadCount(int numThreads)
Set the number of threads to use.
|
void |
setValidationMode(boolean validationMode)
Determine if the genomes should be validated.
|
public BasicEA(Population thePopulation, CalculateScore theScoreFunction)
thePopulation - The population.theScoreFunction - The score function.public static void calculateScoreAdjustment(Genome genome, List<AdjustScore> adjusters)
genome - The genome to adjust.adjusters - The score adjusters.public boolean addChild(Genome genome)
genome - The child.public void addOperation(double probability,
EvolutionaryOperator opp)
addOperation in interface EvolutionaryAlgorithmprobability - The probability of using this operator.opp - The operator to add.public void addScoreAdjuster(AdjustScore scoreAdjust)
addScoreAdjuster in interface EvolutionaryAlgorithmscoreAdjust - The score adjustor to add.public void calculateScore(Genome g)
calculateScore in interface EvolutionaryAlgorithmg - The genome to calculate the score for.public void finishTraining()
finishTraining in interface EvolutionaryAlgorithmpublic GenomeComparator getBestComparator()
getBestComparator in interface EvolutionaryAlgorithmpublic Genome getBestGenome()
getBestGenome in interface EvolutionaryAlgorithmpublic EvolutionaryOperator getChampMutation()
public GeneticCODEC getCODEC()
getCODEC in interface EvolutionaryAlgorithmpublic double getEliteRate()
public double getError()
getError in interface EvolutionaryAlgorithmpublic int getIteration()
getIteration in interface EvolutionaryAlgorithmpublic int getMaxIndividualSize()
getMaxIndividualSize in interface EvolutionaryAlgorithmpublic int getMaxTries()
getMaxTries in interface EvolutionaryAlgorithmpublic Genome getOldBestGenome()
public OperationList getOperators()
getOperators in interface EvolutionaryAlgorithmpublic Population getPopulation()
getPopulation in interface EvolutionaryAlgorithmpublic RandomFactory getRandomNumberFactory()
public RuleHolder getRules()
getRules in interface EvolutionaryAlgorithmpublic List<AdjustScore> getScoreAdjusters()
getScoreAdjusters in interface EvolutionaryAlgorithmpublic CalculateScore getScoreFunction()
getScoreFunction in interface EvolutionaryAlgorithmpublic SelectionOperator getSelection()
getSelection in interface EvolutionaryAlgorithmpublic GenomeComparator getSelectionComparator()
getSelectionComparator in interface EvolutionaryAlgorithmpublic boolean getShouldIgnoreExceptions()
getShouldIgnoreExceptions in interface EvolutionaryAlgorithmpublic Speciation getSpeciation()
getSpeciation in interface EvolutionaryAlgorithmpublic int getThreadCount()
getThreadCount in interface MultiThreadablepublic boolean isValidationMode()
isValidationMode in interface EvolutionaryAlgorithmpublic void iteration()
iteration in interface EvolutionaryAlgorithmpublic void performShutdownTask()
performShutdownTask in interface EncogShutdownTaskpublic void reportError(Throwable t)
t - The error reported.public void setBestComparator(GenomeComparator theComparator)
setBestComparator in interface EvolutionaryAlgorithmtheComparator - The comparator.public void setChampMutation(EvolutionaryOperator champMutation)
champMutation - the champMutation to setpublic void setCODEC(GeneticCODEC theCodec)
theCodec - The CODEC to use.public void setEliteRate(double eliteRate)
eliteRate - the eliteRate to setpublic void setIteration(int iteration)
iteration - The iteration number.public void setMaxTries(int maxTries)
maxTries - the maxTries to setpublic void setPopulation(Population thePopulation)
setPopulation in interface EvolutionaryAlgorithmthePopulation - The population.public void setRandomNumberFactory(RandomFactory randomNumberFactory)
randomNumberFactory - the randomNumberFactory to setpublic void setRules(RuleHolder rules)
EvolutionaryAlgorithmsetRules in interface EvolutionaryAlgorithmrules - the rules to setpublic void setSelection(SelectionOperator selection)
setSelection in interface EvolutionaryAlgorithmselection - The selection operator.public void setSelectionComparator(GenomeComparator theComparator)
setSelectionComparator in interface EvolutionaryAlgorithmtheComparator - The selection comparator.public void setShouldIgnoreExceptions(boolean b)
setShouldIgnoreExceptions in interface EvolutionaryAlgorithmb - True if exceptions should be ignored.public void setSpeciation(Speciation speciation)
setSpeciation in interface EvolutionaryAlgorithmspeciation - The speciation method.public void setThreadCount(int numThreads)
setThreadCount in interface MultiThreadablenumThreads - The number of threads to use, or zero to
automatically determine based on core count.public void setValidationMode(boolean validationMode)
setValidationMode in interface EvolutionaryAlgorithmvalidationMode - True, if validation mode is enabled.public int getMaxOperationErrors()
public void setMaxOperationErrors(int maxOperationErrors)
maxOperationErrors - the maxOperationErrors to setCopyright © 2014. All Rights Reserved.