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_fast_hpp__ |
19 |
|
|
#define __invdyn_solvers_hqp_eiquadprog_fast_hpp__ |
20 |
|
|
|
21 |
|
|
#include "tsid/deprecated.hh" |
22 |
|
|
#include "tsid/solvers/solver-HQP-base.hpp" |
23 |
|
|
#include "eiquadprog/eiquadprog-fast.hpp" |
24 |
|
|
|
25 |
|
|
namespace tsid { |
26 |
|
|
namespace solvers { |
27 |
|
|
/** |
28 |
|
|
* @brief |
29 |
|
|
*/ |
30 |
|
|
class TSID_DLLAPI SolverHQuadProgFast : public SolverHQPBase { |
31 |
|
|
public: |
32 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
33 |
|
|
|
34 |
|
|
typedef math::Matrix Matrix; |
35 |
|
|
typedef math::Vector Vector; |
36 |
|
|
typedef math::RefVector RefVector; |
37 |
|
|
typedef math::ConstRefVector ConstRefVector; |
38 |
|
|
typedef math::ConstRefMatrix ConstRefMatrix; |
39 |
|
|
|
40 |
|
|
SolverHQuadProgFast(const std::string& name); |
41 |
|
|
|
42 |
|
|
void resize(unsigned int n, unsigned int neq, unsigned int nin); |
43 |
|
|
|
44 |
|
|
/** Solve the given Hierarchical Quadratic Program |
45 |
|
|
*/ |
46 |
|
|
const HQPOutput& solve(const HQPData& problemData); |
47 |
|
|
|
48 |
|
|
/** Retrieve the matrices describing a QP problem from the problem data. */ |
49 |
|
|
void retrieveQPData(const HQPData& problemData, |
50 |
|
|
const bool hessianRegularization = true); |
51 |
|
|
|
52 |
|
|
/** Return the QP data object. */ |
53 |
|
✗ |
const QPDataQuadProg getQPData() const { return m_qpData; } |
54 |
|
|
|
55 |
|
|
/** Get the objective value of the last solved problem. */ |
56 |
|
|
double getObjectiveValue(); |
57 |
|
|
|
58 |
|
|
/** Set the current maximum number of iterations performed by the solver. */ |
59 |
|
|
bool setMaximumIterations(unsigned int maxIter); |
60 |
|
|
|
61 |
|
|
protected: |
62 |
|
|
void sendMsg(const std::string& s); |
63 |
|
|
|
64 |
|
|
// <nVars, nEqCon, 2*nIneqCon> |
65 |
|
|
eiquadprog::solvers::EiquadprogFast m_solver; |
66 |
|
|
|
67 |
|
|
TSID_DEPRECATED Matrix m_H; |
68 |
|
|
TSID_DEPRECATED Vector m_g; |
69 |
|
|
TSID_DEPRECATED Matrix m_CE; |
70 |
|
|
TSID_DEPRECATED Vector m_ce0; |
71 |
|
|
TSID_DEPRECATED Matrix |
72 |
|
|
m_CI; /// twice the rows because inequality constraints are bilateral |
73 |
|
|
TSID_DEPRECATED Vector m_ci0; |
74 |
|
|
double m_objValue; |
75 |
|
|
double m_hessian_regularization; |
76 |
|
|
|
77 |
|
|
Eigen::VectorXi |
78 |
|
|
m_activeSet; /// vector containing the indexes of the active inequalities |
79 |
|
|
int m_activeSetSize; |
80 |
|
|
|
81 |
|
|
unsigned int m_neq; /// number of equality constraints |
82 |
|
|
unsigned int m_nin; /// number of inequality constraints |
83 |
|
|
unsigned int m_n; /// number of variables |
84 |
|
|
|
85 |
|
|
QPDataQuadProgTpl<double> m_qpData; |
86 |
|
|
}; |
87 |
|
|
} // namespace solvers |
88 |
|
|
} // namespace tsid |
89 |
|
|
|
90 |
|
|
#endif // ifndef __invdyn_solvers_hqp_eiquadprog_fast_hpp__ |
91 |
|
|
|