public class FullBuilder extends KozaBuilder
GROW works by choosing a random integer d between minDepth and maxDepth, inclusive. It then grows a full tree of depth d.
Actually, claiming to implement the Koza I/II approach is a bit of a fib -- Koza's original code is somewhat ad-hoc. In the Koza approach, d is chosen in a kind of round-robin fashion rather than at random, if RAMPED HALF/HALF is used. Also, for all three algorithms (RAMPED HALF/HALF, GROW, FULL), the algorithm will not generate a tree consisting of a single terminal, unless forced to.
This implementation instead follows lil-gp's approach, which is to choose d at random from between minDepth and maxDepth, inclusive, and to allow trees consisting of single terminals.
Determining what various algorithms do is a little confusing, mostly because the source code for lil-gp and Koza don't actually quite do what they claim. The table below lists the depth values actually used (counting nodes, rather than edges, for depth). It's probably not what you had expected!
Koza I Min |
Koza I Max |
Koza II Min |
Koza II Max |
lil-gp Min |
lil-gp Max |
ECJ Min |
ECJ Max |
|
GROW (mut) |
5 |
5 |
5 |
5 |
|
|
5 |
5 |
GROW (new) |
7 |
7 |
6? 7? |
6? 7? |
3 |
7 |
5 |
5 |
FULL (new) |
7 |
7 |
6? 7? |
6? 7? |
3 |
7 |
|
|
HALF (new) |
2 |
6 |
2 |
5? 6? |
3 |
7 |
2 |
6 |
This algorithm ignores requestedSize, so no pipelines can ask it to grow a tree of a specific fixed size. The algorithm also ignores any user-provided size distributions.
Parameters
base.min-depth int >= 1 |
(smallest "maximum" depth the builder may use for building a tree. 2 is the default.) |
base.max-depth int >= base.min-depth |
(largest "maximum" depth the builder may use for building a tree. 6 is the default.) |
Default Base
gp.koza.full
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
P_FULLBUILDER |
maxDepth, minDepth, P_MAXDEPTH, P_MINDEPTH
CHECK_BOUNDARY, maxSize, minSize, NOSIZEGIVEN, P_MAXSIZE, P_MINSIZE, P_NUMSIZES, P_SIZE, sizeDistribution
Constructor and Description |
---|
FullBuilder() |
Modifier and Type | Method and Description |
---|---|
Parameter |
defaultBase()
Returns the default base for this prototype.
|
GPNode |
newRootedTree(EvolutionState state,
GPType type,
int thread,
GPNodeParent parent,
GPFunctionSet set,
int argposition,
int requestedSize) |
fullNode, growNode, setup
canPick, clone, errorAboutNoNodeWithType, pickSize, warnAboutNonterminal, warnAboutNonTerminalWithType, warnAboutNoTerminalWithType
public static final java.lang.String P_FULLBUILDER
public Parameter defaultBase()
Prototype
public GPNode newRootedTree(EvolutionState state, GPType type, int thread, GPNodeParent parent, GPFunctionSet set, int argposition, int requestedSize)
newRootedTree
in class GPNodeBuilder