ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/ConjugateMinimizer.hpp
Revision: 1023
Committed: Wed Feb 4 22:26:00 2004 UTC (20 years, 5 months ago) by tim
File size: 1488 byte(s)
Log Message:
Fix a bunch of bugs   :-)
Single version of conjugate gradient with golden search linesearch pass a couple of
functions test. Brent's  algorithm is still broken

File Contents

# User Rev Content
1 tim 969 #ifndef _CONJUGATEMINIMIZER_H_
2     #define _CONJUGATEMINIMIZER_H_
3    
4 tim 1015 #include "Minimizer.hpp"
5 tim 969
6 tim 1000 //abstract class of conjugate gradient minimizer
7 tim 1010 class ConjugateMinimizerBase : public MinimizerUsingLineSearch{
8 tim 1000
9 tim 969 public:
10 tim 1000
11 tim 1023 ConjugateMinimizerBase(NLModel1* nlmodel, MinimizerParameterSet* param);
12     ~ConjugateMinimizerBase() {}
13 tim 1000
14 tim 1023 bool isSolvable();
15     virtual void minimize();
16 tim 1010 virtual int checkConvergence();
17 tim 987 virtual void reset();
18 tim 1000 virtual void printMinizerInfo();
19 tim 1015 virtual void writeOut(vector<double>& x, double iter) {}
20 tim 969
21     protected:
22 tim 1000
23 tim 1015 virtual double calcGamma(vector<double>& newGrad, vector<double>& oldGrad) = 0;
24 tim 1023 NLModel1 * model;
25 tim 1000
26     vector<double> prevGrad;
27     vector<double> gradient;
28     vector<double> prevDirection;
29     vector<double> direction;
30 tim 969 };
31    
32 tim 1000 //Fletcher-Reeves Conjugate Gradient Method
33     class FRCGMinimizer : public ConjugateMinimizerBase{
34 tim 969
35 tim 1023 public:
36     FRCGMinimizer(NLModel1* nlmodel, MinimizerParameterSet* param) :ConjugateMinimizerBase(nlmodel, param){}
37    
38 tim 1000 protected:
39    
40     double calcGamma(vector<double>& newGrad, vector<double>& oldGrad);
41    
42 tim 969 };
43    
44 tim 1000 //Polak-Reeves Conjugate Gradient Method
45     class PRCGMinimizer : public ConjugateMinimizerBase{
46    
47 tim 1023 public:
48     PRCGMinimizer(NLModel1* nlmodel, MinimizerParameterSet* param) :ConjugateMinimizerBase(nlmodel, param){}
49    
50 tim 1000 protected:
51    
52     double calcGamma(vector<double>& newGrad, vector<double>& oldGrad);
53 tim 969 };
54    
55     #endif