|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ec.gp.GPNodeBuilder | +--ec.gp.koza.GrowBuilder
GrowBuilder is a GPNodeBuilder which approximately implements the GROW tree building method described in Koza I/II.
GROW works by choosing a random integer d between minDepth and maxDepth, inclusive. It then grows a tree of depth 1 to d inclusive.
Actually, claiming to implement the Koza I/II approach is a bit of a fib -- Koza's original code is somewhat ad-hoc. In Koza, d is always set to maxDepth, and trees may not consist of a single terminal. This makes strongly-typed implementations unecessarily restrictive in function options.
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.
Note that the Koza I/II implementations solely use GROW for subtree mutations.
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.
Koza's stated parameters are not as they appear -- due to the algorithmic design of the code, the resultant tree-depths are mostly one-off of the parameters indicated.
Common maxDepth values:
Common minDepth values:
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 thie builder may use for building a tree. 6 is the default.) |
Default Base
gp.koza.grow
Field Summary | |
int |
maxDepth
The largest maximum tree depth GROW can specify. |
int |
minDepth
The smallest maximum tree depth GROW can specify. |
static java.lang.String |
P_GROWBUILDER
|
static java.lang.String |
P_MAXDEPTH
|
static java.lang.String |
P_MINDEPTH
|
Fields inherited from class ec.gp.GPNodeBuilder |
CHECK_BOUNDARY,
maxSize,
minSize,
NOSIZEGIVEN,
P_MAXSIZE,
P_MINSIZE,
P_NUMSIZES,
P_SIZE,
sizeDistribution |
Constructor Summary | |
GrowBuilder()
|
Method Summary | |
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)
|
void |
setup(EvolutionState state,
Parameter base)
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. |
Methods inherited from class ec.gp.GPNodeBuilder |
canPick,
pickSize,
protoClone,
protoCloneSimple |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.lang.String P_GROWBUILDER
public static final java.lang.String P_MAXDEPTH
public static final java.lang.String P_MINDEPTH
public int maxDepth
public int minDepth
Constructor Detail |
public GrowBuilder()
Method Detail |
public Parameter defaultBase()
public void setup(EvolutionState state, Parameter base)
For prototypes, setup(...) is typically called once for the prototype instance; cloned instances do not receive the setup(...) call. setup(...) may be called more than once; the only guarantee is that it will get called at least once on an instance or some "parent" object from which it was ultimately cloned.
public GPNode newRootedTree(EvolutionState state, GPType type, int thread, GPNodeParent parent, GPFunctionSet set, int argposition, int requestedSize) throws java.lang.CloneNotSupportedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |