org.vizzini.ai.geneticprogramming
Class AbstractFunctionGenerator

java.lang.Object
  extended by org.vizzini.ai.geneticprogramming.AbstractFunctionGenerator
All Implemented Interfaces:
IFunctionGenerator
Direct Known Subclasses:
DefaultFunctionGenerator

public abstract class AbstractFunctionGenerator
extends Object
implements IFunctionGenerator

Provides base functionality for a function generator in genetic programming.

Since:
v0.3
Version:
v0.3
Author:
Jeffrey M. Thompson

Constructor Summary
AbstractFunctionGenerator()
          Construct this object.
AbstractFunctionGenerator(Class returnType)
          Construct this object with the given parameters.
AbstractFunctionGenerator(Class returnType, int maxDepth)
          Construct this object with the given parameters.
 
Method Summary
 void addFunction(IFunction function)
          Add a function exemplar to the function set.
 void addTerminal(ITerminal terminal)
          Add a terminal exemplar to the terminal set.
 IFunction create()
          Return a new populated function.
protected  IFunction createCompleteFunction(Class returnType, int depth)
          Create a new function and populate its argument nodes.
protected  IFunction createNewInstanceOfFunctionAt(Class returnType, int index)
          Return a new instance of the function at the given index.
protected  ITerminal createNewInstanceOfTerminalAt(Class returnType, int index)
          Return a new instance of the terminal exemplar at the given index.
protected  ITerminal createTerminal(Class returnType)
          Create a new terminal.
 int getFunctionCount()
          Return the function count.
 int getFunctionCount(Class returnType)
          Return the function count.
protected  List getFunctionList(Class returnType)
          Return the function list for the given return type.
 int getMaxDepth()
           
 Class getReturnType()
           
 int getTerminalCount()
          Return the terminal count.
 int getTerminalCount(Class returnType)
          Return the terminal count.
protected  List getTerminalList(Class returnType)
          Return the terminal list for the given return type.
 void setMaxDepth(int maxDepth)
           
 void setReturnType(Class returnType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFunctionGenerator

public AbstractFunctionGenerator()
Construct this object.

Since:
v0.3

AbstractFunctionGenerator

public AbstractFunctionGenerator(Class returnType)
Construct this object with the given parameters.

Parameters:
returnType - Return type.
Since:
v0.3

AbstractFunctionGenerator

public AbstractFunctionGenerator(Class returnType,
                                 int maxDepth)
Construct this object with the given parameters.

Parameters:
returnType - Return type.
maxDepth - Maximum depth of created functions.
Since:
v0.3
Method Detail

addFunction

public void addFunction(IFunction function)
Add a function exemplar to the function set.

Specified by:
addFunction in interface IFunctionGenerator
Parameters:
function - Function exemplar.
Since:
v0.3

addTerminal

public void addTerminal(ITerminal terminal)
Add a terminal exemplar to the terminal set.

Specified by:
addTerminal in interface IFunctionGenerator
Parameters:
terminal - Terminal exemplar.
Since:
v0.3

create

public IFunction create()
Return a new populated function.

Specified by:
create in interface IFunctionGenerator
Since:
v0.3

getFunctionCount

public int getFunctionCount()
Return the function count.

Specified by:
getFunctionCount in interface IFunctionGenerator
Since:
v0.3

getFunctionCount

public int getFunctionCount(Class returnType)
Return the function count.

Since:
v0.3

getMaxDepth

public int getMaxDepth()
Specified by:
getMaxDepth in interface IFunctionGenerator
Returns:
Return maxDepth.
Since:
v0.3

getReturnType

public Class getReturnType()
Specified by:
getReturnType in interface IFunctionGenerator
Returns:
Return returnType.
Since:
v0.3

getTerminalCount

public int getTerminalCount()
Return the terminal count.

Specified by:
getTerminalCount in interface IFunctionGenerator
Since:
v0.3

getTerminalCount

public int getTerminalCount(Class returnType)
Return the terminal count.

Since:
v0.3

setMaxDepth

public void setMaxDepth(int maxDepth)
Specified by:
setMaxDepth in interface IFunctionGenerator
Parameters:
maxDepth - the maxDepth to set
Since:
v0.3

setReturnType

public void setReturnType(Class returnType)
Specified by:
setReturnType in interface IFunctionGenerator
Parameters:
returnType - the returnType to set
Since:
v0.3

createCompleteFunction

protected IFunction createCompleteFunction(Class returnType,
                                           int depth)
Create a new function and populate its argument nodes.

Parameters:
returnType - Required function return type.
depth - Current depth.
Since:
v0.3

createNewInstanceOfFunctionAt

protected IFunction createNewInstanceOfFunctionAt(Class returnType,
                                                  int index)
Return a new instance of the function at the given index.

Parameters:
returnType - Required function return type.
index - Index.
Since:
v0.3

createNewInstanceOfTerminalAt

protected ITerminal createNewInstanceOfTerminalAt(Class returnType,
                                                  int index)
Return a new instance of the terminal exemplar at the given index.

Parameters:
returnType - Required terminal return type.
index - Index.
Since:
v0.3

createTerminal

protected ITerminal createTerminal(Class returnType)
Create a new terminal.

Parameters:
returnType - Required terminal return type.
Since:
v0.3

getFunctionList

protected List getFunctionList(Class returnType)
Return the function list for the given return type.

Parameters:
returnType - Function return type.
Since:
v0.3

getTerminalList

protected List getTerminalList(Class returnType)
Return the terminal list for the given return type.

Parameters:
returnType - Terminal return type.
Since:
v0.3


Copyright © 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02