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
2
#include "
aligator/python/callbacks.hpp
"
3
#include "
aligator/helpers/history-callback.hpp
"
4
5
namespace
aligator
{
6
namespace
python {
7
8
using
context::Scalar
;
9
10
void
exposeHistoryCallback
() {
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
36
void
exposeCallbacks
() {
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
45
exposeHistoryCallback
();
46
}
47
}
// namespace python
48
}
// namespace aligator
callbacks.hpp
_c
#define _c(name)
history-callback.hpp
aligator::context::Scalar
double Scalar
Definition
context.hpp:9
aligator::python::exposeHistoryCallback
void exposeHistoryCallback()
Definition
expose-callbacks.cpp:10
aligator::python::exposeCallbacks
void exposeCallbacks()
Expose solver callbacks.
Definition
expose-callbacks.cpp:36
aligator
Main package namespace.
Definition
action-model-wrap.hpp:14
aligator::HistoryCallbackTpl
Store the history of results.
Definition
history-callback.hpp:13
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