GCC Code Coverage Report


Directory: ./
File: include/hpp/centroidal-dynamics/solver_LP_qpoases.hh
Date: 2025-03-17 04:04:52
Exec Total Coverage
Lines: 2 4 50.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*
2 * Copyright 2015, LAAS-CNRS
3 * Author: Andrea Del Prete
4 */
5
6 #ifndef HPP_CENTROIDAL_DYNAMICS_SOLVER_LP_QPOASES_HH
7 #define HPP_CENTROIDAL_DYNAMICS_SOLVER_LP_QPOASES_HH
8
9 #include <hpp/centroidal-dynamics/local_config.hh>
10 #include <hpp/centroidal-dynamics/solver_LP_abstract.hh>
11 #include <hpp/centroidal-dynamics/util.hh>
12 #include <qpOASES.hpp>
13
14 namespace centroidal_dynamics {
15
16 class CENTROIDAL_DYNAMICS_DLLAPI Solver_LP_qpoases : public Solver_LP_abstract {
17 private:
18 qpOASES::Options m_options; // solver options
19 qpOASES::SQProblem m_solver; // qpoases solver
20
21 MatrixXX m_H; // Hessian matrix
22 bool m_init_succeeded; // true if solver has been successfully initialized
23 qpOASES::returnValue m_status; // status code returned by the solver
24
25 public:
26 Solver_LP_qpoases();
27
28 24 virtual ~Solver_LP_qpoases() {}
29
30 /** Solve the linear program
31 * minimize c' x
32 * subject to Alb <= A x <= Aub
33 * lb <= x <= ub
34 */
35 LP_status solve(Cref_vectorX c, Cref_vectorX lb, Cref_vectorX ub,
36 Cref_matrixXX A, Cref_vectorX Alb, Cref_vectorX Aub,
37 Ref_vectorX sol);
38
39 /** Get the status of the solver. */
40 virtual LP_status getStatus();
41
42 /** Get the objective value of the last solved problem. */
43 9015 virtual double getObjectiveValue() { return m_solver.getObjVal(); }
44
45 virtual void getDualSolution(Ref_vectorX res) {
46 m_solver.getDualSolution(res.data());
47 }
48 };
49
50 } // end namespace centroidal_dynamics
51
52 #endif // HPP_CENTROIDAL_DYNAMICS_SOLVER_LP_QPOASES_HH
53