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 tooptimizewill throwMathUnsupportedOperationExceptionif bounds are passed to it.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static classNonLinearConjugateGradientOptimizer.BracketingStepDeprecated.As of v3.3, this class is not used anymore. This setting is replaced by theinitialBracketingRangeargument to the new constructors.static classNonLinearConjugateGradientOptimizer.FormulaAvailable choices of update formulas for the updating the parameter that is used to compute the successive conjugate search directions.static classNonLinearConjugateGradientOptimizer.IdentityPreconditionerDefault identity preconditioner.
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description PointValuePairoptimize(OptimizationData... optData)Stores data and performs the optimization.-
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, optimize
-
-
-
-
Constructor Detail
-
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_REEVESorNonLinearConjugateGradientOptimizer.Formula.POLAK_RIBIERE.checker- Convergence checker.
-
NonLinearConjugateGradientOptimizer
@Deprecated public NonLinearConjugateGradientOptimizer(NonLinearConjugateGradientOptimizer.Formula updateFormula, ConvergenceChecker<PointValuePair> checker, UnivariateSolver lineSearchSolver)
Deprecated. as of 3.3. Please useNonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double)instead.Constructor with defaultpreconditioner.- Parameters:
updateFormula- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVESorNonLinearConjugateGradientOptimizer.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 defaultpreconditioner.- Parameters:
updateFormula- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVESorNonLinearConjugateGradientOptimizer.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 useNonLinearConjugateGradientOptimizer(Formula,ConvergenceChecker,double,double,double,Preconditioner)instead.- Parameters:
updateFormula- formula to use for updating the β parameter, must be one ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVESorNonLinearConjugateGradientOptimizer.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 ofNonLinearConjugateGradientOptimizer.Formula.FLETCHER_REEVESorNonLinearConjugateGradientOptimizer.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 callsuper.parseOptimizationData(optData)within that method.- Overrides:
optimizein 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:
TooManyEvaluationsException- if the maximal number of evaluations (of the objective function) is exceeded.
-
-
DMelt 3.0 © DataMelt by jWork.ORG