-
Notifications
You must be signed in to change notification settings - Fork 0
/
solver.h
56 lines (47 loc) · 1.04 KB
/
solver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef SOLVER_H
#define SOLVER_H
#include "regressionmodels.h"
#include <memory>
/// Regression task solver
class Solver
{
public:
struct SolverParams
{
public:
SolverParams()
: epsDiff(1e-6)
, epsYMinusF(1e-6)
, nMaxIter(1000)
, verbose(0)
, enableNormalizer(true)
{
}
double epsDiff;
double epsYMinusF;
size_t nMaxIter;
int verbose;
bool enableNormalizer;
};
private:
//Solver state;
bool _isInited = false;
SolverParams _sp;
//input data
std::unique_ptr<IRegressionModel> _regressionModel;
//working set
WorkingSet _ws;
Eigen::VectorXd _modelParams;
public:
Solver(std::unique_ptr<IRegressionModel> rm);
void SolverInit(const SolverParams & sp = SolverParams());
/// One solve step. Genereates and solves SLE from regression model
Eigen::VectorXd SolveStep();
/// Returns result model params
Eigen::VectorXd GetResult() const;
WorkingSet GetWorkingSet() const;
/// Solve problem
/// returns true if solution found
bool Solve();
};
#endif // SOLVER_H