org.apache.commons.math.optimization.univariate
Class BrentOptimizer

java.lang.Object
  extended by org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
      extended by org.apache.commons.math.optimization.univariate.BrentOptimizer
All Implemented Interfaces:
BaseOptimizer<UnivariateRealPointValuePair>, BaseUnivariateRealOptimizer<UnivariateRealFunction>, UnivariateRealOptimizer

public class BrentOptimizer
extends AbstractUnivariateRealOptimizer

Implements Richard Brent's algorithm (from his book "Algorithms for Minimization without Derivatives", p. 79) for finding minima of real univariate functions. This implementation is an adaptation partly based on the Python code from SciPy (module "optimize.py" v0.5). If the function is defined on some interval (lo, hi), then this method finds an approximation x to the point at which the function attains its minimum.
The user is responsible for calling ConvergenceChecker prior to using the optimizer.

Since:
2.0
Version:
$Id: BrentOptimizer.java 1181282 2011-10-10 22:35:54Z erans $

Constructor Summary
BrentOptimizer(double rel, double abs)
          The arguments are used implement the original stopping criterion of Brent's algorithm.
 
Method Summary
protected  UnivariateRealPointValuePair doOptimize()
          Method for implementing actual optimization algorithms in derived classes.
 
Methods inherited from class org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
computeObjectiveValue, getConvergenceChecker, getEvaluations, getGoalType, getMax, getMaxEvaluations, getMin, getStartValue, optimize, optimize, setConvergenceChecker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrentOptimizer

public BrentOptimizer(double rel,
                      double abs)
The arguments are used implement the original stopping criterion of Brent's algorithm. abs and rel define a tolerance tol = rel |x| + abs. rel should be no smaller than 2 macheps and preferably not much less than sqrt(macheps), where macheps is the relative machine precision. abs must be positive.

Parameters:
rel - Relative threshold.
abs - Absolute threshold.
Throws:
NotStrictlyPositiveException - if abs <= 0.
NumberIsTooSmallException - if rel < 2 * Math.ulp(1d).
Method Detail

doOptimize

protected UnivariateRealPointValuePair doOptimize()
Method for implementing actual optimization algorithms in derived classes.

Specified by:
doOptimize in class AbstractUnivariateRealOptimizer
Returns:
the optimum and its corresponding function value.


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.