edu.jhu.bme.smile.commons.optimize.test
Class FunctionExponential

java.lang.Object
  extended by edu.jhu.bme.smile.commons.optimize.test.FunctionExponential
All Implemented Interfaces:
Optimizable1DContinuous, Optimizable1DContinuousDifferentiable

public class FunctionExponential
extends java.lang.Object
implements Optimizable1DContinuousDifferentiable

Test case to test 1D optimizers. Function is 10-10*exp(-x+1)+5*exp(-2*(x-1)).

Author:
Yufeng Guo, Hanlin Wan

Constructor Summary
FunctionExponential()
          Default constructor.
FunctionExponential(double domMin, double domMax)
          Constructor to set the domain.
 
Method Summary
 double get2ndDerivative(double x)
          Gets the second derivative of the function.
 double get2ndDerivative(double x, double step, int method)
          Gets the second derivative of the function.
 double getDerivative(double x)
          Gets the first derivative of the function.
 double getDerivative(double x, double step, int method)
          Gets the first derivative of the function.
 double getDomainMax()
          Gets the domain maximum
 double getDomainMin()
          Gets the domain minimum.
 double getDomainTolerance()
          Gets the tolerance.
 double getValue(double x)
          Evaluates the function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionExponential

public FunctionExponential()
Default constructor.


FunctionExponential

public FunctionExponential(double domMin,
                           double domMax)
Constructor to set the domain.

Parameters:
domMin - domain minimum
domMax - domain maximum
Method Detail

getDerivative

public double getDerivative(double x)
Gets the first derivative of the function. Uses the default step size and method

Specified by:
getDerivative in interface Optimizable1DContinuousDifferentiable
Parameters:
x - location to calculate derivative
Returns:
derivative at location x

getDerivative

public double getDerivative(double x,
                            double step,
                            int method)
Gets the first derivative of the function. Uses the specified step size and method.

Parameters:
x - location to calculate derivative
step - step size
method - method
Returns:
derivative at location x

get2ndDerivative

public double get2ndDerivative(double x)
Gets the second derivative of the function. Uses the default step size and method

Specified by:
get2ndDerivative in interface Optimizable1DContinuousDifferentiable
Parameters:
x - location to calculate derivative
Returns:
2nd derivative at location x

get2ndDerivative

public double get2ndDerivative(double x,
                               double step,
                               int method)
Gets the second derivative of the function. Uses the specified step size and method.

Parameters:
x - location to calculate derivative
step - step size
method - method
Returns:
2ndderivative at location x

getDomainMax

public double getDomainMax()
Gets the domain maximum

Specified by:
getDomainMax in interface Optimizable1DContinuous
Returns:
domain max

getDomainMin

public double getDomainMin()
Gets the domain minimum.

Specified by:
getDomainMin in interface Optimizable1DContinuous
Returns:
domain min

getValue

public double getValue(double x)
Evaluates the function.

Specified by:
getValue in interface Optimizable1DContinuous
Parameters:
x - the location to evaluate the function at
Returns:
value of the function at x

getDomainTolerance

public double getDomainTolerance()
Gets the tolerance.

Specified by:
getDomainTolerance in interface Optimizable1DContinuous
Returns:
tolerance