public class GuidedTreeMutationCoordinator extends java.lang.Object implements EvolutionaryOperator<NAryTree>
Node
s.Constructor and Description |
---|
GuidedTreeMutationCoordinator(CentralRegistry registry,
double chanceOfRandomMutation,
boolean preventDuplicates,
java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> smartMutators,
TreeMutationCoordinator dumbCoordinator)
Instantiates a new Guided mutation coordinator that selects trees to
mutate and applies one of a given set of (weighted) mutators.
|
Modifier and Type | Method and Description |
---|---|
void |
addSmartMutator(TreeMutationAbstract mutator,
java.lang.Double chance) |
java.util.List<NAryTree> |
apply(java.util.List<NAryTree> selectedCandidates,
java.util.Random rng)
Applies mutation functions to the tree, depending on the tree's fitness
characteristics and the provided probabilities
|
NAryTree |
apply(NAryTree tree,
java.util.Random rng)
Applies mutation functions to the tree, depending on the tree's fitness
characteristics and the provided probabilities
|
java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> |
getSmartMutators() |
boolean |
isPreventDuplicates() |
void |
setPreventDuplicates(boolean allowDuplicates) |
public GuidedTreeMutationCoordinator(CentralRegistry registry, double chanceOfRandomMutation, boolean preventDuplicates, java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> smartMutators, TreeMutationCoordinator dumbCoordinator)
registry
- The central registry to use for general informationchanceOfRandomMutation
- Chance of applying one of the random mutatorspreventDuplicates
- Boolean that indicates whether to keep mutating until a tree
is discovered that is not already in the current population
(TRUE) or whether duplicate trees are allowed (FALSE)smartMutators
- Map with smart/guided mutators and their relative
weight/chance of applicationdumbCoordinator
- Map with dumb/random mutators and their relative weight/chance
of applicationpublic java.util.List<NAryTree> apply(java.util.List<NAryTree> selectedCandidates, java.util.Random rng)
apply
in interface EvolutionaryOperator<NAryTree>
selectedCandidates
- The individuals to evolve.rng
- A source of randomness for stochastic operators (most
operators will be stochastic).public NAryTree apply(NAryTree tree, java.util.Random rng)
public java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> getSmartMutators()
public void addSmartMutator(TreeMutationAbstract mutator, java.lang.Double chance)
public boolean isPreventDuplicates()
public void setPreventDuplicates(boolean allowDuplicates)