Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

LevenbergMarquardtMinimizer.h

Go to the documentation of this file.
00001 // LevenbergMarquardtMinimizer.h: interface for the CLevenbergMarquardtMinimizer class.
00002 //
00004 
00005 #if !defined(AFX_LEVENBERGMARQUARDTMINIMIZER_H__B872BB8D_BEEB_412D_BDC2_43D6F067FD89__INCLUDED_)
00006 #define AFX_LEVENBERGMARQUARDTMINIMIZER_H__B872BB8D_BEEB_412D_BDC2_43D6F067FD89__INCLUDED_
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #ifdef _WIN32
00013 #include <mkl.h>
00014 #else
00015 #include "lapack.h"
00016 #endif
00017 
00018 #include <iostream>
00019 #include <fstream>
00020 #include <cmath>
00021 #include <cfloat>
00022 #include <assert.h>
00023 #include "LeastSquaresMinimizer.h"
00024 #include "NLLSMinimizable.h"
00025 #include "ParameterFilter.h"
00026 using namespace std;
00027 
00028 class CLevenbergMarquardtMinimizer : public CLeastSquaresMinimizer  
00029 {
00030 public:
00031         CLevenbergMarquardtMinimizer();
00032         virtual ~CLevenbergMarquardtMinimizer();
00033         // Adds the marquardt parameter to the diagonal
00034         void RescaleDiagonal(double scaleParameter);
00035         // Restores the diagonal elements of the Hessian to their saved values
00036         void RestoreDiagonal();
00037         // Enforce positive semi-definiteness on the parameters
00038         void CheckBounds(double *parameters);
00039         // Obtain the trial parameters from the current parameters and the change
00040         void ObtainTrialParameters(double *currentP, double *deltaP, double *trialP);
00041         // Accepts trial parameters as the new parameters
00042         void AcceptParameters(double *parameters, double *trialP, double newCost);
00043         // The next three functions return true if the values are below their respective
00044         // tolerances
00045         // Computes the fractional cost tolerance
00046         bool ComputeChiSqTol(double oldCost, double newCost);
00047         // Computes the gradient tolerance
00048         bool ComputeGradTol();
00049         // Computes the parameter tolerance
00050         bool ComputeParTol(double *oldP, double *deltaP);
00051 //private:
00052         bool m_bCheckChi;                               // Set to true if you want to use fractional
00053                                                                         //    change in chi^2 as a convergence crit.
00054         bool m_bCheckGrad;                              // Set to true if you want to use the 2-norm
00055                                                                         //    of the gradient as a convergence crit.
00056         bool m_bCheckPar;                               // Set to true if you want to use parameter 
00057                                                                         //    norms as a convergence crit.
00058         bool m_bPositiveSemiDef;                // Set to true if all parameters >= 0.  If you
00059                                                                         //    do so, you must use the identity filter
00060         double m_dLambda;                               // Marquardt parameter
00061         double m_dNu;                                   // Divisor of MarquardtParameter
00062         int m_iNIterations;                             // Maximum number of LM iterations
00063         double m_dChiSqTol;                             // Fractional stopping criterion for Chi squared
00064         double m_dGradTol;                              // Stopping criterion for the norm of the gradient
00065         double m_dParTol;                               // Stopping criterion based on deltaP
00066         double m_dTau;                                  // Small number
00067 };
00068 
00069 #endif // !defined(AFX_LEVENBERGMARQUARDTMINIMIZER_H__B872BB8D_BEEB_412D_BDC2_43D6F067FD89__INCLUDED_)

Generated on Mon Nov 3 09:37:57 2003 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002