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

java.lang.Object
  extended by org.apache.commons.math.ConvergingAlgorithmImpl
      extended by org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
          extended by org.apache.commons.math.optimization.univariate.BrentOptimizer
All Implemented Interfaces:
ConvergingAlgorithm, 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.

Since:
2.0
Version:
$Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $

Field Summary
 
Fields inherited from class org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
functionValue, result, resultComputed
 
Fields inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
absoluteAccuracy, defaultAbsoluteAccuracy, defaultMaximalIterationCount, defaultRelativeAccuracy, iterationCount, maximalIterationCount, relativeAccuracy
 
Constructor Summary
BrentOptimizer()
          Construct a solver.
 
Method Summary
 double optimize(UnivariateRealFunction f, GoalType goalType, double min, double max)
          Find an optimum in the given interval.
 double optimize(UnivariateRealFunction f, GoalType goalType, double min, double max, double startValue)
          Find an optimum in the given interval, start at startValue.
 
Methods inherited from class org.apache.commons.math.optimization.univariate.AbstractUnivariateRealOptimizer
checkResultComputed, clearResult, computeObjectiveValue, getEvaluations, getFunctionValue, getMaxEvaluations, getResult, setMaxEvaluations, setResult
 
Methods inherited from class org.apache.commons.math.ConvergingAlgorithmImpl
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm
getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy
 

Constructor Detail

BrentOptimizer

public BrentOptimizer()
Construct a solver.

Method Detail

optimize

public double optimize(UnivariateRealFunction f,
                       GoalType goalType,
                       double min,
                       double max,
                       double startValue)
                throws MaxIterationsExceededException,
                       FunctionEvaluationException
Find an optimum in the given interval, start at startValue.

An optimizer may require that the interval brackets a single optimum.

Parameters:
f - the function to optimize.
goalType - type of optimization goal: either GoalType.MAXIMIZE or GoalType.MINIMIZE
min - the lower bound for the interval.
max - the upper bound for the interval.
startValue - the start value to use
Returns:
a value where the function is optimum
Throws:
FunctionEvaluationException - if an error occurs evaluating the function
MaxIterationsExceededException

optimize

public double optimize(UnivariateRealFunction f,
                       GoalType goalType,
                       double min,
                       double max)
                throws MaxIterationsExceededException,
                       FunctionEvaluationException
Find an optimum in the given interval.

An optimizer may require that the interval brackets a single optimum.

Parameters:
f - the function to optimize.
goalType - type of optimization goal: either GoalType.MAXIMIZE or GoalType.MINIMIZE
min - the lower bound for the interval.
max - the upper bound for the interval.
Returns:
a value where the function is optimum
Throws:
FunctionEvaluationException - if an error occurs evaluating the function
MaxIterationsExceededException


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