1 |
#ifndef _CONJUGATEMINIMIZER_H_
|
2 |
#define _CONJUGATEMINIMIZER_H_
|
3 |
|
4 |
#include "MinimizerBase.hpp"
|
5 |
|
6 |
//abstract class of conjugate gradient minimizer
|
7 |
class ConjugateMinimizerBase : public MinimizerUsingLineSearch{
|
8 |
|
9 |
public:
|
10 |
|
11 |
ConjugateMinimizerBase(NLModel1* nlmodel);
|
12 |
~ConjugateMinimizerBase();
|
13 |
|
14 |
bool isSolvable();
|
15 |
virtual void Init();
|
16 |
virtual void Minimize();
|
17 |
virtual int checkConvergence();
|
18 |
virtual void reset();
|
19 |
virtual void printMinizerInfo();
|
20 |
|
21 |
protected:
|
22 |
|
23 |
double calcGamma(vector<double>& newGrad, vector<double>& oldGrad) = 0;
|
24 |
NLModel0 * 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 |
protected:
|
36 |
|
37 |
double calcGamma(vector<double>& newGrad, vector<double>& oldGrad);
|
38 |
|
39 |
};
|
40 |
|
41 |
//Polak-Reeves Conjugate Gradient Method
|
42 |
class PRCGMinimizer : public ConjugateMinimizerBase{
|
43 |
|
44 |
protected:
|
45 |
|
46 |
double calcGamma(vector<double>& newGrad, vector<double>& oldGrad);
|
47 |
};
|
48 |
|
49 |
#endif
|