WebCab Optimization
v2.6
(J2EE Edition)

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

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

public class ParabolicBracketing
extends BracketingAlgorithm

The parabolic extrapolation bracketing algorithm. This is a general bracketing algorithm (it can be applied to any continuous function). The a, b, and c fields of the result are guaranteed to respect the following condition: a < b && b > c or a > b && b < c . This means that, if the function is continuous. certainly a local maximum (in the first case) or minimum (in the second case) is between a and c. The second point is taken as x + mindist, or the closest point x1 that makes the condition f(x) != f(x1) valid. Unlike in AccelBracketing, the third point is found using a more elaborate heuristic algorithm using parabolic extrapolation.

See Also:
BracketingAlgorithm, AccelBracketing, AccelDerivBracketing, Serialized Form

Constructor Summary
ParabolicBracketing()
           
 
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

ParabolicBracketing

public ParabolicBracketing()
Method Detail

find_initial

protected Bracket find_initial(double x,
                               UniDimensionalFunction f,
                               double mindist)
                        throws InvalidUniDimensionalFunctionException
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. If f(x + mindist) == f(x) the interval is increased until f(x + interval_width) != f(x).

Specified by:
find_initial in class BracketingAlgorithm
Parameters:
x - the starting point
f - the function. May implement UniDimensionalFunction or Derivative.
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 probable that the algorithm will make many iterations until different function values are found.
Returns:
a bracket with points a and b set.
Throws:
InvalidUniDimensionalFunctionException - thrown if the user function returns invalid values like infinity or NaN.

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, so we search for a minimum, b must be less than a (unlike in AccelDerivBracketing equality is not permitted). If extreme_type is -1, a must be less than 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)