Directory: | ./ |
---|---|
File: | unittest/factory/solver.hpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 6 | 100.0% |
Branches: | 4 | 6 | 66.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2019-2024, University of Edinburgh, LAAS-CNRS, | ||
5 | // New York University, Max Planck Gesellschaft, | ||
6 | // Heriot-Watt University | ||
7 | // Copyright note valid unless otherwise stated in individual files. | ||
8 | // All rights reserved. | ||
9 | /////////////////////////////////////////////////////////////////////////////// | ||
10 | |||
11 | #ifndef CROCODDYL_SOLVER_FACTORY_HPP_ | ||
12 | #define CROCODDYL_SOLVER_FACTORY_HPP_ | ||
13 | |||
14 | #include "action.hpp" | ||
15 | #include "crocoddyl/core/solver-base.hpp" | ||
16 | #include "crocoddyl/core/solvers/kkt.hpp" | ||
17 | |||
18 | namespace crocoddyl { | ||
19 | namespace unittest { | ||
20 | |||
21 | struct SolverTypes { | ||
22 | enum Type { | ||
23 | SolverKKT, | ||
24 | SolverDDP, | ||
25 | SolverFDDP, | ||
26 | SolverBoxDDP, | ||
27 | SolverBoxFDDP, | ||
28 | SolverIpopt, | ||
29 | NbSolverTypes | ||
30 | }; | ||
31 | 23 | static std::vector<Type> init_all() { | |
32 | 23 | std::vector<Type> v; | |
33 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | v.reserve(NbSolverTypes); |
34 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 23 times.
|
161 | for (int i = 0; i < NbSolverTypes; ++i) { |
35 | #ifndef CROCODDYL_WITH_IPOPT | ||
36 | if ((Type)i == SolverIpopt) { | ||
37 | continue; | ||
38 | } | ||
39 | #endif | ||
40 |
1/2✓ Branch 1 taken 138 times.
✗ Branch 2 not taken.
|
138 | v.push_back((Type)i); |
41 | } | ||
42 | 23 | return v; | |
43 | } | ||
44 | static const std::vector<Type> all; | ||
45 | }; | ||
46 | |||
47 | std::ostream& operator<<(std::ostream& os, SolverTypes::Type type); | ||
48 | |||
49 | class SolverFactory { | ||
50 | public: | ||
51 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
52 | |||
53 | explicit SolverFactory(); | ||
54 | ~SolverFactory(); | ||
55 | |||
56 | boost::shared_ptr<crocoddyl::SolverAbstract> create( | ||
57 | SolverTypes::Type solver_type, | ||
58 | boost::shared_ptr<crocoddyl::ActionModelAbstract> model, | ||
59 | boost::shared_ptr<crocoddyl::ActionModelAbstract> model2, | ||
60 | boost::shared_ptr<crocoddyl::ActionModelAbstract> modelT, size_t T) const; | ||
61 | }; | ||
62 | |||
63 | } // namespace unittest | ||
64 | } // namespace crocoddyl | ||
65 | |||
66 | #endif // CROCODDYL_SOLVER_FACTORY_HPP_ | ||
67 |