| 1 |
tim |
970 |
#ifndef _MINIMIZERBASE_H_
|
| 2 |
|
|
#define _MINIMIZERBASE_H_
|
| 3 |
|
|
|
| 4 |
tim |
1000 |
#include <string>
|
| 5 |
tim |
1002 |
#include <vector>
|
| 6 |
tim |
1000 |
|
| 7 |
|
|
#include "MinimizerParameterSet.hpp"
|
| 8 |
tim |
1010 |
#include "NLModel.hpp"
|
| 9 |
tim |
1000 |
|
| 10 |
tim |
1002 |
#define MINSTATUS_ERROR -1
|
| 11 |
|
|
#define MINSTATUS_CONVERGE 0
|
| 12 |
|
|
#define MINSTATUS_MAXITER 1
|
| 13 |
|
|
|
| 14 |
tim |
1000 |
using namespace std;
|
| 15 |
|
|
|
| 16 |
tim |
970 |
class MinimizerBase{
|
| 17 |
|
|
public:
|
| 18 |
|
|
|
| 19 |
tim |
1002 |
//initialize the minimizer method
|
| 20 |
tim |
1023 |
virtual void init() = 0;
|
| 21 |
tim |
1002 |
|
| 22 |
|
|
//minimize the model
|
| 23 |
|
|
virtual void minimize() = 0;
|
| 24 |
tim |
1031 |
|
| 25 |
tim |
1002 |
//
|
| 26 |
|
|
virtual int checkConvergence() = 0;
|
| 27 |
|
|
|
| 28 |
|
|
//check whether the model and the method are matched or not
|
| 29 |
tim |
970 |
virtual bool isSolvable() = 0;
|
| 30 |
|
|
|
| 31 |
tim |
1002 |
// get the final status of minimization
|
| 32 |
tim |
1010 |
int getMinimizationStatus() {return minStatus;}
|
| 33 |
tim |
1002 |
|
| 34 |
|
|
// get the name of minimization method
|
| 35 |
|
|
const string getName() {return minimizerName;}
|
| 36 |
|
|
|
| 37 |
|
|
//set the name of minimiation method
|
| 38 |
|
|
void setName(const string& name) { minimizerName = name;}
|
| 39 |
|
|
|
| 40 |
|
|
protected:
|
| 41 |
|
|
|
| 42 |
|
|
int minStatus;
|
| 43 |
|
|
string minimizerName;
|
| 44 |
|
|
|
| 45 |
|
|
};
|
| 46 |
|
|
|
| 47 |
tim |
970 |
#endif
|