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

java.lang.Object
  extended by org.jscience.computing.ai.evolutionary.geneticprogramming.Program
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Function, Terminal

public abstract class Program
extends java.lang.Object
implements java.lang.Cloneable

Abstraction for the programs in genetic programming.


Constructor Summary
Program()
           
 
Method Summary
abstract  java.lang.Object clone()
          Returns a deep copy of this Program instance
abstract  int countFunctionNodes()
          Returns the number of function nodes this program has.
abstract  int countNodes()
          Returns the number of nodes this program has.
abstract  int countProgramNodes()
          Returns the number of program nodes this program has.
abstract  java.lang.Object eval(java.lang.Object fitnessCase)
          Returns evaluation of this program with the given parameter
abstract  java.lang.String getName()
          Returns the name of this program.
abstract  java.lang.String toText()
          Returns a string representation of this program.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Program

public Program()
Method Detail

toText

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

Returns:
number of function nodes

getName

public abstract java.lang.String getName()
Returns the name of this program.

Returns:
name of this program

eval

public abstract java.lang.Object eval(java.lang.Object fitnessCase)
Returns evaluation of this program with the given parameter

Parameters:
fitnessCase - fitness case to evaluate
Returns:
evaluation result

countNodes

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

Returns:
number of children nodes

countProgramNodes

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

Returns:
number of program nodes

countFunctionNodes

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

Returns:
number of function nodes

clone

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

Overrides:
clone in class java.lang.Object
Returns:
deep copy of this program