public final class TreeGeneratorImpl extends Object implements TreeGenerator
Can be used to create randomly generate the initial population of a genetic programming run.
full(PrimitiveSet)
,
grow(PrimitiveSet, Random)
Modifier and Type | Method and Description |
---|---|
static TreeGenerator |
full(PrimitiveSet primitiveSet)
Creates a
TreeGenerator that uses the "full" approach to creating trees. |
Node |
generate(Type type,
int depth)
Constructs a new tree data structure.
|
static TreeGenerator |
grow(PrimitiveSet primitiveSet,
Random random)
Creates a
TreeGenerator that uses the "grow" approach to creating trees. |
public static TreeGenerator full(PrimitiveSet primitiveSet)
TreeGenerator
that uses the "full" approach to creating trees.
The "full" approach constructs trees where all terminal nodes (i.e. leaf nodes) are at the same depth.
primitiveSet
- the collection of functions, variables and constants from which tree will be constructedTreeGenerator
that uses the "full" approach to creating trees.public static TreeGenerator grow(PrimitiveSet primitiveSet, Random random)
TreeGenerator
that uses the "grow" approach to creating trees.
The "grow" approach constructs trees where terminal nodes (i.e. leaf nodes) are located at random depths, within a maximum limit.
primitiveSet
- the collection of functions, variables and constants from which tree will be constructedrandom
- used to randomly determine the structure of the generated treesTreeGenerator
that uses the "grow" approach to creating trees.public Node generate(Type type, int depth)
TreeGenerator
generate
in interface TreeGenerator
type
- the required return type of the treedepth
- the maximum depth of any nodes of the treeOakGP Genetic Programming Framework