public class TreeMutationCoordinator extends java.lang.Object implements EvolutionaryOperator<NAryTree>
Node
s.Modifier and Type | Field and Description |
---|---|
protected int |
locationOfLastChange |
protected NAryTreeHistory.TypesOfChange |
typeOfChange |
Constructor and Description |
---|
TreeMutationCoordinator(java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> mutators,
boolean preventDuplicates)
The tree mutation operator requires a map of mutators, with weights
assigned to them, to select which one to apply.
|
Modifier and Type | Method and Description |
---|---|
void |
addMutator(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> |
getMutators() |
boolean |
isPreventDuplicates() |
void |
setPreventDuplicates(boolean preventDuplicates) |
protected int locationOfLastChange
protected NAryTreeHistory.TypesOfChange typeOfChange
public TreeMutationCoordinator(java.util.LinkedHashMap<TreeMutationAbstract,java.lang.Double> mutators, boolean preventDuplicates)
mutators
- public 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> getMutators()
public void addMutator(TreeMutationAbstract mutator, java.lang.Double chance)
public boolean isPreventDuplicates()
public void setPreventDuplicates(boolean preventDuplicates)