Directory: | ./ |
---|---|
File: | bindings/python/solvers/HQPData.cpp |
Date: | 2024-11-10 01:12:44 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 19 | 19 | 100.0% |
Branches: | 13 | 26 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2018 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 | #include "tsid/bindings/python/solvers/expose-solvers.hpp" | ||
19 | #include "tsid/bindings/python/solvers/HQPData.hpp" | ||
20 | |||
21 | namespace tsid { | ||
22 | namespace python { | ||
23 | 7 | void exposeConstraintLevel() { | |
24 |
2/4✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | ConstPythonVisitor<ConstraintLevels>::expose("ConstraintLevel"); |
25 | 7 | } | |
26 | 7 | void exposeHQPData() { | |
27 | typedef solvers::QPDataBaseTpl<double> QPDataBase; | ||
28 | typedef solvers::QPDataTpl<double> QPData; | ||
29 | typedef solvers::QPDataQuadProgTpl<double> QPDataQuadProg; | ||
30 | |||
31 |
2/4✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 7 times.
✗ Branch 6 not taken.
|
7 | HQPPythonVisitor<HQPDatas>::expose("HQPData"); |
32 | |||
33 | // expose QP data structures | ||
34 | 7 | bp::class_<QPDataBase>("QPDataBase") | |
35 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("H", &QPDataBase::H, "Cost matrix") |
36 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("g", &QPDataBase::g) |
37 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("CE", &QPDataBase::CE, "Equality constraint matrix") |
38 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("ce0", &QPDataBase::ce0); |
39 | |||
40 | 7 | bp::class_<QPData, bp::bases<QPDataBase>>("QPData") | |
41 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("CI", &QPData::CI, "Inequality constraint matrix") |
42 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("lb", &QPData::ci_lb, "Inequality constraint lower bound") |
43 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("ub", &QPData::ci_ub, "Inequality constraint upper bound"); |
44 | |||
45 | 7 | bp::class_<QPDataQuadProg, bp::bases<QPDataBase>>("QPDataQuadProg") | |
46 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | .def_readonly("CI", &QPDataQuadProg::CI, |
47 | "Inequality constraint matrix (unilateral)") | ||
48 | 7 | .def_readonly( | |
49 |
1/2✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
|
7 | "ci0", &QPDataQuadProg::ci0, |
50 | "Inequality constraint vector (stacked lower and upper bounds)"); | ||
51 | 7 | } | |
52 | } // namespace python | ||
53 | } // namespace tsid | ||
54 |