|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ec.gp.GPNodeBuilder | +--ec.gp.build.PTC2
PTC2 implements the "Strongly-typed Probabilistic Tree Creation 2 (PTC2)" algorithm described in
Luke, Sean. 2000. Issues in Scaling Genetic Programming: Breeding Strategies, Tree Generation, and Code Bloat. Ph.D. Dissertation, Department of Computer Science, University of Maryland, College Park, Maryland.
...and also in
Luke, Sean. 2000. Two fast tree-creation algorithms for genetic programming. In IEEE Transactions on Evolutionary Computation 4:3 (September 2000), 274-283. IEEE.
Both can be found at http://www.cs.gmu.edu/~sean/papers/
PTC2 requires that your function set to implement PTCFunctionSetForm. The provided function set, PTCFunctionSet, does exactly this.
The Strongly-typed PTC2 algorithm roughly works as follows: the user provides a requested tree size, and PTC2 attempts to build a tree of that size or that size plus the maximum arity of a nonterminal in the function set. PTC2 works roughly like this:
Generally speaking, PTC2 picks a random position in the horizon of the tree (unfiled child node positions), fills it with a nonterminal, thus extending the horizon, and repeats this until the number of nodes (nonterminals) in the tree, plus the number of unfilled node positions, is >= the requested tree size. Then the remaining horizon is filled with terminals.
The user-provided requested tree size is either provided directly to the PTC2 algorithm, or if the size is NOSIZEGIVEN, then PTC2 will pick one at random from the GPNodeBuilder probability distribution system (using either max-depth and min-depth, or using num-sizes).
PTC2 also has provisions for picking nonterminals with a certain probability over other nonterminals of the same return type (and terminals over other terminals likewise), hence its name. To change the probability of picking various terminals or nonterminals, you modify your PTCFunctionSetForm function set.
PTC2 further has a maximum depth, which you should set to some fairly big value. If your maximum depth is small enough that PTC2 often creates trees which bump up against it, then PTC2 will only generate terminals at that depth position. If the depth is *really* small, it's possible that this means PTC2 will generate trees smaller than you had requested.
Parameters
base.max-depth int >= 1 |
maximum allowable tree depth (usually a big value) |
Field Summary | |
int |
maxDepth
The largest maximum tree depth GROW can specify -- should be big. |
static int |
MIN_QUEUE_SIZE
|
static java.lang.String |
P_MAXDEPTH
|
static java.lang.String |
P_PTC2
|
Fields inherited from class ec.gp.GPNodeBuilder |
CHECK_BOUNDARY,
maxSize,
minSize,
NOSIZEGIVEN,
P_MAXSIZE,
P_MINSIZE,
P_NUMSIZES,
P_SIZE,
sizeDistribution |
Constructor Summary | |
PTC2()
|
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_PTC2
public static final java.lang.String P_MAXDEPTH
public int maxDepth
public static final int MIN_QUEUE_SIZE
Constructor Detail |
public PTC2()
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 |