|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer
org.apache.commons.math.optimization.general.NonLinearConjugateGradientOptimizer
public class 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.
Nested Class Summary | |
---|---|
private static class |
NonLinearConjugateGradientOptimizer.IdentityPreconditioner
Default identity preconditioner. |
private class |
NonLinearConjugateGradientOptimizer.LineSearchFunction
Internal class for line search. |
Field Summary | |
---|---|
private double |
initialStep
Initial step used to bracket the optimum in line search. |
private Preconditioner |
preconditioner
Preconditioner (may be null). |
private UnivariateRealSolver |
solver
solver to use in the line search (may be null). |
private ConjugateGradientFormula |
updateFormula
Update formula for the beta parameter. |
Fields inherited from class org.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer |
---|
checker, DEFAULT_MAX_ITERATIONS, goalType, point |
Constructor Summary | |
---|---|
NonLinearConjugateGradientOptimizer(ConjugateGradientFormula updateFormula)
Simple constructor with default settings. |
Method Summary | |
---|---|
protected RealPointValuePair |
doOptimize()
Perform the bulk of optimization algorithm. |
private double |
findUpperBound(UnivariateRealFunction f,
double a,
double h)
Find the upper bound b ensuring bracketing of a root between a and b |
void |
setInitialStep(double initialStep)
Set the initial step used to bracket the optimum in line search. |
void |
setLineSearchSolver(UnivariateRealSolver solver)
Set the solver to use during line search. |
void |
setPreconditioner(Preconditioner preconditioner)
Set the preconditioner. |
Methods inherited from class org.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer |
---|
computeObjectiveGradient, computeObjectiveValue, getConvergenceChecker, getEvaluations, getGradientEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementIterationsCounter, optimize, setConvergenceChecker, setMaxEvaluations, setMaxIterations |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.math.optimization.DifferentiableMultivariateRealOptimizer |
---|
getConvergenceChecker, getEvaluations, getGradientEvaluations, getIterations, getMaxEvaluations, getMaxIterations, optimize, setConvergenceChecker, setMaxEvaluations, setMaxIterations |
Field Detail |
---|
private final ConjugateGradientFormula updateFormula
private Preconditioner preconditioner
private UnivariateRealSolver solver
private double initialStep
Constructor Detail |
---|
public NonLinearConjugateGradientOptimizer(ConjugateGradientFormula updateFormula)
The convergence check is set to a SimpleVectorialValueChecker
and the maximal number of iterations is set to
AbstractScalarDifferentiableOptimizer.DEFAULT_MAX_ITERATIONS
.
updateFormula
- formula to use for updating the β parameter,
must be one of ConjugateGradientFormula.FLETCHER_REEVES
or ConjugateGradientFormula.POLAK_RIBIERE
Method Detail |
---|
public void setPreconditioner(Preconditioner preconditioner)
preconditioner
- preconditioner to use for next optimization,
may be null to remove an already registered preconditionerpublic void setLineSearchSolver(UnivariateRealSolver solver)
solver
- solver to use during line search, may be null
to remove an already registered solver and fall back to the
default Brent solver
.public void setInitialStep(double initialStep)
The initial step is a factor with respect to the search direction, which itself is roughly related to the gradient of the function
initialStep
- initial step used to bracket the optimum in line search,
if a non-positive value is used, the initial step is reset to its
default value of 1.0protected RealPointValuePair doOptimize() throws FunctionEvaluationException, OptimizationException, java.lang.IllegalArgumentException
doOptimize
in class AbstractScalarDifferentiableOptimizer
FunctionEvaluationException
- if the objective function throws one during
the search
OptimizationException
- if the algorithm failed to converge
java.lang.IllegalArgumentException
- if the start point dimension is wrongprivate double findUpperBound(UnivariateRealFunction f, double a, double h) throws FunctionEvaluationException, OptimizationException
f
- function whose root must be bracketeda
- lower bound of the intervalh
- initial step to try
FunctionEvaluationException
- if the function cannot be computed
OptimizationException
- if no bracket can be found
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |