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 |
|
✗ |
static std::vector<Type> init_all() { |
32 |
|
✗ |
std::vector<Type> v; |
33 |
|
✗ |
v.reserve(NbSolverTypes); |
34 |
|
✗ |
for (int i = 0; i < NbSolverTypes; ++i) { |
35 |
|
|
#ifndef CROCODDYL_WITH_IPOPT |
36 |
|
|
if ((Type)i == SolverIpopt) { |
37 |
|
|
continue; |
38 |
|
|
} |
39 |
|
|
#endif |
40 |
|
✗ |
v.push_back((Type)i); |
41 |
|
|
} |
42 |
|
✗ |
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 |
|
|
std::shared_ptr<crocoddyl::SolverAbstract> create( |
57 |
|
|
SolverTypes::Type solver_type, |
58 |
|
|
std::shared_ptr<crocoddyl::ActionModelAbstract> model, |
59 |
|
|
std::shared_ptr<crocoddyl::ActionModelAbstract> model2, |
60 |
|
|
std::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 |
|
|
|