org.apache.commons.math3.optim.nonlinear.vector.jacobian
Class LevenbergMarquardtOptimizer

java.lang.Object
  extended by org.apache.commons.math3.optim.BaseOptimizer<PAIR>
      extended by org.apache.commons.math3.optim.BaseMultivariateOptimizer<PointVectorValuePair>
          extended by org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer
              extended by org.apache.commons.math3.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer
                  extended by org.apache.commons.math3.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer
                      extended by org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer

public class LevenbergMarquardtOptimizer
extends AbstractLeastSquaresOptimizer

This class solves a least-squares problem using the Levenberg-Marquardt algorithm.

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:

The redistribution policy for MINPACK is available here, for convenience, it is reproduced below.

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:
  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: This product includes software developed by the University of Chicago, as Operator of Argonne National Laboratory. Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear.
  4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL BE CORRECTED.
  5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES.

    Since:
    2.0
    Version:
    $Id: LevenbergMarquardtOptimizer.java 1416643 2012-12-03 19:37:14Z tn $

    Field Summary
     
    Fields inherited from class org.apache.commons.math3.optim.BaseOptimizer
    evaluations, iterations
     
    Constructor Summary
    LevenbergMarquardtOptimizer()
              Build an optimizer for least squares problems with default values for all the tuning parameters (see the other contructor.
    LevenbergMarquardtOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
              Constructor that allows the specification of a custom convergence checker.
    LevenbergMarquardtOptimizer(double initialStepBoundFactor, ConvergenceChecker<PointVectorValuePair> checker, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold)
              Constructor that allows the specification of a custom convergence checker, in addition to the standard ones.
    LevenbergMarquardtOptimizer(double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance)
              Build an optimizer for least squares problems with default values for some of the tuning parameters (see the other contructor.
    LevenbergMarquardtOptimizer(double initialStepBoundFactor, double costRelativeTolerance, double parRelativeTolerance, double orthoTolerance, double threshold)
              The arguments control the behaviour of the default convergence checking procedure.
     
    Method Summary
    protected  PointVectorValuePair doOptimize()
              Performs the bulk of the optimization algorithm.
     
    Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer
    computeCost, computeCovariances, computeResiduals, computeSigma, computeWeightedJacobian, getChiSquare, getRMS, getWeightSquareRoot, optimize, setCost
     
    Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer
    computeJacobian
     
    Methods inherited from class org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer
    computeObjectiveValue, getTarget, getTargetSize, getWeight
     
    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, incrementEvaluationCount, incrementIterationCount
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    LevenbergMarquardtOptimizer

    public LevenbergMarquardtOptimizer()
    Build an optimizer for least squares problems with default values for all the tuning parameters (see the other contructor. The default values for the algorithm settings are:


    LevenbergMarquardtOptimizer

    public LevenbergMarquardtOptimizer(ConvergenceChecker<PointVectorValuePair> checker)
    Constructor that allows the specification of a custom convergence checker. Note that all the usual convergence checks will be disabled. The default values for the algorithm settings are:

    Parameters:
    checker - Convergence checker.

    LevenbergMarquardtOptimizer

    public LevenbergMarquardtOptimizer(double initialStepBoundFactor,
                                       ConvergenceChecker<PointVectorValuePair> checker,
                                       double costRelativeTolerance,
                                       double parRelativeTolerance,
                                       double orthoTolerance,
                                       double threshold)
    Constructor that allows the specification of a custom convergence checker, in addition to the standard ones.

    Parameters:
    initialStepBoundFactor - 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 non-zero, or else to initialStepBoundFactor itself. In most cases factor should lie in the interval (0.1, 100.0). 100 is a generally recommended value.
    checker - Convergence checker.
    costRelativeTolerance - Desired relative error in the sum of squares.
    parRelativeTolerance - Desired relative error in the approximate solution parameters.
    orthoTolerance - Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.
    threshold - 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.

    LevenbergMarquardtOptimizer

    public LevenbergMarquardtOptimizer(double costRelativeTolerance,
                                       double parRelativeTolerance,
                                       double orthoTolerance)
    Build an optimizer for least squares problems with default values for some of the tuning parameters (see the other contructor. The default values for the algorithm settings are:

    Parameters:
    costRelativeTolerance - Desired relative error in the sum of squares.
    parRelativeTolerance - Desired relative error in the approximate solution parameters.
    orthoTolerance - Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.

    LevenbergMarquardtOptimizer

    public LevenbergMarquardtOptimizer(double initialStepBoundFactor,
                                       double costRelativeTolerance,
                                       double parRelativeTolerance,
                                       double orthoTolerance,
                                       double threshold)
    The arguments control the behaviour of the default convergence checking procedure. Additional criteria can defined through the setting of a ConvergenceChecker.

    Parameters:
    initialStepBoundFactor - 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 non-zero, or else to initialStepBoundFactor itself. In most cases factor should lie in the interval (0.1, 100.0). 100 is a generally recommended value.
    costRelativeTolerance - Desired relative error in the sum of squares.
    parRelativeTolerance - Desired relative error in the approximate solution parameters.
    orthoTolerance - Desired max cosine on the orthogonality between the function vector and the columns of the Jacobian.
    threshold - 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.
    Method Detail

    doOptimize

    protected PointVectorValuePair doOptimize()
    Performs the bulk of the optimization algorithm.

    Specified by:
    doOptimize in class BaseOptimizer<PointVectorValuePair>
    Returns:
    the point/value pair giving the optimal value of the objective function.


    Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.