net.sourceforge.cilib.functions.continuous
Class ExpressionFunction

java.lang.Object
  extended by net.sourceforge.cilib.functions.Function
      extended by net.sourceforge.cilib.functions.ContinuousFunction
          extended by net.sourceforge.cilib.functions.continuous.ExpressionFunction
All Implemented Interfaces:
Serializable, Cloneable

public class ExpressionFunction
extends ContinuousFunction

A Function class that defines a function based on a predefined string which is parsed and interpreted during evaluation.

See Also:
Serialized Form

Constructor Summary
ExpressionFunction()
          Create a new instance of the ExpressionFunction.
ExpressionFunction(ExpressionFunction copy)
          Copy constructor.
 
Method Summary
 boolean equals(Object obj)
           
 double evaluate(Vector x)
          Evaluate the function with the given Vector as input.
 ExpressionFunction getClone()
          Create a cloned copy of the current object and return it.
 String getExpression()
          Get the defined function.
 int hashCode()
           
protected  void initialiseParser()
           
 void setExpression(String expression)
          Set the parseable function.
 
Methods inherited from class net.sourceforge.cilib.functions.ContinuousFunction
evaluate, getMaximum, getMinimum
 
Methods inherited from class net.sourceforge.cilib.functions.Function
getBehavioralDomainRegistry, getDimension, getDomain, getDomainRegistry, setBehavioralDomain, setBehaviouralDomainRegistry, setDomain
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpressionFunction

public ExpressionFunction()
Create a new instance of the ExpressionFunction.


ExpressionFunction

public ExpressionFunction(ExpressionFunction copy)
Copy constructor. Create a copy of the provided instance.

Parameters:
copy - The instance to copy.
Method Detail

initialiseParser

protected void initialiseParser()

getClone

public ExpressionFunction getClone()
Create a cloned copy of the current object and return it. In general the created copy will be a deep copy of the provided instance. As a result this operation an be quite expensive if used incorrectly.

Specified by:
getClone in interface Cloneable
Specified by:
getClone in class ContinuousFunction
Returns:
An exact clone of the current object instance.
See Also:
Object.clone()

evaluate

public double evaluate(Vector x)
Evaluate the function with the given Vector as input.

Specified by:
evaluate in class ContinuousFunction
Parameters:
x - The input Vector.
Returns:
The value of the evaluation.

getExpression

public String getExpression()
Get the defined function.

Returns:
The defined function string.

setExpression

public void setExpression(String expression)
Set the parseable function.

Parameters:
expression - The string to parse and set as the function.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2009 CIRG. All Rights Reserved.