org.jscience.computing.ai.evolutionary.geneticprogramming
Class Function

java.lang.Object
  extended by org.jscience.computing.ai.evolutionary.geneticprogramming.Program
      extended by org.jscience.computing.ai.evolutionary.geneticprogramming.Function
All Implemented Interfaces:
java.lang.Cloneable

public abstract class Function
extends Program

Abstraction for the functions in genetic programming.


Field Summary
 Program[] arg
          The program which represents this function
 
Constructor Summary
Function()
           
 
Method Summary
 java.lang.Object clone()
          Returns a deep copy of this Function instance
 int countFunctionNodes()
          Returns the number of function nodes this function has.
 int countNodes()
          Returns the number of nodes this function has.
 int countProgramNodes()
          Returns the number of program nodes this function has.
 java.lang.String toText()
          Returns a string representation of this function.
 
Methods inherited from class org.jscience.computing.ai.evolutionary.geneticprogramming.Program
eval, getName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

arg

public Program[] arg
The program which represents this function

Constructor Detail

Function

public Function()
Method Detail

clone

public java.lang.Object clone()
Returns a deep copy of this Function instance

Specified by:
clone in class Program
Returns:
deep copy of this function

countNodes

public int countNodes()
Returns the number of nodes this function has.

Specified by:
countNodes in class Program
Returns:
number of children nodes

countProgramNodes

public int countProgramNodes()
Returns the number of program nodes this function has. This method traverses all the children nodes recursively until the leaf nodes are reached and counts the number of programs.

Specified by:
countProgramNodes in class Program
Returns:
number of program nodes

countFunctionNodes

public int countFunctionNodes()
Returns the number of function nodes this function has. This method traverses all the children nodes recursively until the leaf nodes are reached and counts the number of functions.

Specified by:
countFunctionNodes in class Program
Returns:
number of function nodes

toText

public java.lang.String toText()
Returns a string representation of this function. (Instead of toString - Used by Javolution)

Specified by:
toText in class Program
Returns:
string representation of this function