public class PushBuilder extends GPNodeBuilder
BUILD-TREE(size)
If size == 1, return a terminal
Else
.... Make a parent nonterminal p
.... while (size > 0)
.... .... a <- random number from 1 to size
.... .... size <- size - a
.... .... c <- BUILD-TREE(a)
.... .... Add c as a child of p
shuffle order of children of p
return p
You must specify a size distribution for PushBuilder.
Default Base
gp.push.builder
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
P_PUSHBUILDER |
CHECK_BOUNDARY, maxSize, minSize, NOSIZEGIVEN, P_MAXSIZE, P_MINSIZE, P_NUMSIZES, P_SIZE, sizeDistribution
Constructor and Description |
---|
PushBuilder() |
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) |
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.
|
GPNode[] |
shuffle(GPNode[] objs,
EvolutionState state,
int thread) |
canPick, clone, errorAboutNoNodeWithType, pickSize, warnAboutNonterminal, warnAboutNonTerminalWithType, warnAboutNoTerminalWithType
public static final java.lang.String P_PUSHBUILDER
public Parameter defaultBase()
Prototype
public void setup(EvolutionState state, Parameter base)
Prototype
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[] shuffle(GPNode[] objs, EvolutionState state, int thread)
public GPNode newRootedTree(EvolutionState state, GPType type, int thread, GPNodeParent parent, GPFunctionSet set, int argposition, int requestedSize)
newRootedTree
in class GPNodeBuilder