ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libmdtools/Minimizer1D.hpp
Revision: 1002
Committed: Mon Feb 2 20:29:41 2004 UTC (21 years, 3 months ago) by tim
File size: 1910 byte(s)
Log Message:
Adding GoldenSection and Brent LineSearch Method

File Contents

# Content
1 #ifndef _MINIMIZER1D_H_
2 #define _MINIMIZER1D_H_
3
4 #include "MinimizerBase.hpp"
5
6 //abstract class of one dimension minimizer for line searching
7 // optimize f(x+val*direction)
8 //some potential problem, such as which class is responsible for deleting NLModel,
9 //can be resolved by using smart pointer
10 class Minimizer1D : public MinimizerBase{
11
12 public:
13 Minimizer1D(NLModel* nlp) {model = nlp;}
14 virtual ~Minimizer1D() {}
15
16 virtual void init() {}
17 virtual bool isSolvable();
18
19 virtual void Minimize() = 0;
20 virtual void Minimize(vector<double>& direction, double left, double right);
21
22 virtual int checkConvergence();
23
24 void setRange(double left, double right) {leftFVal = left, rightVal = right;}
25 void setDirection(vector<double>& direction) {this->direction = direction;}
26 double getMinVar() {return minVar;}
27 double getPrevMinVar() {return prevMinVar;}
28
29 void setMaxIteration(int iter) {maxIteration = iter;}
30
31 int getMaxIteration() {return maxIteration;}
32 int getCurrentIteration() {return currentIter;}
33
34 void setStepTol(double tol) {stepTol =tol;}
35 double getStepTol() {return stepTol;}
36 protected:
37
38 NLModel* model;
39 double leftVar;
40 double rightVar;
41 double fLeft;
42 double fRight;
43 double minVar;
44 double fMinVar;
45 double prevMinVar;
46 double fPrevMinVar;
47
48 vector<double> direction;
49
50 int maxIteration;
51 int currentIter;
52 int stepTol;
53 };
54
55 class GoldenSectionMinimizer : public Minimizer1D{
56
57 public:
58
59 GoldenSectionMinimizer(NLModel* nlp) : Minimizer1D(nlp) {}
60 void Minimize();
61
62 protected:
63
64 double fAlpha;
65 double fBeta;
66 double alpha;
67 double beta;
68
69 };
70
71 class BrentMinimizer : public Minimizer1D{
72 public:
73 BrentMinimizer(NLModel* nlp);
74 void minimize();
75 protected:
76
77 };
78 #endif

Properties

Name Value
svn:executable *