public class TreeFactoryCoordinator extends AbstractCandidateFactory<NAryTree>
CandidateFactory
for generating trees of NAryTree
s for the genetic programming example
application. Options are to randomly generate trees but also some predefined
structures are available.Modifier and Type | Field and Description |
---|---|
protected CentralRegistry |
registry |
Constructor and Description |
---|
TreeFactoryCoordinator(CentralRegistry registry) |
TreeFactoryCoordinator(CentralRegistry registry,
double randomWeight) |
TreeFactoryCoordinator(CentralRegistry registry,
double randomWeight,
java.util.Map<TreeFactoryAbstract,java.lang.Double> otherFactories) |
TreeFactoryCoordinator(CentralRegistry registry,
java.util.Map<TreeFactoryAbstract,java.lang.Double> otherFactories) |
Modifier and Type | Method and Description |
---|---|
void |
addFactory(TreeFactoryAbstract factory,
double weight)
Allows additional factories to be added to the list of factories that can
be triggered.
|
void |
clearFactories()
Clears all other factories used (i.e.
|
static NAryTree |
generateRandomCandidate(CentralRegistry registry)
Static function that randomly selects a method to generate a process
model and returns the result
|
NAryTree |
generateRandomCandidate(java.util.Random rng)
Generates a random candidate by choosing a factory at random (including
ourselves with weight 1).
|
static NAryTree |
randomTree(CentralRegistry registry)
Returns a random tree
|
void |
setRandomWeight(double randomWeight)
Update the random weight
|
generateInitialPopulation, generateInitialPopulation
protected CentralRegistry registry
public TreeFactoryCoordinator(CentralRegistry registry)
registry
- public TreeFactoryCoordinator(CentralRegistry registry, double randomWeight)
registry
- randomWeight
- public TreeFactoryCoordinator(CentralRegistry registry, java.util.Map<TreeFactoryAbstract,java.lang.Double> otherFactories)
registry
- otherFactories
- A map from other factory instances to the chance of them
creating a candidate. Please keep in mind that the chance of a
random candidate creation is now set as 1.0public TreeFactoryCoordinator(CentralRegistry registry, double randomWeight, java.util.Map<TreeFactoryAbstract,java.lang.Double> otherFactories)
registry
- randomWeight
- Chance of a random candidateotherFactories
- A map from other factory instances to the chance of them
creating a candidate.public void clearFactories()
public void addFactory(TreeFactoryAbstract factory, double weight)
factory
- weight
- public void setRandomWeight(double randomWeight)
randomWeight
- public NAryTree generateRandomCandidate(java.util.Random rng)
rng
- The random number generator to use when creating the random
candidate.public static NAryTree generateRandomCandidate(CentralRegistry registry)
registry
- public static NAryTree randomTree(CentralRegistry registry)
registry
-