GCC Code Coverage Report


Directory: ./
File: include/tsid/solvers/solver-HQP-eiquadprog-rt.hpp
Date: 2024-11-10 01:12:44
Exec Total Coverage
Lines: 0 2 0.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2017 CNRS
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17
18 #ifndef __invdyn_solvers_hqp_eiquadprog_rt_hpp__
19 #define __invdyn_solvers_hqp_eiquadprog_rt_hpp__
20
21 #include "tsid/math/fwd.hpp"
22 #include "tsid/solvers/fwd.hpp"
23 #include "tsid/solvers/solver-HQP-base.hpp"
24
25 #include "eiquadprog/eiquadprog-rt.hpp"
26
27 namespace tsid {
28 namespace solvers {
29 /**
30 * @brief
31 */
32 template <int nVars, int nEqCon, int nIneqCon>
33 class TSID_DLLAPI SolverHQuadProgRT : public SolverHQPBase {
34 public:
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36
37 typedef math::Matrix Matrix;
38 typedef math::Vector Vector;
39 typedef math::RefVector RefVector;
40 typedef math::ConstRefVector ConstRefVector;
41 typedef math::ConstRefMatrix ConstRefMatrix;
42
43 SolverHQuadProgRT(const std::string& name);
44
45 void resize(unsigned int n, unsigned int neq, unsigned int nin);
46
47 /** Solve the given Hierarchical Quadratic Program
48 */
49 const HQPOutput& solve(const HQPData& problemData);
50
51 // TODO: change eiquadprog-rt to new API
52 /** Retrieve the matrices describing a QP problem from the problem data. */
53 void retrieveQPData(const HQPData& /*problemData*/,
54 const bool /*hessianRegularization = true*/) {};
55
56 // /** Return the QP data object. */
57 // const QPDataQuadProg getQPData() const { return m_qpData; }
58
59 /** Get the objective value of the last solved problem. */
60 double getObjectiveValue();
61
62 /** Set the current maximum number of iterations performed by the solver. */
63 bool setMaximumIterations(unsigned int maxIter);
64
65 protected:
66 void sendMsg(const std::string& s);
67
68 eiquadprog::solvers::RtEiquadprog<nVars, nEqCon, 2 * nIneqCon> m_solver;
69
70 typename RtMatrixX<nVars, nVars>::d m_H;
71 typename RtVectorX<nVars>::d m_g;
72 typename RtMatrixX<nEqCon, nVars>::d m_CE;
73 typename RtVectorX<nEqCon>::d m_ce0;
74 typename RtMatrixX<2 * nIneqCon, nVars>::d
75 m_CI; /// twice the rows because inequality constraints are bilateral
76 typename RtVectorX<2 * nIneqCon>::d m_ci0;
77 double m_objValue;
78
79 double m_hessian_regularization;
80
81 Eigen::VectorXi
82 m_activeSet; /// vector containing the indexes of the active inequalities
83 int m_activeSetSize;
84
85 // Eigen::FullPivLU<template RtMatrixX<nEqCon, nVars> > m_CE_lu;
86 // ColPivHouseholderQR
87
88 int m_neq; /// number of equality constraints
89 int m_nin; /// number of inequality constraints
90 int m_n; /// number of variables
91 };
92 } // namespace solvers
93 } // namespace tsid
94
95 #endif // ifndef __invdyn_solvers_hqp_eiquadprog_rt_hpp__
96