aligator  0.9.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
5namespace aligator {
6namespace python {
7
9
11 using HistoryCallback = HistoryCallbackTpl<Scalar>;
12
13 bp::scope in_history =
14 bp::class_<HistoryCallback, bp::bases<CallbackBase>>(
15 "HistoryCallback", "Store the history of solver's variables.",
16 bp::init<bool, bool, bool>((bp::arg("self"),
17 bp::arg("store_pd_vars") = true,
18 bp::arg("store_values") = true,
19 bp::arg("store_residuals") = true)))
20#define _c(name) def_readonly(#name, &HistoryCallback::name)
21 ._c(xs)
22 ._c(us)
23 ._c(lams)
24 ._c(values)
25 ._c(merit_values)
26 ._c(merit_values)
27 ._c(prim_infeas)
28 ._c(dual_infeas)
29 ._c(inner_crits)
30 ._c(al_index)
31 ._c(prim_tols)
32 ._c(dual_tols);
33#undef _c
34}
35
37 bp::register_ptr_to_python<shared_ptr<CallbackBase>>();
38
39 bp::class_<CallbackWrapper, boost::noncopyable>("BaseCallback",
40 "Base callback for solvers.",
41 bp::init<>(bp::args("self")))
42 .def("call", bp::pure_virtual(&CallbackWrapper::call),
43 bp::args("self", "workspace", "results"));
44
46}
47} // namespace python
48} // namespace aligator
#define _c(name)
void exposeCallbacks()
Expose solver callbacks.
Main package namespace.
Store the history of results.
void call(const WorkspaceBaseTpl< context::Scalar > &w, const ResultsBaseTpl< context::Scalar > &r)
Definition callbacks.hpp:14