de.jstacs.algorithms.optimization

## Class OneDimensionalFunction

• ### Constructor Summary

Constructors
Constructor and Description
OneDimensionalFunction()
• ### Method Summary

All Methods
Modifier and Type Method and Description
abstract double evaluateFunction(double x)
Evaluates the function at position x.
double evaluateFunction(double[] x)
Evaluates the function at a certain vector (in mathematical sense) x.
double[] findMin(double lower, double fLower, double eps, double startDistance)
This method returns a minimum x and the value f(x), starting the search at lower.
int getDimensionOfScope()
Returns the dimension of the scope of the Function.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### OneDimensionalFunction

public OneDimensionalFunction()
• ### Method Detail

• #### evaluateFunction

public double evaluateFunction(double[] x)
throws DimensionException,
EvaluationException
Description copied from interface: Function
Evaluates the function at a certain vector (in mathematical sense) x.
Specified by:
evaluateFunction in interface Function
Parameters:
x - the current vector
Returns:
the evaluation of the function
Throws:
DimensionException - if dim(x) != n, with
EvaluationException - if there was something wrong during the evaluation of the function
• #### evaluateFunction

public abstract double evaluateFunction(double x)
throws EvaluationException
Evaluates the function at position x.
Parameters:
x - the current position
Returns:
f(x)
Throws:
EvaluationException - if there was a mistake during evaluation of the function
• #### findMin

public double[] findMin(double lower,
double fLower,
double eps,
double startDistance)
throws EvaluationException
This method returns a minimum x and the value f(x), starting the search at lower. First the minimum is tried to be bracketed and then the interval is tried to be reduced.
This method is a standard implementation and can be overwritten any time. It uses methods from the class Optimizer.
Parameters:
lower - the initial value of x
fLower - the value f(x)
eps - the threshold to stop the search of the minimum
startDistance - the initial distance for bracketing the minimum
Returns:
an array containing x at position 0 and f(x) at position 1
Throws:
EvaluationException - if there was a mistake during the evaluation of the function
Optimizer
public final int getDimensionOfScope()
Description copied from interface: Function
Returns the dimension of the scope of the Function.
getDimensionOfScope in interface Function
the dimension of the scope: n with