Operator.Operations
Class RandomInitialiser

java.lang.Object
  extended by Operator.Operations.RandomInitialiser
All Implemented Interfaces:
CreationOperation, Operation, ParameterI, Stochastic

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

Create an Individual with a randomly generated chromosome

Author:
erikhemberg

Field Summary
protected  GEGrammar grammar
           
protected  int initChromSize
           
protected  RandomNumberGenerator rng
           
 
Constructor Summary
RandomInitialiser(RandomNumberGenerator rng, GEGrammar g, int initChromSize)
          New instance
RandomInitialiser(RandomNumberGenerator rng, GEGrammar g, java.util.Properties p)
          New instance
 
Method Summary
 Individual createIndividual()
          Creates an Individual
 void doOperation(Individual operand)
          Set an integer chromsome of initChromSize filled with random integers in the incoming individual.
 void doOperation(java.util.List<Individual> operands)
          Calls doOperation(Individual operand)
 RandomNumberGenerator getRNG()
          Get the number generator
 void setProperties(java.util.Properties p)
          Set properties
 void setRNG(RandomNumberGenerator rng)
          Set the number generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rng

protected RandomNumberGenerator rng

grammar

protected GEGrammar grammar

initChromSize

protected int initChromSize
Constructor Detail

RandomInitialiser

public RandomInitialiser(RandomNumberGenerator rng,
                         GEGrammar g,
                         int initChromSize)
New instance

Parameters:
rng - random number generator
g - grammatical evolution grammar
initChromSize - initial input size (Chromosome length)

RandomInitialiser

public RandomInitialiser(RandomNumberGenerator rng,
                         GEGrammar g,
                         java.util.Properties p)
New instance

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

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

getRNG

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

Specified by:
getRNG in interface Stochastic
Returns:
number generator

setRNG

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

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

createIndividual

public Individual createIndividual()
Creates an Individual

Specified by:
createIndividual in interface CreationOperation
Returns:
A new individual

doOperation

public void doOperation(Individual operand)
Set an integer chromsome of initChromSize filled with random integers in the incoming individual.

Specified by:
doOperation in interface Operation
Parameters:
operand - Individual to get the new chromosome

doOperation

public void doOperation(java.util.List<Individual> operands)
Calls doOperation(Individual operand)

Specified by:
doOperation in interface Operation
Parameters:
operands - list of individuals