1#include "proxsuite-nlp/python/fwd.hpp"
10 bp::wrapper<helpers::base_callback<context::Scalar>> {
11 CallbackWrapper() =
default;
12 void call(
const context::Workspace &w,
const context::Results &r) {
13 this->get_override(
"call")(w, r);
17void exposeCallbacks() {
18 using context::Scalar;
21 bp::register_ptr_to_python<shared_ptr<callback_t>>();
23 bp::class_<CallbackWrapper, shared_ptr<CallbackWrapper>, boost::noncopyable>(
24 "BaseCallback",
"Base callback for solvers.", bp::init<>())
25 .def(
"call", bp::pure_virtual(&CallbackWrapper::call),
26 bp::args(
"self",
"workspace",
"results"));
29 using history_storage_t =
30 decltype(helpers::history_callback<Scalar>::storage);
32 bp::scope in_history =
33 bp::class_<helpers::history_callback<Scalar>, bp::bases<callback_t>>(
34 "HistoryCallback",
"Store the history of solver's variables.",
35 bp::init<bool, bool, bool>((bp::arg(
"store_pd_vars") =
true,
36 bp::arg(
"store_values") =
true,
37 bp::arg(
"store_residuals") =
true)))
38 .def_readonly(
"storage",
39 &helpers::history_callback<Scalar>::storage);
41 bp::class_<history_storage_t, shared_ptr<history_storage_t>>(
43 .def_readonly(
"xs", &history_storage_t::xs)
44 .def_readonly(
"lams", &history_storage_t::lams)
45 .def_readonly(
"values", &history_storage_t::values)
46 .def_readonly(
"prim_infeas", &history_storage_t::prim_infeas)
47 .def_readonly(
"dual_infeas", &history_storage_t::dual_infeas)
48 .def_readonly(
"ls_alphas", &history_storage_t::ls_alphas)
49 .def_readonly(
"ls_values", &history_storage_t::ls_values)
50 .def_readonly(
"alphas", &history_storage_t::alphas)
51 .def_readonly(
"dmerit_dir", &history_storage_t::dmerit_dir);