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

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