T
- The type of object (usually an NAryTree
) that is evolved
in the genetic algorithmR
- The return type of the algorithm calling, f.i. an NAryTree
itself or a
ParetoFront
of such
trees.public abstract class ETMParamAbstract<R>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected CentralRegistry |
centralRegistry |
protected int |
eliteCount |
protected java.util.List<EvolutionaryOperator<NAryTree>> |
evolutionaryOperators |
protected java.util.List<EvolutionObserver<NAryTree>> |
evolutionObservers |
protected CandidateFactory<NAryTree> |
factory |
protected TreeFitnessAbstract |
fitnessEvaluator |
protected ETMLiveListener.ListernerList<R> |
listeners
A list of listeners that will be notified of the ETMs progress
|
protected int |
logModulo |
protected int |
maxThreads |
protected java.lang.String |
path
If not null then the complete population is written to file for each
generation.
|
protected int |
populationSize |
protected java.util.Random |
rng |
protected java.util.List<NAryTree> |
seed |
protected SelectionStrategy<java.lang.Object> |
selectionStrategy |
protected java.util.List<TerminationCondition> |
terminationConditions |
Constructor and Description |
---|
ETMParamAbstract(CentralRegistry registry,
TreeFitnessAbstract fitnessEvaluator,
java.util.List<EvolutionaryOperator<NAryTree>> evolutionaryOperators,
int populationSize,
int eliteCount)
The most basic constructor for the ETM algorithm.
|
Modifier and Type | Method and Description |
---|---|
void |
addEvolutionObserver(EvolutionObserver<NAryTree> evolutionObserver)
Add an evolution observer to the list of evolution observers that report
about the progress (not really required but should be used to update GUIs
etc.
|
void |
addTerminationCondition(TerminationCondition terminationCondition)
Adds a termination condition to the existing list of termination
conditions that can stop the GA algorithm.
|
ExternalTerminationCondition |
addTerminationConditionExternal() |
void |
addTerminationConditionMaxDuration(long maxDuration)
Terminates the algorithm after a certain amount of time.
|
void |
addTerminationConditionMaxGen(int maxGen)
Adds a new termination condition that stops the algorithm after a maximum
number of generations.
|
nl.tue.astar.AStarThread.Canceller |
addTerminationConditionProMCancellation(org.processmining.framework.plugin.PluginContext context)
Add a termination condition to the ETM algorithm that listens to the ProM
Cancellation button.
|
nl.tue.astar.AStarThread.Canceller |
addTerminationConditionProMCancellation(org.processmining.framework.plugin.Progress progress)
Add a termination condition to the ETM algorithm that listens to the ProM
Cancellation button.
|
void |
addTerminationConditionSteadyState(int steadyStates,
boolean isNatural) |
void |
addTerminationConditionTargetFitness(double targetFitness,
boolean isNatural)
Adds a termination condition that stops the evolution as soon as the
target fitness is reached.
|
static java.util.Random |
createRNG() |
CentralRegistry |
getCentralRegistry() |
int |
getEliteCount() |
java.util.List<EvolutionaryOperator<NAryTree>> |
getEvolutionaryOperators() |
java.util.List<EvolutionObserver<NAryTree>> |
getEvolutionObservers() |
CandidateFactory<NAryTree> |
getFactory() |
TreeFitnessAbstract |
getFitnessEvaluator() |
ETMLiveListener.ListernerList<R> |
getListeners() |
int |
getLogModulo()
After how many generations a new population log should be written to the
logging path.
|
int |
getMaxThreads()
Returns the number of evaluation threads (main processing part) used by
the algorithm.
|
java.lang.String |
getPath() |
int |
getPopulationSize() |
java.util.Random |
getRng() |
java.util.List<NAryTree> |
getSeed() |
SelectionStrategy<java.lang.Object> |
getSelectionStrategy() |
ExternalTerminationCondition |
getTerminationConditionExternal()
Returns the external termination condition, if present, otherwise returns
null
|
java.util.List<TerminationCondition> |
getTerminationConditions() |
TerminationCondition[] |
getTerminationConditionsAsArray()
Returns the
TerminationCondition s as an array as required by the
Watchmaker framework... |
void |
setCentralRegistry(CentralRegistry centralRegistry) |
void |
setEliteCount(int eliteCount) |
void |
setEvolutionaryOperators(java.util.List<EvolutionaryOperator<NAryTree>> evolutionaryOperators) |
void |
setEvolutionObservers(java.util.List<EvolutionObserver<NAryTree>> evolutionObservers) |
void |
setFactory(CandidateFactory<NAryTree> factory) |
void |
setFitnessEvaluator(TreeFitnessAbstract fitnessEvaluator) |
void |
setLogModulo(int logModulo)
Set after how many generations a new population log should be written to
the logging path.
|
void |
setMaxThreads(int maxCores)
Update the maximum number of simultaneous evaluation threads to use.
|
void |
setPath(java.lang.String path) |
void |
setPopulationSize(int populationSize) |
void |
setRng(java.util.Random rng) |
void |
setSeed(java.util.List<NAryTree> seed) |
void |
setSeed(NAryTree[] seed) |
void |
setSelectionStrategy(SelectionStrategy<java.lang.Object> selectionStrategy) |
void |
setTerminationConditions(java.util.List<TerminationCondition> terminationConditions) |
protected java.util.Random rng
protected CentralRegistry centralRegistry
protected java.util.List<TerminationCondition> terminationConditions
protected java.util.List<EvolutionObserver<NAryTree>> evolutionObservers
protected SelectionStrategy<java.lang.Object> selectionStrategy
protected int maxThreads
protected java.util.List<NAryTree> seed
protected int populationSize
protected int eliteCount
protected java.lang.String path
protected java.util.List<EvolutionaryOperator<NAryTree>> evolutionaryOperators
protected TreeFitnessAbstract fitnessEvaluator
protected CandidateFactory<NAryTree> factory
protected int logModulo
protected ETMLiveListener.ListernerList<R> listeners
public ETMParamAbstract(CentralRegistry registry, TreeFitnessAbstract fitnessEvaluator, java.util.List<EvolutionaryOperator<NAryTree>> evolutionaryOperators, int populationSize, int eliteCount)
factory
- TreeFactory to useterminationConditions
- Termination conditions to stop execution (could include
cancellation listener)fitnessEvaluator
- Single evaluator to produce a single fitness value for each
candidate.evolutionaryOperators
- List of evolutionary operators which are ALL applied in each
generation on the non-elite to change them.populationSize
- Number of candidates to consider in each generationeliteCount
- Number of top candidates to maintain unchanged in each
generationpublic void addTerminationConditionMaxGen(int maxGen)
maxGen
- int The maximum number of generationspublic void addTerminationConditionTargetFitness(double targetFitness, boolean isNatural)
TargetFitness
is less than 0 no
condition is added.targetFitness
- double Target fitness to stop at (or over)isNatural
- boolean Whether bigger is better (TRUE) or lower is better
(FALSE)public nl.tue.astar.AStarThread.Canceller addTerminationConditionProMCancellation(org.processmining.framework.plugin.PluginContext context)
context
- The context to get the canceller fromAStarThread.Canceller
object which can be used
in a future Replay Fitness evaluatorpublic nl.tue.astar.AStarThread.Canceller addTerminationConditionProMCancellation(org.processmining.framework.plugin.Progress progress)
progress
- The progress instance to get the canceller fromAStarThread.Canceller
object which can be used
in a future Replay Fitness evaluatorpublic static java.util.Random createRNG()
public java.util.Random getRng()
public void setRng(java.util.Random rng)
rng
- A random number generator. All algorithms should use this one
and not their ownpublic java.util.List<TerminationCondition> getTerminationConditions()
public void setTerminationConditions(java.util.List<TerminationCondition> terminationConditions)
terminationConditions
- A list of termination conditions that can stop the GA
algorithm. One of these should listen to cancellation messages
from the GUI.public void addTerminationCondition(TerminationCondition terminationCondition)
terminationCondition
- public java.util.List<EvolutionObserver<NAryTree>> getEvolutionObservers()
public void setEvolutionObservers(java.util.List<EvolutionObserver<NAryTree>> evolutionObservers)
evolutionLoggers
- The list of evolution observers that report about the progress
(not really required but should be used to update GUIs etc. of
the progress)public void addEvolutionObserver(EvolutionObserver<NAryTree> evolutionObserver)
evolutionObserver
- public SelectionStrategy<java.lang.Object> getSelectionStrategy()
public void setSelectionStrategy(SelectionStrategy<java.lang.Object> selectionStrategy)
selectionStrategy
- The selection strategy to use to select candidates from the
population to mutate.public java.util.List<NAryTree> getSeed()
public void setSeed(java.util.List<NAryTree> seed)
seed
- A list of trees from which the algorithm will start (can be
left empty)public void setSeed(NAryTree[] seed)
seed
- An of trees from which the algorithm will start (can be left
empty)public int getPopulationSize()
public void setPopulationSize(int populationSize)
populationSize
- the populationSize to setpublic int getEliteCount()
public void setEliteCount(int eliteCount)
eliteCount
- the eliteCount to set, the number of candidates to keep
unchanged in a generation. Will be minimally 2 and maximally
the population size - 1.public java.lang.String getPath()
public void setPath(java.lang.String path)
path
- The path to log even more details to than an evolution
observer gets. This contains every tree in every generation
but also some overall statistics. If not null then the
complete population is written to file for each generation. If
the path is not existent or not writable then the algorithm
will not log anything but continues working correctly.public java.util.List<EvolutionaryOperator<NAryTree>> getEvolutionaryOperators()
public void setEvolutionaryOperators(java.util.List<EvolutionaryOperator<NAryTree>> evolutionaryOperators)
evolutionaryOperators
- the evolutionaryOperators through which each tree that will be
changed will go. All evolutionary operators will be applied in
the provided sequence.public TreeFitnessAbstract getFitnessEvaluator()
public void setFitnessEvaluator(TreeFitnessAbstract fitnessEvaluator)
fitnessEvaluator
- The fitness evaluator used to produce a fitness value for the
candidate trees. Although this is a single fitness evaluator,
it might be a wrapper around a collection of evaluators.public void addTerminationConditionSteadyState(int steadyStates, boolean isNatural)
public void addTerminationConditionMaxDuration(long maxDuration)
maxDuration
- Time in milliseconds after which, at the end of a generation,
the algorithm will stop.public ExternalTerminationCondition addTerminationConditionExternal()
public ExternalTerminationCondition getTerminationConditionExternal()
public CentralRegistry getCentralRegistry()
public void setCentralRegistry(CentralRegistry centralRegistry)
centralRegistry
- the centralRegistry to setpublic CandidateFactory<NAryTree> getFactory()
public void setFactory(CandidateFactory<NAryTree> factory)
public int getMaxThreads()
public void setMaxThreads(int maxCores)
maxCores
- the maxCores to setpublic int getLogModulo()
public void setLogModulo(int logModulo)
logModulo
- public ETMLiveListener.ListernerList<R> getListeners()
public TerminationCondition[] getTerminationConditionsAsArray()
TerminationCondition
s as an array as required by the
Watchmaker framework...