aligator
0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
expose-callbacks.cpp
Go to the documentation of this file.
1
2
#include "
aligator/python/callbacks.hpp
"
3
#include "
aligator/helpers/history-callback.hpp
"
4
5
#include "
aligator/solvers/proxddp/solver-proxddp.hpp
"
6
#include "
aligator/solvers/fddp/solver-fddp.hpp
"
7
8
namespace
aligator
{
9
namespace
python {
10
11
using
context::Scalar
;
12
using
context::SolverFDDP
;
13
using
context::SolverProxDDP
;
14
using
HistoryCallback
=
HistoryCallbackTpl<Scalar>
;
15
16
#define ctor(Solver) \
17
bp::init<Solver *, bool, bool>( \
18
("self"_a, "solver", "store_pd_vars"_a = true, "store_values"_a = true))
19
20
void
exposeHistoryCallback
() {
21
22
bp::scope in_history =
23
bp::class_<HistoryCallback, bp::bases<CallbackBase>>(
24
"HistoryCallback"
,
"Store the history of solver's variables."
,
25
bp::no_init)
26
.def(ctor(SolverProxDDP))
27
.def(ctor(SolverFDDP))
28
#define
_c
(name) def_readonly(#name, &HistoryCallback::name)
29
._c(xs)
30
._c(us)
31
._c(lams)
32
._c(values)
33
._c(merit_values)
34
._c(merit_values)
35
._c(prim_infeas)
36
._c(dual_infeas)
37
._c(inner_crits)
38
._c(al_index)
39
._c(prim_tols)
40
._c(dual_tols);
41
#undef _c
42
}
43
44
void
exposeCallbacks
() {
45
bp::register_ptr_to_python<shared_ptr<CallbackBase>>();
46
47
bp::class_<CallbackWrapper, boost::noncopyable>(
48
"BaseCallback"
,
"Base callback for solvers."
, bp::init<>((
"self"
_a)))
49
.def(
"call"
, bp::pure_virtual(&
CallbackWrapper::call
),
50
bp::args(
"self"
,
"workspace"
,
"results"
));
51
52
exposeHistoryCallback
();
53
}
54
}
// namespace python
55
}
// namespace aligator
callbacks.hpp
_c
#define _c(name)
history-callback.hpp
aligator::context::Scalar
double Scalar
Definition
context.hpp:9
aligator::context::SolverProxDDP
SolverProxDDPTpl< Scalar > SolverProxDDP
Definition
context.hpp:41
aligator::context::SolverFDDP
SolverFDDPTpl< Scalar > SolverFDDP
Definition
context.hpp:42
aligator::python::exposeHistoryCallback
void exposeHistoryCallback()
Definition
expose-callbacks.cpp:20
aligator::python::exposeCallbacks
void exposeCallbacks()
Expose solver callbacks.
Definition
expose-callbacks.cpp:44
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
solver-fddp.hpp
solver-proxddp.hpp
Definitions for the proximal trajectory optimization algorithm.
aligator::HistoryCallbackTpl
Store the history of results.
Definition
history-callback.hpp:14
aligator::python::CallbackWrapper::call
void call(const WorkspaceBaseTpl< context::Scalar > &w, const ResultsBaseTpl< context::Scalar > &r)
Definition
callbacks.hpp:14
bindings
python
src
expose-callbacks.cpp
Generated by
1.11.0