Package ec.gp.push

# Class PushBuilder

java.lang.Object
ec.gp.GPNodeBuilder
ec.gp.push.PushBuilder

All Implemented Interfaces:
  `Prototype`, `Setup`, `Serializable`, `Cloneable`

public class PushBuilder extends GPNodeBuilder
PushBuilder implements the Push-style tree building algorithm, which permits nonterminals of arbitrary arity. This algorithm is as follows:

``

     BUILD-TREE(size)
     If size == 1, return a terminal
     Else
     .... Make a parent nonterminal p
     .... while (size > 0)
     .... .... a invalid input: '<'- random number from 1 to size
     .... .... size invalid input: '<'- size - a
     .... .... c invalid input: '<'- 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

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `P_PUSHBUILDER`

  ### Fields inherited from class ec.gp.GPNodeBuilder

  `CHECK_BOUNDARY, maxSize, minSize, NOSIZEGIVEN, P_MAXSIZE, P_MINSIZE, P_NUMSIZES, P_SIZE, sizeDistribution`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PushBuilder()`

- ## Method Summary

  Modifier and Type
  Method
  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)`

  ### Methods inherited from class ec.gp.GPNodeBuilder

  `canPick, clone, errorAboutNoNodeWithType, pickSize, warnAboutNonterminal, warnAboutNonTerminalWithType, warnAboutNoTerminalWithType`

  ### Methods inherited from class java.lang.Object

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### P_PUSHBUILDER

    public static final String P_PUSHBUILDER
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### PushBuilder

    public PushBuilder()

- ## Method Details

  - ### 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.

    Specified by:
      `setup` in interface `Prototype`
    Specified by:
      `setup` in interface `Setup`
    Overrides:
      `setup` in class `GPNodeBuilder`

  - ### shuffle

    public GPNode[] shuffle(GPNode[] objs, EvolutionState state, int thread)

  - ### newRootedTree

    public GPNode newRootedTree(EvolutionState state, GPType type, int thread, GPNodeParent parent, GPFunctionSet set, int argposition, int requestedSize)
    Specified by:
      `newRootedTree` in class `GPNodeBuilder`