com.epochx.op.mutation
Class PointMutation<TYPE>

java.lang.Object
  extended by com.epochx.op.mutation.PointMutation<TYPE>
All Implemented Interfaces:
Mutation<TYPE>

public class PointMutation<TYPE>
extends java.lang.Object
implements Mutation<TYPE>

This class performs a simple point mutation on a CandidateProgram.

Each node in the program tree is considered for mutation, with the probability of that node being mutated given as an argument to the PointMutation constructor. If the node does undergo mutation then a replacement node is selected from the full syntax (function and terminal sets), at random.


Constructor Summary
PointMutation(GPModel<TYPE> model)
          Construct a point mutation with a default point probability of 0.01.
PointMutation(GPModel<TYPE> model, double pointProbability)
          Construct a point mutation with user specified point probability.
 
Method Summary
 CandidateProgram<TYPE> mutate(CandidateProgram<TYPE> program)
          Perform point mutation on the given CandidateProgram.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PointMutation

public PointMutation(GPModel<TYPE> model)
Construct a point mutation with a default point probability of 0.01. It is generally recommended that the PointMutation(GPModel, double) constructor is used instead.

Parameters:
model - The current controlling model. Parameters such as full syntax will be obtained from this.

PointMutation

public PointMutation(GPModel<TYPE> model,
                     double pointProbability)
Construct a point mutation with user specified point probability.

Parameters:
model - The current controlling model. Parameters such as full syntax will be obtained from this.
pointProbability - The probability each node in a selected program has of undergoing a mutation. 1.0 would result in all nodes being changed, and 0.0 would mean no nodes were changed. A typical value would be 0.01.
Method Detail

mutate

public CandidateProgram<TYPE> mutate(CandidateProgram<TYPE> program)
Perform point mutation on the given CandidateProgram. Each node in the program tree is considered in turn, with each having the given probability of actually being exchanged. Given that a node is chosen then a new function or terminal node of the same arity is used to replace it.

Specified by:
mutate in interface Mutation<TYPE>
Parameters:
program - The CandidateProgram selected to undergo this mutation operation.
Returns:
A CandidateProgram that was the result of a point mutation on the provided CandidateProgram.