com.epochx.representation.dbl
Class CoefficientPowerFunction

java.lang.Object
  extended by com.epochx.representation.Node<TYPE>
      extended by com.epochx.representation.FunctionNode<java.lang.Double>
          extended by com.epochx.representation.dbl.CoefficientPowerFunction
All Implemented Interfaces:
java.lang.Cloneable

public class CoefficientPowerFunction
extends FunctionNode<java.lang.Double>

The CoefficientPowerFunction is equivalent to a PowerFunction combined with a MultiplyFunction. It allows a succinct way of representing a variable with an exponent and a coefficient. An example: 3x^2, which is equivalent to 3*(x^2) CVP 3 x 2, which is equivalent to MUL(POW x 2)


Constructor Summary
CoefficientPowerFunction()
          Construct an CoefficientPowerFunction with no children.
CoefficientPowerFunction(Node<java.lang.Double> coefficient, Node<java.lang.Double> term, Node<java.lang.Double> exponent)
          Construct a CoefficientPowerFunction with three children.
 
Method Summary
 java.lang.Double evaluate()
          Evaluating a CoefficientPowerFunction is performed by evaluating the children and then calculating the result of the second child raised to the power of the third, then multiplied by the first child.
 java.lang.String getFunctionName()
          Get the unique name that identifies this function.
 
Methods inherited from class com.epochx.representation.FunctionNode
equals, toString
 
Methods inherited from class com.epochx.representation.Node
clone, getArity, getChild, getChildren, getDepth, getFunctionNodes, getLength, getNodesAtDepth, getNoDistinctFunctions, getNoDistinctTerminals, getNoFunctions, getNoTerminals, getNthNode, getTerminalNodes, hashCode, setChild, setChildren, setNthNode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CoefficientPowerFunction

public CoefficientPowerFunction()
Construct an CoefficientPowerFunction with no children.


CoefficientPowerFunction

public CoefficientPowerFunction(Node<java.lang.Double> coefficient,
                                Node<java.lang.Double> term,
                                Node<java.lang.Double> exponent)
Construct a CoefficientPowerFunction with three children. When evaluated, all children will first be evaluated. Then the second child will be raised to the power of the third child, and multiplied by the first.

Parameters:
coefficient - will be multiplied by the result of the term raised to the exponent.
term - will be raised to the power of the exponent and multiplied by the coefficient.
exponent - the power the term will be raised to.
Method Detail

evaluate

public java.lang.Double evaluate()
Evaluating a CoefficientPowerFunction is performed by evaluating the children and then calculating the result of the second child raised to the power of the third, then multiplied by the first child.

Specified by:
evaluate in class Node<java.lang.Double>
Returns:
The result of evaluating the candidate program.

getFunctionName

public java.lang.String getFunctionName()
Get the unique name that identifies this function.

Specified by:
getFunctionName in class FunctionNode<java.lang.Double>
Returns:
the unique name for the CoefficientPowerFunction which is CVP.