GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/tsid/solvers/solver-HQP-eiquadprog.hpp Lines: 0 2 0.0 %
Date: 2024-02-02 08:47:34 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_hpp__
19
#define __invdyn_solvers_hqp_eiquadprog_hpp__
20
21
#include "tsid/deprecated.hh"
22
#include <tsid/solvers/solver-HQP-base.hpp>
23
24
namespace tsid {
25
namespace solvers {
26
/**
27
 * @brief Abstract interface for a Quadratic Program (HQP) solver.
28
 */
29
class TSID_DLLAPI SolverHQuadProg : public SolverHQPBase {
30
 public:
31
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
32
33
  typedef math::Matrix Matrix;
34
  typedef math::Vector Vector;
35
  typedef math::RefVector RefVector;
36
  typedef math::ConstRefVector ConstRefVector;
37
  typedef math::ConstRefMatrix ConstRefMatrix;
38
39
  SolverHQuadProg(const std::string& name);
40
41
  void resize(unsigned int n, unsigned int neq, unsigned int nin);
42
43
  /** Solve the given Hierarchical Quadratic Program
44
   */
45
  const HQPOutput& solve(const HQPData& problemData);
46
47
  /** Retrieve the matrices describing a QP problem from the problem data. */
48
  void retrieveQPData(const HQPData& problemData,
49
                      const bool hessianRegularization = true);
50
51
  /** Return the QP data object. */
52
  const QPDataQuadProg getQPData() const { return m_qpData; }
53
54
  /** Get the objective value of the last solved problem. */
55
  double getObjectiveValue();
56
57
 protected:
58
  void sendMsg(const std::string& s);
59
60
  TSID_DEPRECATED Matrix m_H;
61
  TSID_DEPRECATED Vector m_g;
62
  TSID_DEPRECATED Matrix m_CE;
63
  TSID_DEPRECATED Vector m_ce0;
64
  TSID_DEPRECATED Matrix m_CI;
65
  TSID_DEPRECATED Vector m_ci0;
66
  double m_objValue;
67
  double m_hessian_regularization;
68
69
  Eigen::VectorXi
70
      m_activeSet;  /// vector containing the indexes of the active inequalities
71
  tsid::math::Index m_activeSetSize;
72
73
#ifdef ELIMINATE_EQUALITY_CONSTRAINTS
74
  //      Eigen::FullPivLU<Matrix>                        m_CE_dec;
75
  //	  Eigen::ColPivHouseholderQR<Matrix>              m_CE_dec; // fast, but
76
  // difficult to retrieve null space basis
77
  //      Eigen::FullPivHouseholderQR<Matrix>             m_CE_dec; // doc says
78
  //      it is slow
79
  Eigen::CompleteOrthogonalDecomposition<Matrix>
80
      m_CE_dec;  // available from Eigen 3.3.0, 40 us for decomposition, 40 us
81
                 // to get null space basis, 40 us to project Hessian
82
  //      Eigen::JacobiSVD<Matrix, Eigen::HouseholderQRPreconditioner> m_CE_dec;
83
  //      // too slow
84
  Matrix m_ZT_H_Z;
85
  Matrix m_CI_Z;
86
#endif
87
88
  unsigned int m_neq;  /// number of equality constraints
89
  unsigned int m_nin;  /// number of inequality constraints
90
  unsigned int m_n;    /// number of variables
91
92
  QPDataQuadProgTpl<double> m_qpData;
93
};
94
}  // namespace solvers
95
}  // namespace tsid
96
97
#endif  // ifndef __invdyn_solvers_hqp_eiquadprog_hpp__