Class SequentialGaussNewtonOptimizer
- All Implemented Interfaces:
LeastSquaresOptimizer
This class solve a least-square problem by solving the normal equations of the linearized problem at each iteration.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hipparchus.optim.nonlinear.vector.leastsquares.LeastSquaresOptimizer
LeastSquaresOptimizer.Optimum -
Constructor Summary
ConstructorsConstructorDescriptionCreate a sequential Gauss Newton optimizer.SequentialGaussNewtonOptimizer(MatrixDecomposer decomposer, boolean formNormalEquations, LeastSquaresProblem.Evaluation evaluation) Create a sequential Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations. -
Method Summary
Modifier and TypeMethodDescriptionGet the matrix decomposition algorithm.Get the previous evaluation used by the optimizer.booleanGet if the normal equations are explicitly formed.Solve the non-linear least squares problem.toString()withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance) Configure from a priori state and covariance.withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance, double relativeSymmetryThreshold, double absolutePositivityThreshold) Configure from a priori state and covariance.withDecomposer(MatrixDecomposer newDecomposer) Configure the matrix decomposition algorithm.withEvaluation(LeastSquaresProblem.Evaluation previousEvaluation) Configure the previous evaluation used by the optimizer.withFormNormalEquations(boolean newFormNormalEquations) Configure if the normal equations should be explicitly formed.
-
Constructor Details
-
SequentialGaussNewtonOptimizer
public SequentialGaussNewtonOptimizer()Create a sequential Gauss Newton optimizer.The default for the algorithm is to use QR decomposition, not form normal equations and have no previous evaluation
-
SequentialGaussNewtonOptimizer
public SequentialGaussNewtonOptimizer(MatrixDecomposer decomposer, boolean formNormalEquations, LeastSquaresProblem.Evaluation evaluation) Create a sequential Gauss Newton optimizer that uses the given matrix decomposition algorithm to solve the normal equations.The
decomposeris used to solve JTJx=JTr.- Parameters:
decomposer- the decomposition algorithm to use.formNormalEquations- whether the normal equations should be explicitly formed. Iftruethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r. Ifdecomposercan only solve square systems then this parameter should betrue.evaluation- old evaluation previously computed, null if there are no previous evaluations.
-
-
Method Details
-
getDecomposer
Get the matrix decomposition algorithm.- Returns:
- the decomposition algorithm.
-
withDecomposer
Configure the matrix decomposition algorithm.- Parameters:
newDecomposer- the decomposition algorithm to use.- Returns:
- a new instance.
-
isFormNormalEquations
public boolean isFormNormalEquations()Get if the normal equations are explicitly formed.- Returns:
- if the normal equations should be explicitly formed. If
truethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r.
-
withFormNormalEquations
Configure if the normal equations should be explicitly formed.- Parameters:
newFormNormalEquations- whether the normal equations should be explicitly formed. Iftruethendecomposeris used to solve JTJx=JTr, otherwisedecomposeris used to solve Jx=r. Ifdecomposercan only solve square systems then this parameter should betrue.- Returns:
- a new instance.
-
getOldEvaluation
Get the previous evaluation used by the optimizer.- Returns:
- the previous evaluation.
-
withEvaluation
public SequentialGaussNewtonOptimizer withEvaluation(LeastSquaresProblem.Evaluation previousEvaluation) Configure the previous evaluation used by the optimizer.This building method uses a complete evaluation to retrieve a priori data. Note that as
withAPrioriData(RealVector, RealMatrix)generates a fake evaluation and calls this method, eitherwithAPrioriData(RealVector, RealMatrix)orwithEvaluation(LeastSquaresProblem.Evaluation)should be called, but not both as the last one called will override the previous one.- Parameters:
previousEvaluation- the previous evaluation used by the optimizer.- Returns:
- a new instance.
-
withAPrioriData
public SequentialGaussNewtonOptimizer withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance) Configure from a priori state and covariance.This building method generates a fake evaluation and calls
withEvaluation(LeastSquaresProblem.Evaluation), so eitherwithAPrioriData(RealVector, RealMatrix)orwithEvaluation(LeastSquaresProblem.Evaluation)should be called, but not both as the last one called will override the previous one.A Cholesky decomposition is used to compute the weighted jacobian from the a priori covariance. This method uses the default thresholds of the decomposition.
- Parameters:
aPrioriState- a priori state to useaPrioriCovariance- a priori covariance to use- Returns:
- a new instance.
- See Also:
-
withAPrioriData
public SequentialGaussNewtonOptimizer withAPrioriData(RealVector aPrioriState, RealMatrix aPrioriCovariance, double relativeSymmetryThreshold, double absolutePositivityThreshold) Configure from a priori state and covariance.This building method generates a fake evaluation and calls
withEvaluation(LeastSquaresProblem.Evaluation), so eitherwithAPrioriData(RealVector, RealMatrix)orwithEvaluation(LeastSquaresProblem.Evaluation)should be called, but not both as the last one called will override the previous one.A Cholesky decomposition is used to compute the weighted jacobian from the a priori covariance.
- Parameters:
aPrioriState- a priori state to useaPrioriCovariance- a priori covariance to userelativeSymmetryThreshold- Cholesky decomposition threshold above which off-diagonal elements are considered too different and matrix not symmetricabsolutePositivityThreshold- Cholesky decomposition threshold below which diagonal elements are considered null and matrix not positive definite- Returns:
- a new instance.
- Since:
- 2.3
-
optimize
Solve the non-linear least squares problem.- Specified by:
optimizein interfaceLeastSquaresOptimizer- Parameters:
lsp- the problem definition, including model function and convergence criteria.- Returns:
- The optimum.
-
toString
-