geneticWedge.gp
Class PopulationDescriptor

java.lang.Object
  extended by geneticWedge.gp.PopulationDescriptor

public class PopulationDescriptor
extends java.lang.Object

PopulationDescriptor holds the information required to create a Population object. Properties include minimum and maximum tree depths, grow method (GROW, FULL or RAMPED_HALF_AND_HALF), Function and Terminal lists, etc.


Nested Class Summary
static class PopulationDescriptor.PopulationGrowMethod
          PopulationGrowMethod determines the method used to 'grow' the Individuals within a Population
 
Constructor Summary
PopulationDescriptor(PopulationDescriptor.PopulationGrowMethod growMethod, int minTreeDepth, int maxTreeDepth, Function[] functions, Input[] inputs, Constant[] constants)
          Creates a PopulationDescriptor object with a growMethod, minimum and maximum tree depths and arrays of Functions, Constants and Inputs to be used in constructing Individuals.
PopulationDescriptor(PopulationDescriptor.PopulationGrowMethod growMethod, int minTreeDepth, int maxTreeDepth, Function[] functions, Input[] inputs, Constant[] constants, double growFunctionProportion)
          Creates a PopulationDescriptor object with a growMethod, minimum and maximum tree depths, arrays of Functions, Constants and Inputs to be used in constructing Individuals and a growFunctionProportion.
 
Method Summary
 void addMutatedConstant(double value)
          When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created.
 boolean getAllowCombinedOp()
          Returns allowCombinedOp.
 Constant[] getConstants()
          Returns the array of Constants used when constructing a Population.
 int getEliteSize()
          Returns the size of the elite.
 Function[] getFunctions()
          Returns the array of Functions used when constructing a Population.
 double getGrowFunctionProportion()
          Returns the growFunctionProportion used when constructing a Population.
 PopulationDescriptor.PopulationGrowMethod getGrowMethod()
          Returns the PopulationGrowMethod used when constructing a Population.
 int getInitialSelectionPressure()
           
 Input[] getInputs()
          Returns the array of Inputs used when constructing a Population.
 int getMaxTreeDepth()
          Returns the maximum tree depth used when constructing a Population.
 int getMinTreeDepth()
          Returns the minimum tree depth used when constructing a Population.
 java.util.Vector<java.lang.Double> getMutatedConstants()
          When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created.
 double getMutationProportion()
          Returns the probability of mutation occurring during the creation of offspring.
 double getReproductionProportion()
          Returns the probability of reproduction (cloning) occurring during the creation of offspring.
 void resetMutatedConstants()
          When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created.
 void setEliteSize(int eliteSize)
          Sets the size of the elite.
 void setInitialisationParameters(int initialSelectionPressure)
           
 void setMutationAndReproductionProportions(double mutProportion, double repProportion)
          Sets the probabilies of using reproduction (cloning) and mutation operators during evolution.
 void setMutationAndReproductionProportions(double mutProportion, double repProportion, boolean allowCombinedOp)
          Sets the probabilies of using reproduction (cloning) and mutation operators during evolution.
 void setMutationProportion(double proportion)
          Sets the probability of mutation occurring.
 void setMutationProportion(double proportion, boolean allowCombinedOp)
          Sets the probability of mutation occurring.
 void setReproductionProportion(double proportion)
          Sets the probability of reproduction (cloning) occurring.
 void setReproductionProportion(double proportion, boolean allowCombinedOp)
          Sets the probability of reproduction (cloning) occurring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopulationDescriptor

public PopulationDescriptor(PopulationDescriptor.PopulationGrowMethod growMethod,
                            int minTreeDepth,
                            int maxTreeDepth,
                            Function[] functions,
                            Input[] inputs,
                            Constant[] constants)
                     throws InvalidRangeException
Creates a PopulationDescriptor object with a growMethod, minimum and maximum tree depths and arrays of Functions, Constants and Inputs to be used in constructing Individuals.

Throws:
InvalidRangeException

PopulationDescriptor

public PopulationDescriptor(PopulationDescriptor.PopulationGrowMethod growMethod,
                            int minTreeDepth,
                            int maxTreeDepth,
                            Function[] functions,
                            Input[] inputs,
                            Constant[] constants,
                            double growFunctionProportion)
                     throws InvalidRangeException
Creates a PopulationDescriptor object with a growMethod, minimum and maximum tree depths, arrays of Functions, Constants and Inputs to be used in constructing Individuals and a growFunctionProportion. growFunctionProportion is the probability of selecting a Function (rather than a Terminal) when creating an Individual using the GROW method.

Throws:
InvalidRangeException
Method Detail

setInitialisationParameters

public void setInitialisationParameters(int initialSelectionPressure)

getInitialSelectionPressure

public int getInitialSelectionPressure()

getGrowMethod

public PopulationDescriptor.PopulationGrowMethod getGrowMethod()
Returns the PopulationGrowMethod used when constructing a Population.


getMinTreeDepth

public int getMinTreeDepth()
Returns the minimum tree depth used when constructing a Population.


getMaxTreeDepth

public int getMaxTreeDepth()
Returns the maximum tree depth used when constructing a Population.


getFunctions

public Function[] getFunctions()
Returns the array of Functions used when constructing a Population.


getInputs

public Input[] getInputs()
Returns the array of Inputs used when constructing a Population.


getConstants

public Constant[] getConstants()
Returns the array of Constants used when constructing a Population.


getGrowFunctionProportion

public double getGrowFunctionProportion()
Returns the growFunctionProportion used when constructing a Population. growFunctionProportion is the probability of selecting a Function (rather than a Terminal) when creating an Individual using the GROW method.


setMutationAndReproductionProportions

public void setMutationAndReproductionProportions(double mutProportion,
                                                  double repProportion)
                                           throws IllegalMutationReproductionRatesException
Sets the probabilies of using reproduction (cloning) and mutation operators during evolution. When crossover and reproduction are not used crossover will occur.

Throws:
IllegalMutationReproductionRatesException

setMutationAndReproductionProportions

public void setMutationAndReproductionProportions(double mutProportion,
                                                  double repProportion,
                                                  boolean allowCombinedOp)
                                           throws IllegalMutationReproductionRatesException
Sets the probabilies of using reproduction (cloning) and mutation operators during evolution. When reproduction is not used crossover will occur. If allowCombinedOp is true, mutation may occur in addition to reproduction or crossover. The occurrence of muation is assessed separately after crossover/reproduction. If false, only one operator aill be applied at a time, so the total probability of mutation, crossover or reproduction is 1.0.

Throws:
IllegalMutationReproductionRatesException

setMutationProportion

public void setMutationProportion(double proportion)
                           throws IllegalMutationReproductionRatesException
Sets the probability of mutation occurring. IllegalMutationReproductionRatesException will be thrown if an attempt is made to set a mutation rate outside the range [0,1]. If allowCombinedOp is false, this Exception will also be thrown if the combined mutation and reproduction rates exceed 1.0, since these operations cannot occur together.

Throws:
IllegalMutationReproductionRatesException

setMutationProportion

public void setMutationProportion(double proportion,
                                  boolean allowCombinedOp)
                           throws IllegalMutationReproductionRatesException
Sets the probability of mutation occurring. IllegalMutationReproductionRatesException will be thrown if an attempt is made to set a mutation rate outside the range [0,1]. If allowCombinedOp is false, this Exception will also be thrown if the combined mutation and reproduction rates exceed 1.0, since these operations cannot occur together.

Throws:
IllegalMutationReproductionRatesException

setReproductionProportion

public void setReproductionProportion(double proportion)
                               throws IllegalMutationReproductionRatesException
Sets the probability of reproduction (cloning) occurring. IllegalMutationReproductionRatesException will be thrown if an attempt is made to set a reproduction rate outside the range [0,1]. If allowCombinedOp is false, this Exception will also be thrown if the combined mutation and reproduction rates exceed 1.0, since these operations cannot occur together.

Throws:
IllegalMutationReproductionRatesException

setReproductionProportion

public void setReproductionProportion(double proportion,
                                      boolean allowCombinedOp)
                               throws IllegalMutationReproductionRatesException
Sets the probability of reproduction (cloning) occurring. IllegalMutationReproductionRatesException will be thrown if an attempt is made to set a reproduction rate outside the range [0,1]. If allowCombinedOp is false, this Exception will also be thrown if the combined mutation and reproduction rates exceed 1.0, since these operations cannot occur together.

Throws:
IllegalMutationReproductionRatesException

getMutationProportion

public double getMutationProportion()
Returns the probability of mutation occurring during the creation of offspring.


getReproductionProportion

public double getReproductionProportion()
Returns the probability of reproduction (cloning) occurring during the creation of offspring.


getEliteSize

public int getEliteSize()
Returns the size of the elite. Elite Individuals will be transferred to the next generation without having to undergo selection. Having an elite prevents the loss of the best Individual(s) through stochastic sampling.


setEliteSize

public void setEliteSize(int eliteSize)
Sets the size of the elite. Elite Individuals will be transferred to the next generation without having to undergo selection.


addMutatedConstant

public void addMutatedConstant(double value)
When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created. These should be added to PopulationDescriptor so that they can be used during future mutation operations.


getMutatedConstants

public java.util.Vector<java.lang.Double> getMutatedConstants()
When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created. These should be added to PopulationDescriptor so that they can be used during future mutation operations. This method returns the values of the Constant objects created via CONSTANT_VALUE mutation.


resetMutatedConstants

public void resetMutatedConstants()
When CONSTANT_VALUE mutation is included as a mutation operation, new Constant objects may be created. These are added to PopulationDescriptor so that they can be used during future mutation operations. This method removes these mutated Constants. They will not then be available during future mutation operations.


getAllowCombinedOp

public boolean getAllowCombinedOp()
Returns allowCombinedOp. If true, mutation may occur in addition to crossover or reproduction. If false, only one operation may occur at a time, so the combined probability of crossover, reproduction or mutation is 1.0.