ec.gp.build
Class RandomBranch

java.lang.Object
  |
  +--ec.gp.GPNodeBuilder
        |
        +--ec.gp.build.RandomBranch
All Implemented Interfaces:
java.lang.Cloneable, Prototype, java.io.Serializable, Setup

public class RandomBranch
extends GPNodeBuilder

RandomBranch implements the Random_Branch tree generation method described in

Chellapilla, K. 1998. Evolving Modular Programs without Crossover. in Proceedings of the Third Annual Genetic Programming Conference (GP98), J.R. Koza et al, editors. San Fransisco: Morgan Kaufmann. 23--31.

This algorithm attempts to create a tree of size requestedSize, or "slightly less". If the pipeline does not specify a size it wants (it uses NOSIZEGIVEN), the algorithm picks a size at random from either [minSize...maxSize] or from sizeDistribution (one of the two must be defined), and attempts to create a tree of that size or "slightly less".

See Also:
Serialized Form

Field Summary
static java.lang.String P_RANDOMBRANCH
           
 
Fields inherited from class ec.gp.GPNodeBuilder
CHECK_BOUNDARY, maxSize, minSize, NOSIZEGIVEN, P_MAXSIZE, P_MINSIZE, P_NUMSIZES, P_SIZE, sizeDistribution
 
Constructor Summary
RandomBranch()
           
 
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

P_RANDOMBRANCH

public static final java.lang.String P_RANDOMBRANCH
Constructor Detail

RandomBranch

public RandomBranch()
Method Detail

defaultBase

public Parameter defaultBase()
Description copied from interface: Prototype
Returns the default base for this prototype. This should generally be implemented by building off of the static base() method on the DefaultsForm object for the prototype's package. This should be callable during setup(...).

setup

public void setup(EvolutionState state,
                  Parameter base)
Description copied from interface: Prototype
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.

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.

Overrides:
setup in class GPNodeBuilder

newRootedTree

public GPNode newRootedTree(EvolutionState state,
                            GPType type,
                            int thread,
                            GPNodeParent parent,
                            GPFunctionSet set,
                            int argposition,
                            int requestedSize)
                     throws java.lang.CloneNotSupportedException
Overrides:
newRootedTree in class GPNodeBuilder