Operator
Class RampedHalfAndHalfInitialiser

java.lang.Object
  extended by Operator.OperatorModule
      extended by Operator.SourceModule
          extended by Operator.Initialiser
              extended by Operator.RampedHalfAndHalfInitialiser
All Implemented Interfaces:
Creator, Module, Operator, ParameterI, Stochastic

public class RampedHalfAndHalfInitialiser
extends Initialiser

Class for performing ramped full and grow initialization. The population is divided(ramped) between minimum depth(shortest possible depth of a derivationTree) and maximum depth(Maximum allowed depth of a derivationTree). For each individual the full or the grow operation is chosen.


Field Summary
protected  int currentDepth
           
protected  int depthInterval
           
protected  CreationOperation growInitialisation
           
protected  double growProb
           
protected  int maxDepth
           
 
Fields inherited from class Operator.Initialiser
operation
 
Fields inherited from class Operator.SourceModule
size
 
Fields inherited from class Operator.OperatorModule
population, rng
 
Constructor Summary
RampedHalfAndHalfInitialiser()
          New instance
RampedHalfAndHalfInitialiser(RandomNumberGenerator rng, int size, CreationOperation op, CreationOperation op2, double growProb, int maxDepth)
          New instance
 
Method Summary
 int getDepthInterval(int populationSize)
          Calculates how the population should be partitioned between the different initialisation depths
 void perform()
          The population is divided(ramped) between minimum depth(shortest possible depth of a derivationTree) and maximum depth(Maximum allowed depth of a derivationTree).
 void setOperations(java.util.List<CreationOperation> ops)
          First item in collection is set as fullInitalion.
 void setProperties(java.util.Properties p)
          Set properties
 
Methods inherited from class Operator.Initialiser
getOperation, getPopulation, init, setOperation
 
Methods inherited from class Operator.SourceModule
setSize
 
Methods inherited from class Operator.OperatorModule
getRNG, setPopulation, setRNG
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface Operator.Creator
setSize
 

Field Detail

growInitialisation

protected CreationOperation growInitialisation

growProb

protected double growProb

currentDepth

protected int currentDepth

maxDepth

protected int maxDepth

depthInterval

protected int depthInterval
Constructor Detail

RampedHalfAndHalfInitialiser

public RampedHalfAndHalfInitialiser(RandomNumberGenerator rng,
                                    int size,
                                    CreationOperation op,
                                    CreationOperation op2,
                                    double growProb,
                                    int maxDepth)
New instance

Parameters:
rng - random number generator
size - size
op - operation
op2 - operation
growProb - probability of chosing grow operation
maxDepth - max depth of initalised trees

RampedHalfAndHalfInitialiser

public RampedHalfAndHalfInitialiser()
New instance

Method Detail

setProperties

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

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

perform

public void perform()
The population is divided(ramped) between minimum depth(shortest possible depth of a derivationTree) and maximum depth(Maximum allowed depth of a derivationTree). For each individual the full or the grow operation is chosen.

Specified by:
perform in interface Module
Overrides:
perform in class Initialiser

getDepthInterval

public int getDepthInterval(int populationSize)
Calculates how the population should be partitioned between the different initialisation depths

Parameters:
populationSize - Size of the population
Returns:
The interval for each depth

setOperations

public void setOperations(java.util.List<CreationOperation> ops)
First item in collection is set as fullInitalion. Second item is set as growInitialisation.

Parameters:
ops - List of the operations to be set