aligator  0.6.1
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
module.cpp
Go to the documentation of this file.
1
4
8
9#include <eigenpy/optional.hpp>
10
11#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
13#endif
14
15namespace aligator {
16namespace python {
17
18static void exposeEnums() {
19 register_enum_symlink<VerboseLevel>(true);
20
21 bp::enum_<MultiplierUpdateMode>(
22 "MultiplierUpdateMode", "Enum for the kind of multiplier update to use.")
23 .value("NEWTON", MultiplierUpdateMode::NEWTON)
24 .value("PRIMAL", MultiplierUpdateMode::PRIMAL)
25 .value("PRIMAL_DUAL", MultiplierUpdateMode::PRIMAL_DUAL);
26
27 bp::enum_<LinesearchMode>("LinesearchMode", "Linesearch mode.")
28 .value("PRIMAL", LinesearchMode::PRIMAL)
29 .value("PRIMAL_DUAL", LinesearchMode::PRIMAL_DUAL);
30
31 bp::enum_<RolloutType>("RolloutType", "Rollout type.")
32 .value("ROLLOUT_LINEAR", RolloutType::LINEAR)
33 .value("ROLLOUT_NONLINEAR", RolloutType::NONLINEAR)
34 .export_values();
35
36 bp::enum_<HessianApprox>("HessianApprox",
37 "Level of approximation for the Hessian.")
38 .value("HESSIAN_EXACT", HessianApprox::EXACT)
39 .value("HESSIAN_GAUSS_NEWTON", HessianApprox::GAUSS_NEWTON)
40 .value("HESSIAN_BFGS", HessianApprox::BFGS)
41 .export_values();
42
43 bp::enum_<StepAcceptanceStrategy>("StepAcceptanceStrategy",
44 "Step acceptance strategy.")
45 .value("SA_LINESEARCH", StepAcceptanceStrategy::LINESEARCH)
46 .value("SA_FILTER", StepAcceptanceStrategy::FILTER)
47 .export_values();
48}
49
50static void exposeContainers() {
51 StdVectorPythonVisitor<std::vector<long>, true>::expose("StdVec_long");
52 eigenpy::exposeStdVectorEigenSpecificType<context::Vector3s>(
53 "StdVec_Vector3s");
54 StdVectorPythonVisitor<std::vector<bool>, true>::expose("StdVec_bool");
55}
56
57} // namespace python
58} // namespace aligator
59
60BOOST_PYTHON_MODULE(MODULE_NAME) {
61 using namespace aligator::python;
62 using aligator::context::ConstVectorRef;
63
64 bp::docstring_options module_docstring_options(true, true, true);
65
66 bp::scope().attr("__version__") = aligator::printVersion();
67#ifdef ALIGATOR_MULTITHREADING
68 bp::def("get_available_threads", &aligator::omp::get_available_threads,
69 "Get the number of available threads.");
70 bp::def("get_current_threads", &aligator::omp::get_current_threads,
71 "Get the current number of threads.");
72 bp::def("set_omp_default_options", &aligator::omp::set_default_options,
73 ("num_threads"_a, "dynamic"_a = true));
74#endif
75 eigenpy::enableEigenPy();
76
77 eigenpy::OptionalConverter<ConstVectorRef, std::optional>::registration();
78 eigenpy::detail::NoneToPython<std::nullopt_t>::registration();
79
80 bp::import("warnings");
81 bp::import("proxsuite_nlp");
82
83 exposeContainers();
84 exposeGAR();
85 exposeEnums();
86 exposeContainers();
87 exposeFunctions();
88 exposeCosts();
89 exposeConstraint();
90 exposeStage();
91 exposeProblem();
92 exposeFilter();
93 {
94 bp::scope dynamics = get_namespace("dynamics");
95 exposeContinuousDynamics();
96 exposeDynamics();
97 exposeIntegrators();
98 }
99 exposeUtils();
100
101 exposeSolvers();
102 exposeCallbacks();
103 exposeAutodiff();
104
105#ifdef ALIGATOR_WITH_PINOCCHIO
106 exposePinocchioFeatures();
107#endif
108
109#ifdef ALIGATOR_WITH_CROCODDYL_COMPAT
110 {
111 bp::scope croc_ns = get_namespace("croc");
112 exposeCrocoddylCompat();
113 }
114#endif
115}
BOOST_PYTHON_MODULE(MODULE_NAME)
Definition module.cpp:60
std::size_t get_current_threads()
Get the current number of threads.
Definition threads.hpp:33
void set_default_options(std::size_t, bool=true)
Definition threads.hpp:38
std::size_t get_available_threads()
Definition threads.hpp:30
The Python bindings.
Definition blk-matrix.hpp:5
static void exposeEnums()
Definition module.cpp:18
static void exposeContainers()
Definition module.cpp:50
Main package namespace.
@ LINEAR
Linear rollout.
@ NONLINEAR
Nonlinear rollout, using the full dynamics.
std::string printVersion(const std::string &delimiter=".")
Pretty-print the package version number.
Definition version.hpp:13
@ GAUSS_NEWTON
Use the Gauss-Newton approximation.
@ BFGS
Use a BFGS-type approximation.
@ EXACT
Use exact Hessian.