WebCab Optimization
v2.6
(J2EE Edition)

com.webcab.ejb.math.optimization.unidimensional
Class AccelDerivBracketing

java.lang.Object
  |
  +--com.webcab.ejb.math.optimization.unidimensional.BracketingAlgorithm
        |
        +--com.webcab.ejb.math.optimization.unidimensional.AccelDerivBracketing
All Implemented Interfaces:
Serializable

public class AccelDerivBracketing
extends BracketingAlgorithm

A version of the acceleration algorithm which uses derivative information. This bracketing algorithm can be used only for differentiable functions. If you try using this algorithm with a function for which you don't supply a derivative, a ClassCastException will be thrown.

The first point is chosen `statically' like in the other bracketing algorithms, then it is modified until it is a `reasonable' modification (that is in accordance with the problem dimension).

In the case of differentiable functions, the derivative in the initial point gives the sense of modification, so only two points are enough to bracket an extremum. Only the last two points of the bracket, `b' and `c' will actually be calculated; `a' will always be set to the value of the starting point.

See Also:
BracketingAlgorithm, AccelBracketing, ParabolicBracketing, Serialized Form

Constructor Summary
AccelDerivBracketing()
           
 
Method Summary
protected  Bracket extend(Bracket br, UniDimensionalFunction f, double bparam, int extreme_type)
          Expands the bracketing interval until it surely contains at least one extremum of the given type.
protected  Bracket find_initial(double x, UniDimensionalFunction f, double mindist)
          Finds an initial, reasonable large interval, which can be subsequently enlarged by extend.
 
Methods inherited from class com.webcab.ejb.math.optimization.unidimensional.BracketingAlgorithm
bracketBidir, bracketUnidir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccelDerivBracketing

public AccelDerivBracketing()
Method Detail

find_initial

protected Bracket find_initial(double x,
                               UniDimensionalFunction f,
                               double mindist)
                        throws InvalidUniDimensionalFunctionException,
                               ClassCastException
Finds an initial, reasonable large interval, which can be subsequently enlarged by extend. The algorithm initially sets the `b' point of the bracket to x + mindist, then modifies this value until the sign of the derivative or the variation of the function value is not zero.

Specified by:
find_initial in class BracketingAlgorithm
Parameters:
x - the starting point
f - the function. If the function does not implement derivative an UniDimensionalException will be thrown.
mindist - The first try for the `b' parameter in the bracket is x + mindist. The value for this should be of the same order with the tolerance or less. If this is too large, it is possible to skip over one or more extrema. If it is very small, it is possible that the algorithm makes many iterations until a reasonable modification is found (however this is less probable than in AccelBracketing, as here we have derivative information).
Returns:
a bracket with points `a' and `b' set; a < b; f(a) == voldg; f(b) == oldg; Point a is always equal with `x'. If a variation of the derivative sign, or of the function value cannot be detected, then the function is probably constant and a null reference is returned.
Throws:
InvalidUniDimensionalFunctionException - thrown if the user function returns invalid values like infinity or NaN.
ClassCastException

extend

protected Bracket extend(Bracket br,
                         UniDimensionalFunction f,
                         double bparam,
                         int extreme_type)
                  throws InvalidUniDimensionalFunctionException,
                         UniDimensionalException
Expands the bracketing interval until it surely contains at least one extremum of the given type. Obs.: the extreme type must be consistent with the bracket supplied i.e. if extreme_type is 1, (we search for a minimum) `b' must be less than or equal to `a' (unlike in AccelBracketing and in ParabolicBracketing equality is permitted). If extreme_type is -1, a must be less than or equal to `b'. This is guaranteed if the bracket is set by the corresponding find_initial method.

Specified by:
extend in class BracketingAlgorithm
Parameters:
br - the bracket with points a and b set.
f - the function. If the function does not implement Derivative an UniDimensionalException will be thrown.
bparam - the acceleration factor for interval expansion. See Mathematical Documentation for a discussion on recommended acceleration factors. Good values are 1.5 for increased safety or 2 for fast results.
extreme_type - Specifies the type of extremum: 1 for minimum or -1 for maximum.
Returns:
a bracket with points a, b and c set. Point a is always equal with x.
Throws:
InvalidUniDimensionalFunctionException - thrown if the user function returns invalid values like infinity or NaN.
UniDimensionalException

WebCab Optimization
v2.6
(J2EE Edition)