Operator.Operations
Class GrowInitialiser

java.lang.Object
  extended by Operator.Operations.GrowInitialiser
All Implemented Interfaces:
CreationOperation, Operation, ParameterI, Stochastic
Direct Known Subclasses:
FullInitialiser

public class GrowInitialiser
extends java.lang.Object
implements CreationOperation, Stochastic

Class for growing individuals to the maximum derrivationTree size of maxDepth

Author:
erikhemberg

Field Summary
protected  GEChromosome chromosome
           
protected  Genotype genotype
           
protected  GEGrammar grammar
           
protected  int initChromSize
           
protected  int maxDepth
           
protected  int minDepth
           
protected  RandomNumberGenerator rng
           
 
Constructor Summary
GrowInitialiser(RandomNumberGenerator rng, GEGrammar gegrammar, int maxDepth)
          New instance
GrowInitialiser(RandomNumberGenerator rng, GEGrammar gegrammar, java.util.Properties p)
          New instance
 
Method Summary
protected  boolean checkGECodonValue(NimbleTree<Symbol> dt)
          Check if it is a GECodonValue.
 Individual createIndividual()
          Creates an Individuals
 void doOperation(Individual operand)
          Performs the operation on an operand
 void doOperation(java.util.List<Individual> operands)
          Performs the operation on the list passed
 Genotype getGenotype(int maxLength)
          Creates a genotype by building a tree to the most maxDepth for one branch.
 int getMaxDepth()
          Get max depth of tree
 int getMinDepth()
          Get minimum depth of tree
 java.util.ArrayList<java.lang.Integer> getPossibleRules(NimbleTree<Symbol> dt, Rule rule)
           
 RandomNumberGenerator getRNG()
          Get the number generator
 boolean grow(NimbleTree<Symbol> dt)
          Recursively builds a tree.
 void setMaxDepth(int i)
          Set maximum depth of tree
 void setMinDepth(int minDepth)
          Set minimum depth
 void setProperties(java.util.Properties p)
          Set properties
 void setRNG(RandomNumberGenerator m)
          Set the number generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genotype

protected Genotype genotype

chromosome

protected GEChromosome chromosome

rng

protected RandomNumberGenerator rng

maxDepth

protected int maxDepth

minDepth

protected int minDepth

grammar

protected GEGrammar grammar

initChromSize

protected int initChromSize
Constructor Detail

GrowInitialiser

public GrowInitialiser(RandomNumberGenerator rng,
                       GEGrammar gegrammar,
                       int maxDepth)
New instance

Parameters:
rng - random number generator
gegrammar - grammatical evolution grammar
maxDepth - max growth depth of tree

GrowInitialiser

public GrowInitialiser(RandomNumberGenerator rng,
                       GEGrammar gegrammar,
                       java.util.Properties p)
New instance

Parameters:
rng - random number generator
gegrammar - grammatical evolution grammar
p - properties
Method Detail

setRNG

public void setRNG(RandomNumberGenerator m)
Description copied from interface: Stochastic
Set the number generator

Specified by:
setRNG in interface Stochastic
Parameters:
m - number generator

getRNG

public RandomNumberGenerator getRNG()
Description copied from interface: Stochastic
Get the number generator

Specified by:
getRNG in interface Stochastic
Returns:
number generator

setProperties

public void setProperties(java.util.Properties p)
Description copied from interface: ParameterI
Set properties

Specified by:
setProperties in interface ParameterI
Parameters:
p - object containing properties

createIndividual

public Individual createIndividual()
Creates an Individuals

Specified by:
createIndividual in interface CreationOperation
Returns:
created individual

getMinDepth

public int getMinDepth()
Get minimum depth of tree

Returns:
minimum depth

setMinDepth

public void setMinDepth(int minDepth)
Set minimum depth

Parameters:
minDepth - minumum depth

setMaxDepth

public void setMaxDepth(int i)
Set maximum depth of tree

Parameters:
i - max depth

getMaxDepth

public int getMaxDepth()
Get max depth of tree

Returns:
max depth

doOperation

public void doOperation(Individual operand)
Description copied from interface: Operation
Performs the operation on an operand

Specified by:
doOperation in interface Operation
Parameters:
operand - operand to perform operation on

doOperation

public void doOperation(java.util.List<Individual> operands)
Description copied from interface: Operation
Performs the operation on the list passed

Specified by:
doOperation in interface Operation
Parameters:
operands - operands to be operated on

getGenotype

public Genotype getGenotype(int maxLength)
Creates a genotype by building a tree to the most maxDepth for one branch. WHAT TO DO IF SIZE IS LARGER THAN MAX_LENGTH*WRAPS??

Returns:
A valid Genotype

grow

public boolean grow(NimbleTree<Symbol> dt)
Recursively builds a tree.

Parameters:
dt - Tree to grow on
Returns:
If the tree is valid

getPossibleRules

public java.util.ArrayList<java.lang.Integer> getPossibleRules(NimbleTree<Symbol> dt,
                                                               Rule rule)

checkGECodonValue

protected boolean checkGECodonValue(NimbleTree<Symbol> dt)
Check if it is a GECodonValue. Sapecific construct for inserting informatino into the grammar

Parameters:
dt - tree
Returns:
if it is a GECodonValue