## org.apache.commons.math.optimization
Interface UnivariateRealOptimizer

All Superinterfaces:
  ConvergingAlgorithm

All Known Implementing Classes:
  AbstractUnivariateRealOptimizer, BrentOptimizer, MultiStartUnivariateRealOptimizer

    public interface UnivariateRealOptimizer

extends ConvergingAlgorithm

Interface for (univariate real) optimization algorithms.

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

Method Summary
`int` `getEvaluations()` Get the number of evaluations of the objective function.
`double` `getFunctionValue()` Get the result of the last run of the optimizer.
`int` `getMaxEvaluations()` Get the maximal number of functions evaluations.
`double` `getResult()` Get the result of the last run of the optimizer.
`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.
`void` `setMaxEvaluations(int maxEvaluations)` Set the maximal number of functions evaluations.

Methods inherited from interface org.apache.commons.math.ConvergingAlgorithm
`getAbsoluteAccuracy, getIterationCount, getMaximalIterationCount, getRelativeAccuracy, resetAbsoluteAccuracy, resetMaximalIterationCount, resetRelativeAccuracy, setAbsoluteAccuracy, setMaximalIterationCount, setRelativeAccuracy`

Method Detail

### setMaxEvaluations

    void setMaxEvaluations(int maxEvaluations)

  Set the maximal number of functions evaluations.

  Parameters:
    `maxEvaluations` - maximal number of function evaluations

### getMaxEvaluations

    int getMaxEvaluations()

  Get the maximal number of functions evaluations.

  Returns:
    maximal number of functions evaluations

### getEvaluations

    int getEvaluations()

  Get the number of evaluations of the objective function.

  The number of evaluations corresponds to the last call to the `optimize` method. It is 0 if the method has not been called yet.

  Returns:
    number of evaluations of the objective function

### optimize

    double optimize(UnivariateRealFunction f,
                    GoalType goalType,
                    double min,
                    double max)
                    throws ConvergenceException,
                           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:
    `ConvergenceException` - if the maximum iteration count is exceeded or the optimizer detects convergence problems otherwise.
    `FunctionEvaluationException` - if an error occurs evaluating the function
    `java.lang.IllegalArgumentException` - if min > max or the endpoints do not satisfy the requirements specified by the optimizer

### optimize

    double optimize(UnivariateRealFunction f,
                    GoalType goalType,
                    double min,
                    double max,
                    double startValue)
                    throws ConvergenceException,
                           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:
    `ConvergenceException` - if the maximum iteration count is exceeded or the optimizer detects convergence problems otherwise.
    `FunctionEvaluationException` - if an error occurs evaluating the function
    `java.lang.IllegalArgumentException` - if min > max or the arguments do not satisfy the requirements specified by the optimizer

### getResult

    double getResult()

  Get the result of the last run of the optimizer.

  Returns:
    the last result.
  Throws:
    `java.lang.IllegalStateException` - if there is no result available, either because no result was yet computed or the last attempt failed.

### getFunctionValue

    double getFunctionValue()

  Get the result of the last run of the optimizer.

  Returns:
    the value of the function at the last result.
  Throws:
    `java.lang.IllegalStateException` - if there is no result available, either because no result was yet computed or the last attempt failed.

Copyright (c) 2003-2011 Apache Software Foundation