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: 1073658 $ $Date: 2011-02-23 10:45:42 +0100 (mer. 23 févr. 2011) $

### Method Summary

Methods
`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:
  the 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:
  the 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.
  `java.lang.IllegalStateException` - if there are no data.

#### getResult

    double getResult()

Get the result of the last run of the optimizer.

Returns:
  the optimum.
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()
                            throws FunctionEvaluationException

Get the result of the last run of the optimizer.

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