Class LevenbergMarquardtOptimizer
- All Implemented Interfaces:
DifferentiableMultivariateVectorialOptimizer
This implementation should work even for over-determined systems (i.e. systems having more point than equations). Over-determined systems are solved by ignoring the point which have the smallest impact according to their jacobian column norm. Only the rank of the matrix and some loop bounds are changed to implement this.
The resolution engine is a simple translation of the MINPACK lmder routine with minor changes. The changes include the over-determined resolution, the use of inherited convergence checker and the Q.R. decomposition which has been rewritten following the algorithm described in the P. Lascaux and R. Theodor book Analyse numérique matricielle appliquée à l'art de l'ingénieur, Masson 1986.
The authors of the original fortran version are:
- Argonne National Laboratory. MINPACK project. March 1980
- Burton S. Garbow
- Kenneth E. Hillstrom
- Jorge J. More
Minpack Copyright Notice (1999) University of Chicago. All rights reserved |
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
|
- Since:
- 2.0
- Version:
- $Revision: 1073272 $ $Date: 2011-02-22 10:22:25 +0100 (mar. 22 févr. 2011) $
-
Field Summary
Fields inherited from class org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer
checker, cols, cost, DEFAULT_MAX_ITERATIONS, jacobian, objective, point, residuals, residualsWeights, rows, targetValues, wjacobian, wresiduals
-
Constructor Summary
ConstructorsConstructorDescriptionBuild an optimizer for least squares problems. -
Method Summary
Modifier and TypeMethodDescriptionprotected VectorialPointValuePair
Perform the bulk of optimization algorithm.void
setCostRelativeTolerance
(double costRelativeTolerance) Set the desired relative error in the sum of squares.void
setInitialStepBoundFactor
(double initialStepBoundFactor) Set the positive input variable used in determining the initial step bound.void
setOrthoTolerance
(double orthoTolerance) Set the desired max cosine on the orthogonality.void
setParRelativeTolerance
(double parRelativeTolerance) Set the desired relative error in the approximate solution parameters.void
setQRRankingThreshold
(double threshold) Set the desired threshold for QR ranking.Methods inherited from class org.apache.commons.math.optimization.general.AbstractLeastSquaresOptimizer
getChiSquare, getConvergenceChecker, getCovariances, getEvaluations, getIterations, getJacobianEvaluations, getMaxEvaluations, getMaxIterations, getRMS, guessParametersErrors, incrementIterationsCounter, optimize, setConvergenceChecker, setMaxEvaluations, setMaxIterations, updateJacobian, updateResidualsAndCost
-
Constructor Details
-
LevenbergMarquardtOptimizer
public LevenbergMarquardtOptimizer()Build an optimizer for least squares problems.The default values for the algorithm settings are:
vectorial convergence checker
: nullinitial step bound factor
: 100.0maximal iterations
: 1000cost relative tolerance
: 1.0e-10parameters relative tolerance
: 1.0e-10orthogonality tolerance
: 1.0e-10QR ranking threshold
:MathUtils.SAFE_MIN
These default values may be overridden after construction. If the
vectorial convergence checker
is set to a non-null value, it will be used instead of thecost relative tolerance
andparameters relative tolerance
settings.
-
-
Method Details
-
setInitialStepBoundFactor
public void setInitialStepBoundFactor(double initialStepBoundFactor) Set the positive input variable used in determining the initial step bound. This bound is set to the product of initialStepBoundFactor and the euclidean norm of diag*x if nonzero, or else to initialStepBoundFactor itself. In most cases factor should lie in the interval (0.1, 100.0). 100.0 is a generally recommended value.- Parameters:
initialStepBoundFactor
- initial step bound factor
-
setCostRelativeTolerance
public void setCostRelativeTolerance(double costRelativeTolerance) Set the desired relative error in the sum of squares.This setting is used only if the
vectorial convergence checker
is set to null.- Parameters:
costRelativeTolerance
- desired relative error in the sum of squares
-
setParRelativeTolerance
public void setParRelativeTolerance(double parRelativeTolerance) Set the desired relative error in the approximate solution parameters.This setting is used only if the
vectorial convergence checker
is set to null.- Parameters:
parRelativeTolerance
- desired relative error in the approximate solution parameters
-
setOrthoTolerance
public void setOrthoTolerance(double orthoTolerance) Set the desired max cosine on the orthogonality.This setting is always used, regardless of the
vectorial convergence checker
being null or non-null.- Parameters:
orthoTolerance
- desired max cosine on the orthogonality between the function vector and the columns of the jacobian
-
setQRRankingThreshold
public void setQRRankingThreshold(double threshold) Set the desired threshold for QR ranking.If the squared norm of a column vector is smaller or equal to this threshold during QR decomposition, it is considered to be a zero vector and hence the rank of the matrix is reduced.
- Parameters:
threshold
- threshold for QR ranking- Since:
- 2.2
-
doOptimize
protected VectorialPointValuePair doOptimize() throws FunctionEvaluationException, OptimizationException, IllegalArgumentExceptionPerform the bulk of optimization algorithm.- Specified by:
doOptimize
in classAbstractLeastSquaresOptimizer
- Returns:
- the point/value pair giving the optimal value for objective function
- Throws:
FunctionEvaluationException
- if the objective function throws one during the searchOptimizationException
- if the algorithm failed to convergeIllegalArgumentException
- if the start point dimension is wrong
-