de.jstacs.algorithms.optimization
Class DifferentiableFunction
java.lang.Object
de.jstacs.algorithms.optimization.DifferentiableFunction
- All Implemented Interfaces:
- Function
- Direct Known Subclasses:
- LogPrior, NegativeDifferentiableFunction, NumericalDifferentiableFunction, OptimizableFunction
public abstract class DifferentiableFunction
- extends Object
- implements Function
This class is the framework for any (at least) one time differentiable function f: R^n -> R.
- Author:
- Jens Keilwagen
Method Summary |
abstract double[] |
evaluateGradientOfFunction(double[] x)
Evaluates the gradient of function at a certain vector (in mathematical sense) x |
protected double[] |
findOneDimensionalMin(double[] current,
double[] d,
double alpha_0,
double fAlpha_0,
double linEps,
double startDistance)
This method is used to find an approximation of an onedimensional subfunction. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DifferentiableFunction
public DifferentiableFunction()
evaluateGradientOfFunction
public abstract double[] evaluateGradientOfFunction(double[] x)
throws DimensionException,
EvaluationException
- Evaluates the gradient of function at a certain vector (in mathematical sense)
x
- Parameters:
x
- the current vector
- Returns:
- the elvaluation of the gradient of a function; has dimension
getDimensionOfScope()
- Throws:
DimensionException
- if dim(x) != n, with f: R^n -> R
EvaluationException
- if there was a mistake in evaluating the gradient- See Also:
Function.getDimensionOfScope()
findOneDimensionalMin
protected double[] findOneDimensionalMin(double[] current,
double[] d,
double alpha_0,
double fAlpha_0,
double linEps,
double startDistance)
throws DimensionException,
EvaluationException
- This method is used to find an approximation of an onedimensional subfunction. That means it will find an
approximation of the minimum starting at point
current
and search in direction d
.
\argmin_{alpha >= 0} f(current + alpha*d)
This method is a standard implementation. You are enabled to overwrite this method to be faster, if you know
anything about the problem or if you just want to test other line search methods.
- Parameters:
current
- the start pointd
- the searh directionalpha_0
- the initial alphafAlpha_0
- the initial function value (this value is know in most cases and does not have to be computed again)linEps
- the tolerance for stopping this methodstartDistance
- the initial distance for bracketing the minimum
- Returns:
double[2] res = { alpha*, f(alpha*) }
- Throws:
DimensionException
EvaluationException