solvers/solver-osqp.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
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 __solvers_osqp_hpp__
19 #define __solvers_osqp_hpp__
20 
22 #include "OsqpEigen/OsqpEigen.h"
23 #include <Eigen/Sparse>
24 
25 #ifdef PROFILE_OSQP
26 #define START_PROFILER_OSQP(x) START_PROFILER(x)
27 #define STOP_PROFILER_OSQP(x) STOP_PROFILER(x)
28 #else
29 #define START_PROFILER_OSQP(x)
30 #define STOP_PROFILER_OSQP(x)
31 #endif
32 
33 namespace tsid {
34 namespace solvers {
38 class TSID_DLLAPI SolverOSQP : public SolverHQPBase {
39  public:
40  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 
47 
48  SolverOSQP(const std::string& name);
49  SolverOSQP(const SolverOSQP& other);
50 
51  void resize(unsigned int n, unsigned int neq, unsigned int nin);
52 
54  void retrieveQPData(const HQPData& problemData,
55  const bool hessianRegularization = false);
56 
58  const QPData getQPData() const { return m_qpData; }
59 
61  const HQPOutput& solve(const HQPData& problemData);
62 
64  double getObjectiveValue();
65 
67  bool setMaximumIterations(unsigned int maxIter);
68 
69  void setSigma(double sigma);
70  void setAlpha(double alpha);
71  void setRho(double rho);
72  void setEpsilonAbsolute(double epsAbs);
73  void setEpsilonRelative(double epsRel);
74  void setVerbose(bool isVerbose = false);
75 
76  protected:
77  void sendMsg(const std::string& s);
78 
79  double m_objValue;
81 
82  OsqpEigen::Solver m_solver;
83 
84  unsigned int m_neq;
85  unsigned int m_nin;
86  unsigned int m_n;
87 
89 
90  double m_rho;
91  double m_sigma;
92  double m_alpha;
93  double m_epsAbs;
94  double m_epsRel;
97 };
98 } // namespace solvers
99 } // namespace tsid
100 
101 #endif // ifndef __solvers_osqp_hpp__
Eigen::Ref< Vector > RefVector
Definition: math/fwd.hpp:47
const Eigen::Ref< const Matrix > ConstRefMatrix
Definition: math/fwd.hpp:51
s
Vec3f n
QPDataTpl< double > m_qpData
number of variables
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition: math/fwd.hpp:36
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: math/fwd.hpp:35
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef math::Matrix Matrix
math::ConstRefMatrix ConstRefMatrix
unsigned int m_nin
number of equality constraints
const QPData getQPData() const
const Eigen::Ref< const Vector > ConstRefVector
Definition: math/fwd.hpp:48
int alpha
Definition: ex_4_conf.py:43
Mat & solve(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< Mat > &y)
unsigned int m_n
number of inequality constraints
math::ConstRefVector ConstRefVector
Abstract interface for a Quadratic Program (HQP) solver.


tsid
Author(s): Andrea Del Prete, Justin Carpentier
autogenerated on Sun Jul 2 2023 02:21:51