Class NonLinearConjugateGradientOptimizer
java.lang.Object
org.hipparchus.optim.BaseOptimizer<P>
org.hipparchus.optim.BaseMultivariateOptimizer<PointValuePair>
org.hipparchus.optim.nonlinear.scalar.MultivariateOptimizer
org.hipparchus.optim.nonlinear.scalar.GradientMultivariateOptimizer
org.hipparchus.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer
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
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
MathRuntimeException
if bounds are passed to it.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Available choices of update formulas for the updating the parameter that is used to compute the successive conjugate search directions.static class
Default identity preconditioner. -
Field Summary
Fields inherited from class org.hipparchus.optim.BaseOptimizer
evaluations, iterations
-
Constructor Summary
ConstructorDescriptionNonLinearConjugateGradientOptimizer
(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker) Constructor with default tolerances for the line search (1e-8) andpreconditioner
.NonLinearConjugateGradientOptimizer
(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange) Constructor with defaultpreconditioner
.NonLinearConjugateGradientOptimizer
(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange, Preconditioner preconditioner) Simple constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected PointValuePair
Performs the bulk of the optimization algorithm.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.hipparchus.optim.nonlinear.scalar.GradientMultivariateOptimizer
computeObjectiveGradient
Methods inherited from class org.hipparchus.optim.nonlinear.scalar.MultivariateOptimizer
computeObjectiveValue, getGoalType
Methods inherited from class org.hipparchus.optim.BaseMultivariateOptimizer
getLowerBound, getStartPoint, getUpperBound
Methods inherited from class org.hipparchus.optim.BaseOptimizer
getConvergenceChecker, getEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementEvaluationCount, incrementIterationCount, optimize
-
Constructor Details
-
NonLinearConjugateGradientOptimizer
public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker) Constructor with default tolerances for the line search (1e-8) andpreconditioner
.- Parameters:
updateFormula
- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES
orNonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE
.checker
- Convergence checker.
-
NonLinearConjugateGradientOptimizer
public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange) Constructor with defaultpreconditioner
.- Parameters:
updateFormula
- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES
orNonLinearConjugateGradientOptimizer.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.- See Also:
-
NonLinearConjugateGradientOptimizer
public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, double relativeTolerance, double absoluteTolerance, double initialBracketingRange, Preconditioner preconditioner) Simple constructor.- Parameters:
updateFormula
- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVES
orNonLinearConjugateGradientOptimizer.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.- See Also:
-
-
Method Details
-
optimize
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 callsuper.parseOptimizationData(optData)
within that method.- Overrides:
optimize
in classGradientMultivariateOptimizer
- Parameters:
optData
- Optimization data. In addition to those documented inMultivariateOptimizer
, this method will register the following data:- Returns:
- a point/value pair that satisfies the convergence criteria.
- Throws:
MathIllegalStateException
- if the maximal number of evaluations (of the objective function) is exceeded.
-
doOptimize
Performs the bulk of the optimization algorithm.- Specified by:
doOptimize
in classBaseOptimizer<PointValuePair>
- Returns:
- the point/value pair giving the optimal value of the objective function.
-
parseOptimizationData
Scans the list of (required and optional) optimization data that characterize the problem.- Overrides:
parseOptimizationData
in classGradientMultivariateOptimizer
- Parameters:
optData
- Optimization data. The following data will be looked for:
-