2 |
|
|
3 |
|
#define _MININIZERPARAMETERSET_H_ |
4 |
|
|
5 |
+ |
namespace oopse { |
6 |
|
|
6 |
– |
|
7 |
– |
const double DEFAULTTOLERANCE = 1.0e-8; |
8 |
– |
|
9 |
– |
|
10 |
– |
|
7 |
|
// base class of minimizer's parameter set |
8 |
|
|
9 |
< |
class MinimizerParameterSet{ |
9 |
> |
class MinimizerParameterSet { |
10 |
> |
public: |
11 |
|
|
12 |
< |
public: |
12 |
> |
MinimizerParameterSet() { |
13 |
> |
setDefaultParameter(); |
14 |
> |
} |
15 |
|
|
16 |
+ |
MinimizerParameterSet(MinimizerParameterSet ¶m) { |
17 |
+ |
* this = param; |
18 |
+ |
} |
19 |
|
|
20 |
+ |
void operator =(MinimizerParameterSet ¶m) { |
21 |
+ |
maxIteration = param.maxIteration; |
22 |
|
|
23 |
< |
MinimizerParameterSet() {setDefaultParameter();} |
23 |
> |
stepSize = param.stepSize; |
24 |
|
|
25 |
< |
MinimizerParameterSet(MinimizerParameterSet& param) {*this = param;} |
25 |
> |
stepTol = param.stepTol; |
26 |
|
|
27 |
< |
|
27 |
> |
fTol = param.fTol; |
28 |
|
|
29 |
< |
void operator= (MinimizerParameterSet& param) { |
29 |
> |
gTol = param.gTol; |
30 |
|
|
31 |
+ |
writeFrq = param.writeFrq; |
32 |
|
|
33 |
+ |
lsMaxIteration = param.lsMaxIteration; |
34 |
|
|
35 |
< |
maxIteration = param.maxIteration; |
35 |
> |
lsTol = param.lsTol; |
36 |
> |
} |
37 |
|
|
38 |
< |
stepSize = param.stepSize; |
38 |
> |
virtual void setDefaultParameter() { |
39 |
> |
maxIteration = 200; |
40 |
|
|
41 |
< |
stepTol = param.stepTol; |
41 |
> |
stepSize = 0.01; |
42 |
|
|
43 |
< |
fTol = param.fTol; |
43 |
> |
stepTol = DEFAULTTOLERANCE; |
44 |
|
|
45 |
< |
gTol = param.gTol; |
45 |
> |
fTol = DEFAULTTOLERANCE; |
46 |
|
|
47 |
+ |
gTol = DEFAULTTOLERANCE; |
48 |
|
|
49 |
+ |
writeFrq = maxIteration; |
50 |
|
|
51 |
< |
writeFrq = param.writeFrq; |
51 |
> |
lsMaxIteration = 50; |
52 |
|
|
53 |
+ |
lsTol = DEFAULTTOLERANCE; |
54 |
+ |
} |
55 |
|
|
56 |
+ |
void setStepTol(double tol) { |
57 |
+ |
stepTol = tol; |
58 |
+ |
} |
59 |
|
|
60 |
< |
lsMaxIteration = param.lsMaxIteration; |
60 |
> |
double getStepTol() { |
61 |
> |
return stepTol; |
62 |
> |
} |
63 |
|
|
64 |
< |
lsTol = param.lsTol; |
64 |
> |
void setStepSize(double size) { |
65 |
> |
stepSize = size; |
66 |
> |
} |
67 |
|
|
68 |
+ |
double getStepSize() { |
69 |
+ |
return stepSize; |
70 |
+ |
} |
71 |
|
|
72 |
+ |
void setMaxIteration(int iter) { |
73 |
+ |
maxIteration = iter; |
74 |
+ |
} |
75 |
|
|
76 |
< |
} |
76 |
> |
int getMaxIteration() { |
77 |
> |
return maxIteration; |
78 |
> |
} |
79 |
|
|
80 |
< |
|
80 |
> |
void setFTol(double tol) { |
81 |
> |
fTol = tol; |
82 |
> |
} |
83 |
|
|
84 |
< |
virtual void setDefaultParameter(){ |
84 |
> |
double getFTol() { |
85 |
> |
return fTol; |
86 |
> |
} |
87 |
|
|
88 |
< |
maxIteration = 200; |
88 |
> |
void setGTol(double tol) { |
89 |
> |
gTol = tol; |
90 |
> |
} |
91 |
|
|
92 |
< |
stepSize = 0.01; |
92 |
> |
double getGTol() { |
93 |
> |
return gTol; |
94 |
> |
} |
95 |
|
|
96 |
< |
stepTol = DEFAULTTOLERANCE; |
96 |
> |
void setLineSearchTol(double tol) { |
97 |
> |
lsTol = tol; |
98 |
> |
} |
99 |
|
|
100 |
< |
fTol = DEFAULTTOLERANCE; |
100 |
> |
double getLineSearchTol() { |
101 |
> |
return lsTol; |
102 |
> |
} |
103 |
|
|
104 |
< |
gTol = DEFAULTTOLERANCE; |
104 |
> |
void setLineSearchMaxIteration(int iter) { |
105 |
> |
lsMaxIteration = iter; |
106 |
> |
} |
107 |
|
|
108 |
+ |
int getLineSearchMaxIteration() { |
109 |
+ |
return lsMaxIteration; |
110 |
+ |
} |
111 |
|
|
112 |
+ |
void setWriteFrq(int frq) { |
113 |
+ |
writeFrq = frq; |
114 |
+ |
} |
115 |
|
|
116 |
< |
writeFrq = maxIteration; |
116 |
> |
int getWriteFrq() { |
117 |
> |
return writeFrq; |
118 |
> |
} |
119 |
|
|
120 |
< |
|
120 |
> |
protected: |
121 |
|
|
122 |
< |
lsMaxIteration = 50; |
122 |
> |
int maxIteration; |
123 |
|
|
124 |
< |
lsTol = DEFAULTTOLERANCE; |
124 |
> |
double stepTol; |
125 |
|
|
126 |
< |
} |
126 |
> |
double fTol; |
127 |
|
|
128 |
< |
|
128 |
> |
double gTol; |
129 |
|
|
130 |
< |
void setStepTol(double tol) { stepTol = tol;} |
130 |
> |
double stepSize; |
131 |
|
|
132 |
< |
double getStepTol() { return stepTol;} |
132 |
> |
int lsMaxIteration; |
133 |
|
|
134 |
+ |
double lsTol; |
135 |
|
|
136 |
+ |
int writeFrq; |
137 |
|
|
138 |
< |
void setStepSize(double size) { stepSize = size;} |
138 |
> |
static const double DEFAULTTOLERANCE = 1.0e-8; |
139 |
|
|
89 |
– |
double getStepSize() { return stepSize;} |
90 |
– |
|
91 |
– |
|
92 |
– |
|
93 |
– |
void setMaxIteration(int iter) { maxIteration = iter;} |
94 |
– |
|
95 |
– |
int getMaxIteration() {return maxIteration;} |
96 |
– |
|
97 |
– |
|
98 |
– |
|
99 |
– |
void setFTol(double tol) {fTol = tol;} |
100 |
– |
|
101 |
– |
double getFTol() {return fTol;} |
102 |
– |
|
103 |
– |
|
104 |
– |
|
105 |
– |
void setGTol(double tol) {gTol = tol;} |
106 |
– |
|
107 |
– |
double getGTol() {return gTol;} |
108 |
– |
|
109 |
– |
|
110 |
– |
|
111 |
– |
void setLineSearchTol(double tol) {lsTol = tol;} |
112 |
– |
|
113 |
– |
double getLineSearchTol() {return lsTol;} |
114 |
– |
|
115 |
– |
|
116 |
– |
|
117 |
– |
void setLineSearchMaxIteration(int iter) {lsMaxIteration = iter;} |
118 |
– |
|
119 |
– |
int getLineSearchMaxIteration() {return lsMaxIteration;} |
120 |
– |
|
121 |
– |
|
122 |
– |
|
123 |
– |
void setWriteFrq(int frq) {writeFrq = frq;} |
124 |
– |
|
125 |
– |
int getWriteFrq() {return writeFrq;} |
126 |
– |
|
127 |
– |
|
128 |
– |
|
129 |
– |
protected: |
130 |
– |
|
131 |
– |
|
132 |
– |
|
133 |
– |
int maxIteration; |
134 |
– |
|
135 |
– |
double stepTol; |
136 |
– |
|
137 |
– |
double fTol; |
138 |
– |
|
139 |
– |
double gTol; |
140 |
– |
|
141 |
– |
double stepSize; |
142 |
– |
|
143 |
– |
|
144 |
– |
|
145 |
– |
int lsMaxIteration; |
146 |
– |
|
147 |
– |
double lsTol; |
148 |
– |
|
149 |
– |
|
150 |
– |
|
151 |
– |
int writeFrq; |
152 |
– |
|
153 |
– |
//int resetFrq; |
154 |
– |
|
155 |
– |
/* |
156 |
– |
|
157 |
– |
// Absolute tolerance |
158 |
– |
|
159 |
– |
std::vector<double> absTol; |
160 |
– |
|
161 |
– |
|
162 |
– |
|
163 |
– |
// Relative tolerance |
164 |
– |
|
165 |
– |
std::vector<double> relTol; |
166 |
– |
|
167 |
– |
|
168 |
– |
|
169 |
– |
// Total specified tolerance at convergence |
170 |
– |
|
171 |
– |
std::vector<double> totTol; |
172 |
– |
|
173 |
– |
|
174 |
– |
|
175 |
– |
// Tolerance achieved at convergence. |
176 |
– |
|
177 |
– |
std::vector<double> achTol; |
178 |
– |
|
179 |
– |
*/ |
180 |
– |
|
140 |
|
}; |
141 |
|
|
142 |
< |
|
184 |
< |
|
185 |
< |
|
186 |
< |
|
142 |
> |
} |
143 |
|
#endif |
188 |
– |
|