| 1 |
|
#ifndef _MININIZERPARAMETERSET_H_ |
| 2 |
|
#define _MININIZERPARAMETERSET_H_ |
| 3 |
|
|
| 4 |
+ |
const double DEFAULTTOLERANCE = 1.0e-4; |
| 5 |
+ |
|
| 6 |
|
// base class of minimizer's parameter set |
| 7 |
|
class MinimizerParameterSet{ |
| 8 |
|
public: |
| 7 |
– |
MinimizerParameterSet(int dim); |
| 9 |
|
|
| 10 |
< |
virtual void setDefaultParameter(); |
| 10 |
> |
MinimizerParameterSet(); |
| 11 |
> |
MinimizerParameterSet(MinimizerParameterSet& param) {*this = param;} |
| 12 |
> |
|
| 13 |
> |
void operator= (MinimizerParameterSet& param) { |
| 14 |
|
|
| 15 |
< |
void setMaxIteration(int iteration) { maxIteration = iteration;} |
| 16 |
< |
int getMaxIteration() { return maxIteration;} |
| 15 |
> |
maxIteration = param.maxIteration; |
| 16 |
> |
stepTol = param.stepTol; |
| 17 |
> |
lsTol = param.lsTol; |
| 18 |
> |
fTol = param.fTol; |
| 19 |
> |
gTol = param.gTol; |
| 20 |
> |
} |
| 21 |
|
|
| 22 |
< |
void setStepSize(double step) { stepSize = step;} |
| 23 |
< |
double getStepSize() { return stepSize;} |
| 22 |
> |
virtual void setDefaultParameter(){ |
| 23 |
> |
maxIteration = 200; |
| 24 |
> |
stepTol = DEFAULTTOLERANCE; |
| 25 |
> |
fTol = DEFAULTTOLERANCE; |
| 26 |
> |
gTol = DEFAULTTOLERANCE; |
| 27 |
|
|
| 28 |
< |
void setMaxStep(double step) { maxStep = step;} |
| 29 |
< |
double getMaxStep() {return maxStep;} |
| 28 |
> |
lsMaxIteration = 50 |
| 29 |
> |
lsTol = 1.0e-4; |
| 30 |
> |
} |
| 31 |
> |
|
| 32 |
> |
|
| 33 |
> |
void setStepTol(double tol) { stepTol = tol;} |
| 34 |
> |
double getStepTol() { return stepTol;} |
| 35 |
> |
|
| 36 |
> |
void setMaxIteration(int iter) { maxIteration = iter;} |
| 37 |
> |
int getMaxIteration() {return maxIteration;} |
| 38 |
|
|
| 39 |
< |
void setAbsGradTol(double tol) {absGradTol = tol;} |
| 40 |
< |
double getAbsGradTol() {return absGradTol;} |
| 39 |
> |
void setFTol(double tol) {fTol = tol;} |
| 40 |
> |
double getFTol() {return fTol;} |
| 41 |
|
|
| 42 |
< |
void setAchGradTol(double tol) { absAchGradTol = tol;} |
| 43 |
< |
double getAchGradTol() { return achGradTol;} |
| 42 |
> |
void setGradTol(double tol) {gTol = tol;} |
| 43 |
> |
double getGradTol() {return gTol;} |
| 44 |
|
|
| 45 |
+ |
void setLineSearchTol(double tol) {lsTol = tol;} |
| 46 |
+ |
double setLineSearchTol() {return lsTol;} |
| 47 |
+ |
|
| 48 |
+ |
void setLineSearchTol(int iter) {lsMaxIteration = iter;} |
| 49 |
+ |
int setLineSearchTol() {return lsMaxIteration;} |
| 50 |
+ |
|
| 51 |
+ |
/* |
| 52 |
|
void setAbsTol(vector<double>& tol) { absTol = tol;} |
| 53 |
|
vector<double> getAbsTol() { return absTol;} |
| 54 |
|
|
| 57 |
|
|
| 58 |
|
void setTotTol(vector<double>& tol) { totTol = tol;} |
| 59 |
|
vector<double> getTotTol() { return totTol;} |
| 60 |
+ |
*/ |
| 61 |
|
|
| 62 |
|
protected: |
| 63 |
|
|
| 64 |
|
int maxIteration; |
| 65 |
+ |
double stepTol; |
| 66 |
+ |
double fTol; |
| 67 |
+ |
double gTol; |
| 68 |
|
|
| 69 |
< |
double stepSize; |
| 69 |
> |
int lsMaxIteration; |
| 70 |
> |
double lsTol; |
| 71 |
|
|
| 72 |
< |
// Name of minimizer |
| 42 |
< |
string methodName; |
| 43 |
< |
|
| 44 |
< |
// Absolute gradient tolerance |
| 45 |
< |
double absGradTol; |
| 46 |
< |
|
| 47 |
< |
// Achieved gradient tolerance. |
| 48 |
< |
double achGradTol; |
| 49 |
< |
|
| 72 |
> |
/* |
| 73 |
|
// Absolute tolerance |
| 74 |
|
vector<double> absTol; |
| 75 |
|
|
| 81 |
|
|
| 82 |
|
// Tolerance achieved at convergence. |
| 83 |
|
vector<double> achTol; |
| 84 |
< |
|
| 84 |
> |
*/ |
| 85 |
|
}; |
| 86 |
|
|
| 87 |
|
|