com.epochx.op.initialisation
Class GrowInitialiser<TYPE>

java.lang.Object
  extended by com.epochx.op.initialisation.GrowInitialiser<TYPE>
All Implemented Interfaces:
Initialiser<TYPE>

public class GrowInitialiser<TYPE>
extends java.lang.Object
implements Initialiser<TYPE>

Initialisation implementation which randomly grows program trees down to a maximum depth.


Constructor Summary
GrowInitialiser(GPModel<TYPE> model)
          Constructor for the grow initialiser.
 
Method Summary
 Node<TYPE> buildGrowNodeTree(int maxDepth)
          Build a grown node tree with a maximum depth as given.
 java.util.List<CandidateProgram<TYPE>> getInitialPopulation()
          Generate a population of new CandidatePrograms constructed from the function and terminal sets defined by the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrowInitialiser

public GrowInitialiser(GPModel<TYPE> model)
Constructor for the grow initialiser.

Parameters:
model - The current controlling model. Run parameters such as the population size will be obtained from this.
Method Detail

getInitialPopulation

public java.util.List<CandidateProgram<TYPE>> getInitialPopulation()
Generate a population of new CandidatePrograms constructed from the function and terminal sets defined by the model. The size of the population will be equal to the result of calling getPopulationSize() on the controlling model. All programs in the population will be unique. Each candidate program will have a node tree with a maximum depth as given by a call to getInitialMaxDepth() on the model.

Specified by:
getInitialPopulation in interface Initialiser<TYPE>
Returns:
A List of newly generated CandidatePrograms which will form the initial population for a GP run.

buildGrowNodeTree

public Node<TYPE> buildGrowNodeTree(int maxDepth)
Build a grown node tree with a maximum depth as given. The internal nodes and leaf nodes will be selected from the function and terminal sets respectively, as provided by the model.

Parameters:
maxDepth - The maximum depth of the node tree to be grown, where the depth is the number of nodes from the root.
Returns:
The root node of a randomly generated node tree.