ocra-recipes
Doxygen documentation for the ocra-recipes repository
QLDSolver.h
Go to the documentation of this file.
1 
10 #ifndef _OCRABASE_QLD_SOLVER_H_
11 #define _OCRABASE_QLD_SOLVER_H_
12 
13 //ocra includes
15 #include "ocra/optim/ObjQLD.h"
16 #include "ocra/optim/Buffer.h"
17 
18 //std includes
19 #include <vector>
20 
21 using Eigen::Map;
22 
28 namespace ocra
29 {
37  class QLDSolver : public QuadraticSolver
38  {
39  // ------------------------ structures --------------------------------------
40  public:
41  typedef Map<MatrixXd> MatrixMap;
42  typedef Map<VectorXd> VectorMap;
43 
44  // ------------------------ constructors ------------------------------------
45  private:
47  protected:
48  public:
49  QLDSolver();
50 
51  // ------------------------ public interface --------------------------------
52  public:
53  void setTolerance(double epsilon);
54 
55  double getTolerance(void) const;
56 
57  const std::string& getMoreInfo() const;
58 
59  MatrixXd getP() const;
60  VectorXd getq() const;
61  MatrixXd getA() const;
62  VectorXd getb() const;
63  VectorXd getbp() const;
64  MatrixXd getC() const;
65  VectorXd getd() const;
66  VectorXd getl() const;
67  VectorXd getu() const;
68  VectorXd getxl() const;
69  VectorXd getxu() const;
70 
71  // ------------------------ protected methods -------------------------------
72  protected:
73  void doPrepare();
74  void doSolve();
75  void doConclude();
76 
77  // ------------------------ private methods ---------------------------------
78  private:
79  void resize();
80 
81  void updateObjectiveEquations();
82  void updateEqualityEquations();
83  void updateInequalityEquations();
84  void updateBounds();
85 
86  //unsigned int transferSimpleInequalityToBounds(MatrixBase& C, VectorBase& d); //return the number of 'suppressed' row in C
87  //bool isASingleComponentRow(const MatrixBase& C, const int rowIndex, int& returnColIndex);
88 
89  void translateReturnInfo(eReturnInfo& orcInfo, int qldInfo);
90 
91  // ------------------------ private members ---------------------------------
92  private:
93  ObjQLD* _solver;
94 
95  MatrixMap _C; //< P (nxn)
96  VectorMap _d; //< q (n)
97  MatrixMap _A; //< A (mxn)
98  //< C (pxn)
99  VectorMap _b; //< b (m)
100  //< d (p)
101  VectorMap _xl;
102  VectorMap _xu;
103  double _infinity;
104  double _eps;
105 
106  int info; //< to store the return info of the qld
107 
108  size_t _pt; //< number of unidimensional inequality constraints transfered to bounds
109 
110  Buffer<double> _buffer;
111  };
112 
113  void testQLDSolver();
114 }
115 
116 #endif //_OCRABASE_QLD_SOLVER_H_
117 
118 // cmake:sourcegroup=Solvers
VectorXd getl() const
Definition: QLDSolver.cpp:84
void setTolerance(double epsilon)
Definition: QLDSolver.cpp:31
void testQLDSolver()
Definition: QLDSolver.cpp:377
Declaration file of the QuadraticSolver class.
VectorXd getxl() const
Definition: QLDSolver.cpp:94
QuadraticSolver class.
VectorXd getd() const
Definition: QLDSolver.cpp:79
VectorXd getb() const
Definition: QLDSolver.cpp:64
ObjQLD class.
Definition: ObjQLD.h:52
MatrixXd getA() const
Definition: QLDSolver.cpp:59
const std::string & getMoreInfo() const
Definition: QLDSolver.cpp:43
VectorXd getu() const
Definition: QLDSolver.cpp:89
Optimization-based Robot Controller namespace. a library of classes to write and solve optimization p...
Map< MatrixXd > MatrixMap
Definition: QLDSolver.h:41
VectorXd getq() const
Definition: QLDSolver.cpp:54
double getTolerance(void) const
Definition: QLDSolver.cpp:37
QLDSolver class.
Definition: QLDSolver.h:37
Declaration file of the ObjQLD class. This class should be merged with ocra::ObjQLD. It has been created to have a cml-free solver.
Map< VectorXd > VectorMap
Definition: QLDSolver.h:42
VectorXd getbp() const
Definition: QLDSolver.cpp:69
VectorXd getxu() const
Definition: QLDSolver.cpp:99
MatrixXd getP() const
Definition: QLDSolver.cpp:49
MatrixXd getC() const
Definition: QLDSolver.cpp:74