-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPCsolver.h
63 lines (51 loc) · 3.7 KB
/
MPCsolver.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
57
58
59
60
61
62
63
#ifndef MPCSOLVER_H_
#define MPCSOLVER_H_
#include <string>
#include <vector>
#include <Eigen/Dense>
using namespace Eigen;
class MPCsolver
{
public:
enum printLevelType {NONE, LOW, MEDIUM, HIGH};
enum solverType {AUTO, PRIMAL, DUAL, NETWORK, BARRIER, SIFTING, CONCURRENT};
virtual bool initProblem() =0;
virtual bool setProblem(const Ref<const MatrixXd> hessian, const Ref<const VectorXd> gradient) =0;
virtual bool setProblem(const Ref<const MatrixXd> hessian, const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B) =0;
virtual bool setProblem(const Ref<const MatrixXd> hessian, const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B,
const std::vector<VectorXd>& l, const std::vector<MatrixXd> Q, const std::vector<double>& r) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient, const std::vector<VectorXd>& l, const std::vector<MatrixXd> Q, const std::vector<double>& r) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B,
const std::vector<VectorXd>& l, const std::vector<MatrixXd> Q, const std::vector<double>& r) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B,
const Ref<const MatrixXd> Aeq, const Ref<const VectorXd> Beq) =0;
virtual bool setProblem(const std::vector<double>& lowerBound, const std::vector<double>& upperBound, const Ref<const MatrixXd> hessian,
const Ref<const VectorXd> gradient, const Ref<const MatrixXd> A, const Ref<const VectorXd> B, const Ref<const MatrixXd> Aeq,
const Ref<const VectorXd> Beq, const std::vector<VectorXd>& l, const std::vector<MatrixXd> Q, const std::vector<double>& r) =0;
virtual bool solveProblem(Ref<VectorXd> result, int& optimizerStatus) =0;
virtual void saveProblem(std::string filename) =0;
int get_numVariable() { return _numVariable; }
int get_numEqConstraint() { return _numEqConstraint; }
int get_numIneqConstraint() { return _numIneqConstraint; }
virtual solverType get_solverMethod() =0;
virtual void set_solverMethod(const solverType solver) =0;
virtual void set_solverParams(const double convergence_tolerance_QP, const double convergence_tolerance_QCP,
const double optimality_tolerance, const double feasibility_tolerance) =0;
virtual void set_printLevel(const printLevelType printLevel) =0;
protected:
int _numVariable;
int _numEqConstraint;
int _numIneqConstraint;
int _numQIneqConstraint;
double _convergenceTolQP, _convergenceTolQCP;
double _optimalityTol;
double _feasibilityTol;
};
#endif /* MPCSOLVER_H_ */