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
4
7
8namespace aligator {
9namespace python {
10
11using context::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
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
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
53}
54} // namespace python
55} // namespace aligator
#define _c(name)
SolverProxDDPTpl< Scalar > SolverProxDDP
Definition context.hpp:41
SolverFDDPTpl< Scalar > SolverFDDP
Definition context.hpp:42
void exposeCallbacks()
Expose solver callbacks.
Main package namespace.
Definitions for the proximal trajectory optimization algorithm.
Store the history of results.
void call(const WorkspaceBaseTpl< context::Scalar > &w, const ResultsBaseTpl< context::Scalar > &r)
Definition callbacks.hpp:14