classifier.gp
Class MutationPlain

java.lang.Object
  extended byclassifier.gp.MutationPlain
All Implemented Interfaces:
MutationOperator, Operators, java.io.Serializable

public class MutationPlain
extends java.lang.Object
implements MutationOperator

Implementation of the classical mutation operator

Version:
0.1
Author:
Sacchi Matteo, Sassi Federico
See Also:
Serialized Form

Field Summary
(package private)  Condition is_function
           
(package private)  Condition is_program
           
protected  int max_depth
           
protected  int mut_depth
           
protected  GProgram[] program
           
(package private)  GProgram program_old
           
 
Constructor Summary
MutationPlain(int method_generation, double internal, int max_depth)
          Inizialize the parameters of the mutation
 
Method Summary
 double getInternalRate()
          Probability that a internal node is chosen as a mutation point
 int getMaxDepth()
          Maximum allowable depth of the resulting tree
 int getMethodOfGeneration()
           
 void setInternalRate(double internal)
          To change the probability that a internal node is chosen as a mutation point
 void setMaxDetph(int max)
          To change the maximum allowable depth of a tree
 void setMethodOfGeneration(int method)
           
 GProgram[] start(GProgram[] gprogram, FunctionSet functionset, TerminalSet terminalset)
          Method to start the mutation operation
(package private)  void validateMutation(GProgram[] program)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

program

protected GProgram[] program

program_old

GProgram program_old

max_depth

protected int max_depth

mut_depth

protected int mut_depth

is_function

Condition is_function

is_program

Condition is_program
Constructor Detail

MutationPlain

public MutationPlain(int method_generation,
                     double internal,
                     int max_depth)
Inizialize the parameters of the mutation

Parameters:
method_generation - 1=FULL 2=GROW 3=RAMPED HALF AND HALF as you can see in MethodOfGeneration class
internal - Probability [0..1] that a internal node is chosen as a mutation point, it should kept low
max_depth - Maximum allowable depth of the resulting tree
Method Detail

getMaxDepth

public int getMaxDepth()
Maximum allowable depth of the resulting tree

Returns:
An integer that correspond to the maximum allowable depth of a tree

getInternalRate

public double getInternalRate()
Probability that a internal node is chosen as a mutation point

Returns:
The probability as a double in the range [0..1]

setMaxDetph

public void setMaxDetph(int max)
To change the maximum allowable depth of a tree

Parameters:
max - new integer value of the maximum depth

setInternalRate

public void setInternalRate(double internal)
To change the probability that a internal node is chosen as a mutation point

Parameters:
internal - a double value in the range of [0..1]

getMethodOfGeneration

public int getMethodOfGeneration()

setMethodOfGeneration

public void setMethodOfGeneration(int method)

start

public GProgram[] start(GProgram[] gprogram,
                        FunctionSet functionset,
                        TerminalSet terminalset)
Description copied from interface: MutationOperator
Method to start the mutation operation

Specified by:
start in interface MutationOperator
Parameters:
gprogram - an array that contain the GProgram to be mutated
functionset - an object that contain the function set from what to generate the new mutate program
terminalset - an object that contain the terminal set from what to generate the new mutate program
Returns:
an array of one GProgram contating the mutate one

validateMutation

void validateMutation(GProgram[] program)