geneticWedge.gp.function
Class TwoInputFunction

java.lang.Object
  extended by geneticWedge.gp.Component
      extended by geneticWedge.gp.function.Function
          extended by geneticWedge.gp.function.TwoInputFunction
Direct Known Subclasses:
AdditionFunction, ANDFunction, DivisionFunction, MaxFunction, MinFunction, MultiplicationFunction, NANDFunction, ORFunction, PowerFunction, SubtractionFunction, XORFunction

public abstract class TwoInputFunction
extends Function

Abstract parent of all binary functions. Subclasses should throw an InvalidInputSizeException if the length of the array sent to getOutput() is not 2.


Constructor Summary
TwoInputFunction()
          The constructor sets the number of inputs required to 2
TwoInputFunction(int complexity)
          This constructor allows the creation of Functions with assigned complexity values, rather than the default values.
 
Method Summary
abstract  boolean isCommutative()
          non-abstract subclasses must implement this method.
 
Methods inherited from class geneticWedge.gp.function.Function
getComplexity, getNoOfInputs, getOutput, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TwoInputFunction

public TwoInputFunction()
The constructor sets the number of inputs required to 2


TwoInputFunction

public TwoInputFunction(int complexity)
This constructor allows the creation of Functions with assigned complexity values, rather than the default values. This may be used to give priority to chosen functions (by giving them a low complexity value) in conjunction with the use of the FUNCTION_COMPLEXITY PerformanceFunction in Population.

Method Detail

isCommutative

public abstract boolean isCommutative()
non-abstract subclasses must implement this method. The isCommutative method is used to decide whether a node is an appropriate location for performing SWAP mutation: if a Function is commutative SWAP will not be applied to it.