NonLinearConjugateGradientOptimizer (Apache Commons Math 3.6.1 API)

org.apache.commons.math3.optim.nonlinear.scalar.gradient

## Class NonLinearConjugateGradientOptimizer

- java.lang.Object
- - org.apache.commons.math3.optim.BaseOptimizer<PAIR>
  - - org.apache.commons.math3.optim.BaseMultivariateOptimizer<PointValuePair>
    - - org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer
      - - org.apache.commons.math3.optim.nonlinear.scalar.GradientMultivariateOptimizer
        - - org.apache.commons.math3.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer

-     public class NonLinearConjugateGradientOptimizer
      extends GradientMultivariateOptimizer

  Non-linear conjugate gradient optimizer.
  This class supports both the Fletcher-Reeves and the Polak-Ribière update formulas for the conjugate search directions. It also supports optional preconditioning.
  Constraints are not supported: the call to `optimize` will throw `MathUnsupportedOperationException` if bounds are passed to it.
  Since:
    2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `NonLinearConjugateGradientOptimizer.BracketingStep` Deprecated. As of v3.3, this class is not used anymore. This setting is replaced by the `initialBracketingRange` argument to the new constructors.
    `static class` | `NonLinearConjugateGradientOptimizer.Formula` Available choices of update formulas for the updating the parameter that is used to compute the successive conjugate search directions.
    `static class` | `NonLinearConjugateGradientOptimizer.IdentityPreconditioner` Default identity preconditioner.

  - ### Field Summary

    - ### Fields inherited from class org.apache.commons.math3.optim.BaseOptimizer

      `evaluations, iterations`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker)` Constructor with default tolerances for the line search (1e-8) and `preconditioner`.
    `NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange)` Constructor with default `preconditioner`.
    `NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange, Preconditioner preconditioner)`
    `NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, UnivariateSolver lineSearchSolver)` Deprecated. as of 3.3. Please use `NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double)` instead.
    `NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, UnivariateSolver lineSearchSolver, Preconditioner preconditioner)` Deprecated. as of 3.3. Please use `NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)` instead.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected PointValuePair` | `doOptimize()` Performs the bulk of the optimization algorithm.
    `PointValuePair` | `optimize(OptimizationData... optData)` Stores data and performs the optimization.
    `protected void` | `parseOptimizationData(OptimizationData... optData)` Scans the list of (required and optional) optimization data that characterize the problem.

    - ### Methods inherited from class org.apache.commons.math3.optim.nonlinear.scalar.GradientMultivariateOptimizer

      `computeObjectiveGradient`

    - ### Methods inherited from class org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer

      `computeObjectiveValue, getGoalType`

    - ### Methods inherited from class org.apache.commons.math3.optim.BaseMultivariateOptimizer

      `getLowerBound, getStartPoint, getUpperBound`

    - ### Methods inherited from class org.apache.commons.math3.optim.BaseOptimizer

      `getConvergenceChecker, getEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementEvaluationCount, incrementIterationCount, optimize`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NonLinearConjugateGradientOptimizer

          public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula,
                                             ConvergenceChecker<PointValuePair> checker)

      Constructor with default tolerances for the line search (1e-8) and `preconditioner`.
      Parameters:
        `updateFormula` - formula to use for updating the β parameter, must be one of `NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES` or `NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE`.
        `checker` - Convergence checker.

    - #### NonLinearConjugateGradientOptimizer

          @Deprecated
          public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula,
                                                        ConvergenceChecker<PointValuePair> checker,
                                                        UnivariateSolver lineSearchSolver)

      Deprecated. as of 3.3. Please use `NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double)` instead.
      Constructor with default `preconditioner`.
      Parameters:
        `updateFormula` - formula to use for updating the β parameter, must be one of `NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES` or `NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE`.
        `checker` - Convergence checker.
        `lineSearchSolver` - Solver to use during line search.

    - #### NonLinearConjugateGradientOptimizer

          public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula,
                                             ConvergenceChecker<PointValuePair> checker,
                                             double relativeTolerance,
                                             double absoluteTolerance,
                                             double initialBracketingRange)

      Constructor with default `preconditioner`.
      Parameters:
        `updateFormula` - formula to use for updating the β parameter, must be one of `NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES` or `NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE`.
        `checker` - Convergence checker.
        `relativeTolerance` - Relative threshold for line search.
        `absoluteTolerance` - Absolute threshold for line search.
        `initialBracketingRange` - Extent of the initial interval used to find an interval that brackets the optimum in order to perform the line search.
      Since:
        3.3
      See Also:
        `LineSearch.LineSearch(MultivariateOptimizer,double,double,double)`

    - #### NonLinearConjugateGradientOptimizer

          @Deprecated
          public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula,
                                                        ConvergenceChecker<PointValuePair> checker,
                                                        UnivariateSolver lineSearchSolver,
                                                        Preconditioner preconditioner)

      Deprecated. as of 3.3. Please use `NonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)` instead.
      Parameters:
        `updateFormula` - formula to use for updating the β parameter, must be one of `NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES` or `NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE`.
        `checker` - Convergence checker.
        `lineSearchSolver` - Solver to use during line search.
        `preconditioner` - Preconditioner.

    - #### NonLinearConjugateGradientOptimizer

          public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula,
                                             ConvergenceChecker<PointValuePair> checker,
                                             double relativeTolerance,
                                             double absoluteTolerance,
                                             double initialBracketingRange,
                                             Preconditioner preconditioner)

      Parameters:
        `updateFormula` - formula to use for updating the β parameter, must be one of `NonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES` or `NonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE`.
        `checker` - Convergence checker.
        `preconditioner` - Preconditioner.
        `relativeTolerance` - Relative threshold for line search.
        `absoluteTolerance` - Absolute threshold for line search.
        `initialBracketingRange` - Extent of the initial interval used to find an interval that brackets the optimum in order to perform the line search.
      Since:
        3.3
      See Also:
        `LineSearch.LineSearch(MultivariateOptimizer,double,double,double)`

  - ### Method Detail

    - #### optimize

          public PointValuePair optimize(OptimizationData... optData)
                                  throws TooManyEvaluationsException

      Stores data and performs the optimization.

      The list of parameters is open-ended so that sub-classes can extend it with arguments specific to their concrete implementations.

      When the method is called multiple times, instance data is overwritten only when actually present in the list of arguments: when not specified, data set in a previous call is retained (and thus is optional in subsequent calls).

      Important note: Subclasses must override `BaseOptimizer.parseOptimizationData(OptimizationData[])` if they need to register their own options; but then, they must also call `super.parseOptimizationData(optData)` within that method.

      Overrides:
        `optimize` in class `GradientMultivariateOptimizer`
      Parameters:
        `optData` - Optimization data. In addition to those documented in `MultivariateOptimizer`, this method will register the following data:
        - `ObjectiveFunctionGradient`
      Returns:
        a point/value pair that satisfies the convergence criteria.
      Throws:
        `TooManyEvaluationsException` - if the maximal number of evaluations (of the objective function) is exceeded.

    - #### doOptimize

          protected PointValuePair doOptimize()

      Performs the bulk of the optimization algorithm.
      Specified by:
        `doOptimize` in class `BaseOptimizer<PointValuePair>`
      Returns:
        the point/value pair giving the optimal value of the objective function.

    - #### parseOptimizationData

          protected void parseOptimizationData(OptimizationData... optData)

      Scans the list of (required and optional) optimization data that characterize the problem.
      Overrides:
        `parseOptimizationData` in class `GradientMultivariateOptimizer`
      Parameters:
        `optData` - Optimization data. The following data will be looked for:
        - `ObjectiveFunctionGradient`

Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.