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

ConjugateGradientMinimizer.h

Go to the documentation of this file.
00001 // ConjugateGradientMinimizer.h: interface for the CConjugateGradientMinimizer class.
00002 // 
00004 
00005 // Made UNIX friendly 9/5/02
00006 
00007 #if !defined(AFX_CONJUGATEGRADIENTMINIMIZER_H__2176D52C_749D_4C52_9C91_00755175F63B__INCLUDED_)
00008 #define AFX_CONJUGATEGRADIENTMINIMIZER_H__2176D52C_749D_4C52_9C91_00755175F63B__INCLUDED_
00009 
00010 #if _MSC_VER > 1000
00011 #pragma once
00012 #endif // _MSC_VER > 1000
00013 
00014 #include <iostream>
00015 #include <fstream>
00016 #include <iomanip>
00017 #include <cmath>
00018 #include <cfloat>
00019 #include "Minimizer.h"
00020 #include "Minimizable.h"
00021 #include "MatrixOperations.h"
00022 #include "ParameterFilter.h"
00023 #include "ParameterReader.h"
00024 using namespace std;
00025 
00026 class CConjugateGradientMinimizer : public Minimizer  
00027 {
00028 public:
00029         CConjugateGradientMinimizer(bool searchFlag, CParameterFilter *pFilter, int nIterations, double funcAccuracy, int nRestarts=3, double gradTol=1.0e-06, double funcTol=1.0e-08);
00030         virtual ~CConjugateGradientMinimizer();
00031         double Minimize(double *parameters, Minimizable *minimizable);
00032         void ComputeGradient(double *parameters);
00033         void BracketMinimum(double *xA, double *fA, double *xB, double *fB, double *xC, double *fC);
00034         void BrentLine(double xA, double xB, double xC, double *xM, double *fM);
00035         bool CheckGradTol(double norm);
00036         bool CheckFuncTol(double diff);
00037         // evaluates currentP + alpha*searchDir, for scalar a. Neither the current parameters or
00038         // the searchDirection are changed by the call
00039         double LineEvaluate(double alpha);
00040         // returns sgn(b)*|a|
00041         double SgnProduct(double a, double b);
00042         // returns the force vector
00043         const double *GetForceVector() const {return (const double *)m_pdForceVector;}
00044     int GetNParameters() {return nParameters;}
00045 private:
00046         bool m_bSearchFlag;
00047         static const double m_dGOLD;
00048         int m_iNIterations;
00049         int m_iNRestarts;
00050         // used for finite differencing
00051         double m_dFuncAccuracy;
00052         double m_dGradTol;
00053         double m_dFuncTol;
00054         double *m_pdCurrentParameters;
00055         double *m_pdSearchDirection;
00056         double *m_pdGradient;
00057         double *m_pdForceVector;
00058         // tolerance for line searches
00059         double m_dMinTol;
00060         CMatrixOperations *m_pMO;
00061         CParameterFilter *m_pFilter;
00062         Minimizable *m_pMinimizable;
00063 };
00064 
00065 #endif // !defined(AFX_CONJUGATEGRADIENTMINIMIZER_H__2176D52C_749D_4C52_9C91_00755175F63B__INCLUDED_)

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