alpaqa pantr
Nonconvex constrained optimization
Loading...
Searching...
No Matches
dl-problem.cpp
Go to the documentation of this file.
2
3#include <dlfcn.h>
4#include <cassert>
5#include <memory>
6#include <stdexcept>
7
8namespace alpaqa::dl {
9
10std::shared_ptr<void> DLLoader::load_lib() const {
11 assert(!so_filename.empty());
12 ::dlerror();
13 void *h = ::dlopen(so_filename.c_str(), RTLD_LOCAL | RTLD_NOW);
14 if (auto *err = ::dlerror())
15 throw std::runtime_error(err);
16 return std::shared_ptr<void>{h, &::dlclose};
17}
18
19template <class F>
20F *DLLoader::load_func(std::string_view name) const {
21 assert(handle);
22 auto full_name = symbol_prefix + "_" + std::string(name);
23 ::dlerror();
24 auto *h = ::dlsym(handle.get(), full_name.c_str());
25 if (auto *err = ::dlerror())
26 throw std::runtime_error(err);
27 // We can only hope that the user got the signature right ...
28 return reinterpret_cast<F *>(h);
29}
30
31DLLoader::DLLoader(std::string so_filename, std::string symbol_prefix)
32 : so_filename(std::move(so_filename)),
33 symbol_prefix(std::move(symbol_prefix)), handle(load_lib()) {}
34
35DLProblem::DLProblem(std::string so_filename, std::string symbol_prefix,
36 void *user_param)
37 : DLLoader{std::move(so_filename), std::move(symbol_prefix)},
38 BoxConstrProblem{0, 0} {
39 auto *register_func = load_func<problem_register_t(void *)>("register");
40 auto r = register_func(user_param);
41 // Avoid leaking if std::shared_ptr constructor throws
42 std::unique_ptr<void, void (*)(void *)> unique_inst{r.instance, r.cleanup};
43 std::unique_ptr<alpaqa_function_dict_t> unique_extra{r.extra_functions};
44 // Store data returned by plugin
45 instance = std::shared_ptr<void>{std::move(unique_inst)};
46 functions = r.functions;
47 this->n = r.functions->n;
48 this->m = r.functions->m;
49 this->C = Box{this->n};
50 this->D = Box{this->m};
52 functions->initialize_box_C(instance.get(), this->C.lowerbound.data(),
53 this->C.upperbound.data());
55 functions->initialize_box_D(instance.get(), this->D.lowerbound.data(),
56 this->D.upperbound.data());
58 length_t nλ = 0;
59 functions->initialize_l1_reg(instance.get(), nullptr, &nλ);
60 if (nλ > 0) {
61 this->l1_reg.resize(nλ);
62 functions->initialize_l1_reg(instance.get(), this->l1_reg.data(),
63 &nλ);
64 }
65 }
66 extra_functions = std::shared_ptr<function_dict_t>{std::move(unique_extra)};
67}
68
70 rvec p) const -> real_t {
71 if (functions->eval_prox_grad_step)
72 return functions->eval_prox_grad_step(
73 instance.get(), γ, x.data(), grad_ψ.data(), x̂.data(), p.data());
74 return BoxConstrProblem<config_t>::eval_prox_grad_step(γ, x, grad_ψ, x̂, p);
75}
76
77// clang-format off
78auto DLProblem::eval_f(crvec x) const -> real_t { return functions->eval_f(instance.get(), x.data()); }
79auto DLProblem::eval_grad_f(crvec x, rvec grad_fx) const -> void { return functions->eval_grad_f(instance.get(), x.data(), grad_fx.data()); }
80auto DLProblem::eval_g(crvec x, rvec gx) const -> void { return functions->eval_g(instance.get(), x.data(), gx.data()); }
81auto DLProblem::eval_grad_g_prod(crvec x, crvec y, rvec grad_gxy) const -> void { return functions->eval_grad_g_prod(instance.get(), x.data(), y.data(), grad_gxy.data()); }
82auto DLProblem::eval_grad_gi(crvec x, index_t i, rvec grad_gi) const -> void { return functions->eval_grad_gi(instance.get(), x.data(), i, grad_gi.data()); }
83auto DLProblem::eval_jac_g(crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const -> void { return functions->eval_jac_g(instance.get(), x.data(), inner_idx.data(), outer_ptr.data(), J_values.size() == 0 ? nullptr : J_values.data()); }
85auto DLProblem::eval_hess_L_prod(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const -> void { return functions->eval_hess_L_prod(instance.get(), x.data(), y.data(), scale, v.data(), Hv.data()); }
86auto DLProblem::eval_hess_L(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const -> void { return functions->eval_hess_L(instance.get(), x.data(), y.data(), scale, inner_idx.data(), outer_ptr.data(), H_values.size() == 0 ? nullptr : H_values.data()); }
88auto DLProblem::eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const -> void { return functions->eval_hess_ψ_prod(instance.get(), x.data(), y.data(), Σ.data(), scale, D.lowerbound.data(), D.upperbound.data(), v.data(), Hv.data()); }
89auto DLProblem::eval_hess_ψ(crvec x, crvec y, crvec Σ, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const -> void { return functions->eval_hess_ψ(instance.get(), x.data(), y.data(), Σ.data(), scale, D.lowerbound.data(), D.upperbound.data(), inner_idx.data(), outer_ptr.data(), H_values.size() == 0 ? nullptr : H_values.data()); }
91auto DLProblem::eval_f_grad_f(crvec x, rvec grad_fx) const -> real_t { return functions->eval_f_grad_f(instance.get(), x.data(), grad_fx.data()); }
92auto DLProblem::eval_f_g(crvec x, rvec g) const -> real_t { return functions->eval_f_g(instance.get(), x.data(), g.data()); }
93auto DLProblem::eval_grad_f_grad_g_prod(crvec x, crvec y, rvec grad_f, rvec grad_gxy) const -> void { return functions->eval_grad_f_grad_g_prod(instance.get(), x.data(), y.data(), grad_f.data(), grad_gxy.data()); }
94auto DLProblem::eval_grad_L(crvec x, crvec y, rvec grad_L, rvec work_n) const -> void { return functions->eval_grad_L(instance.get(), x.data(), y.data(), grad_L.data(), work_n.data()); }
95auto DLProblem::eval_ψ(crvec x, crvec y, crvec Σ, rvec ŷ) const -> real_t { return functions->eval_ψ(instance.get(), x.data(), y.data(), Σ.data(), D.lowerbound.data(), D.upperbound.data(), ŷ.data()); }
96auto DLProblem::eval_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const -> void { return functions->eval_grad_ψ(instance.get(), x.data(), y.data(), Σ.data(), D.lowerbound.data(), D.upperbound.data(), grad_ψ.data(), work_n.data(), work_m.data()); }
97auto DLProblem::eval_ψ_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const -> real_t { return functions->eval_ψ_grad_ψ(instance.get(), x.data(), y.data(), Σ.data(), D.lowerbound.data(), D.upperbound.data(), grad_ψ.data(), work_n.data(), work_m.data()); }
98
99bool DLProblem::provides_eval_f() const { return functions->eval_f != nullptr; }
100bool DLProblem::provides_eval_grad_f() const { return functions->eval_grad_f != nullptr; }
101bool DLProblem::provides_eval_g() const { return functions->eval_g != nullptr; }
103bool DLProblem::provides_eval_jac_g() const { return functions->eval_jac_g != nullptr; }
105bool DLProblem::provides_eval_grad_gi() const { return functions->eval_grad_gi != nullptr; }
107bool DLProblem::provides_eval_hess_L() const { return functions->eval_hess_L != nullptr; }
110bool DLProblem::provides_eval_hess_ψ() const { return functions->eval_hess_ψ != nullptr; }
113bool DLProblem::provides_eval_f_g() const { return functions->eval_f_g != nullptr; }
115bool DLProblem::provides_eval_grad_L() const { return functions->eval_grad_L != nullptr; }
116bool DLProblem::provides_eval_ψ() const { return functions->eval_ψ != nullptr; }
117bool DLProblem::provides_eval_grad_ψ() const { return functions->eval_grad_ψ != nullptr; }
120// clang-format on
121
122#if ALPAQA_WITH_OCP
123
125 std::string symbol_prefix, void *user_param)
126 : DLLoader{std::move(so_filename), std::move(symbol_prefix)} {
127 auto *register_func =
128 load_func<control_problem_register_t(void *)>("register");
129 auto r = register_func(user_param);
130 // Avoid leaking if std::shared_ptr constructor throws
131 std::unique_ptr<void, void (*)(void *)> unique_inst{r.instance, r.cleanup};
132 std::unique_ptr<alpaqa_function_dict_t> unique_extra{r.extra_functions};
133 // Store data returned by plugin
134 instance = std::shared_ptr<void>{std::move(unique_inst)};
135 functions = r.functions;
136 extra_functions = std::shared_ptr<function_dict_t>{std::move(unique_extra)};
137}
138
139// clang-format off
140auto DLControlProblem::get_U(Box &U) const -> void { return functions->get_U(instance.get(), U.lowerbound.data(), U.upperbound.data()); }
141auto DLControlProblem::get_D(Box &D) const -> void { return functions->get_D(instance.get(), D.lowerbound.data(), D.upperbound.data()); }
142auto DLControlProblem::get_D_N(Box &D) const -> void { return functions->get_D_N(instance.get(), D.lowerbound.data(), D.upperbound.data()); }
143auto DLControlProblem::get_x_init(rvec x_init) const -> void { return functions->get_x_init(instance.get(), x_init.data()); }
144auto DLControlProblem::eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const -> void { return functions->eval_f(instance.get(), timestep, x.data(), u.data(), fxu.data()); }
145auto DLControlProblem::eval_jac_f(index_t timestep, crvec x, crvec u, rmat J_fxu) const -> void { return functions->eval_jac_f(instance.get(), timestep, x.data(), u.data(), J_fxu.data()); }
146auto DLControlProblem::eval_grad_f_prod(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const -> void { return functions->eval_grad_f_prod(instance.get(), timestep, x.data(), u.data(), p.data(), grad_fxu_p.data()); }
147auto DLControlProblem::eval_h(index_t timestep, crvec x, crvec u, rvec h) const -> void { return functions->eval_h(instance.get(), timestep, x.data(), u.data(), h.data()); }
148auto DLControlProblem::eval_h_N(crvec x, rvec h) const -> void { return functions->eval_h_N(instance.get(), x.data(), h.data()); }
149auto DLControlProblem::eval_l(index_t timestep, crvec h) const -> real_t { return functions->eval_l(instance.get(), timestep, h.data()); }
150auto DLControlProblem::eval_l_N(crvec h) const -> real_t { return functions->eval_l_N(instance.get(), h.data()); }
151auto DLControlProblem::eval_qr(index_t timestep, crvec xu, crvec h, rvec qr) const -> void { return functions->eval_qr(instance.get(), timestep, xu.data(), h.data(), qr.data()); }
152auto DLControlProblem::eval_q_N(crvec x, crvec h, rvec q) const -> void { return functions->eval_q_N(instance.get(), x.data(), h.data(), q.data()); }
153auto DLControlProblem::eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) const -> void { return functions->eval_add_Q(instance.get(), timestep, xu.data(), h.data(), Q.data()); }
154auto DLControlProblem::eval_add_Q_N(crvec x, crvec h, rmat Q) const -> void { return functions->eval_add_Q_N(instance.get(), x.data(), h.data(), Q.data()); }
155auto DLControlProblem::eval_add_R_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const -> void { return functions->eval_add_R_masked(instance.get(), timestep, xu.data(), h.data(), mask.data(), R.data(), work.data()); }
156auto DLControlProblem::eval_add_S_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const -> void { return functions->eval_add_S_masked(instance.get(), timestep, xu.data(), h.data(), mask.data(), S.data(), work.data()); }
157auto DLControlProblem::eval_add_R_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_J, crindexvec mask_K, crvec v, rvec out, rvec work) const -> void { return functions->eval_add_R_prod_masked(instance.get(), timestep, xu.data(), h.data(), mask_J.data(), mask_K.data(), v.data(), out.data(), work.data()); }
158auto DLControlProblem::eval_add_S_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const -> void { return functions->eval_add_S_prod_masked(instance.get(), timestep, xu.data(), h.data(), mask_K.data(), v.data(), out.data(), work.data()); }
161auto DLControlProblem::eval_constr(index_t timestep, crvec x, rvec c) const -> void { return functions->eval_constr(instance.get(), timestep, x.data(), c.data()); }
162auto DLControlProblem::eval_constr_N(crvec x, rvec c) const -> void { return functions->eval_constr_N(instance.get(), x.data(), c.data()); }
163auto DLControlProblem::eval_grad_constr_prod(index_t timestep, crvec x, crvec p, rvec grad_cx_p) const -> void { return functions->eval_grad_constr_prod(instance.get(), timestep, x.data(), p.data(), grad_cx_p.data()); }
164auto DLControlProblem::eval_grad_constr_prod_N(crvec x, crvec p, rvec grad_cx_p) const -> void { return functions->eval_grad_constr_prod_N(instance.get(), x.data(), p.data(), grad_cx_p.data()); }
165auto DLControlProblem::eval_add_gn_hess_constr(index_t timestep, crvec x, crvec M, rmat out) const -> void { return functions->eval_add_gn_hess_constr(instance.get(), timestep, x.data(), M.data(), out.data()); }
166auto DLControlProblem::eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) const -> void { return functions->eval_add_gn_hess_constr_N(instance.get(), x.data(), M.data(), out.data()); }
167
168bool DLControlProblem::provides_get_D() const { return functions->get_D != nullptr; }
169bool DLControlProblem::provides_get_D_N() const { return functions->get_D_N != nullptr; }
181// clang-format on
182
183#endif
184
185} // namespace alpaqa::dl
Box C
Constraints of the decision variables, .
length_t m
Number of constraints, dimension of g(x) and z.
length_t n
Number of decision variables, dimension of x.
real_t eval_prox_grad_step(real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
vec l1_reg
(1-norm) regularization parameter.
void eval_add_S_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const
Definition: dl-problem.cpp:156
bool provides_eval_grad_constr_prod() const
Definition: dl-problem.cpp:177
void eval_add_Q_N(crvec x, crvec h, rmat Q) const
Definition: dl-problem.cpp:154
bool provides_eval_add_gn_hess_constr() const
Definition: dl-problem.cpp:179
void eval_q_N(crvec x, crvec h, rvec q) const
Definition: dl-problem.cpp:152
void eval_add_gn_hess_constr(index_t timestep, crvec x, crvec M, rmat out) const
Definition: dl-problem.cpp:165
void eval_grad_constr_prod(index_t timestep, crvec x, crvec p, rvec grad_cx_p) const
Definition: dl-problem.cpp:163
void eval_add_R_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_J, crindexvec mask_K, crvec v, rvec out, rvec work) const
Definition: dl-problem.cpp:157
bool provides_eval_add_R_prod_masked() const
Definition: dl-problem.cpp:171
length_t get_S_work_size() const
Definition: dl-problem.cpp:160
void eval_constr_N(crvec x, rvec c) const
Definition: dl-problem.cpp:162
void get_D_N(Box &D) const
Definition: dl-problem.cpp:142
bool provides_get_S_work_size() const
Definition: dl-problem.cpp:174
void eval_grad_f_prod(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const
Definition: dl-problem.cpp:146
bool provides_eval_add_Q_N() const
Definition: dl-problem.cpp:170
std::shared_ptr< void > instance
Problem instance created by the registration function, including the deleter to destroy it.
Definition: dl-problem.hpp:223
void eval_jac_f(index_t timestep, crvec x, crvec u, rmat J_fxu) const
Definition: dl-problem.cpp:145
real_t eval_l_N(crvec h) const
Definition: dl-problem.cpp:150
void eval_h_N(crvec x, rvec h) const
Definition: dl-problem.cpp:148
real_t eval_l(index_t timestep, crvec h) const
Definition: dl-problem.cpp:149
void eval_grad_constr_prod_N(crvec x, crvec p, rvec grad_cx_p) const
Definition: dl-problem.cpp:164
control_problem_functions_t * functions
Pointer to the struct of function pointers for evaluating the objective, constraints,...
Definition: dl-problem.hpp:226
void eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) const
Definition: dl-problem.cpp:166
DLControlProblem(std::string so_filename, std::string symbol_prefix="alpaqa_control_problem", void *user_param=nullptr)
Load a problem from a shared library.
Definition: dl-problem.cpp:124
void get_U(Box &U) const
Definition: dl-problem.cpp:140
void eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const
Definition: dl-problem.cpp:144
bool provides_eval_grad_constr_prod_N() const
Definition: dl-problem.cpp:178
length_t get_R_work_size() const
Definition: dl-problem.cpp:159
void eval_add_S_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const
Definition: dl-problem.cpp:158
bool provides_eval_add_S_prod_masked() const
Definition: dl-problem.cpp:172
void get_x_init(rvec x_init) const
Definition: dl-problem.cpp:143
void eval_h(index_t timestep, crvec x, crvec u, rvec h) const
Definition: dl-problem.cpp:147
void eval_add_R_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const
Definition: dl-problem.cpp:155
void eval_qr(index_t timestep, crvec xu, crvec h, rvec qr) const
Definition: dl-problem.cpp:151
void get_D(Box &D) const
Definition: dl-problem.cpp:141
bool provides_eval_constr_N() const
Definition: dl-problem.cpp:176
void eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) const
Definition: dl-problem.cpp:153
bool provides_get_R_work_size() const
Definition: dl-problem.cpp:173
bool provides_eval_add_gn_hess_constr_N() const
Definition: dl-problem.cpp:180
void eval_constr(index_t timestep, crvec x, rvec c) const
Definition: dl-problem.cpp:161
DLLoader(std::string so_filename, std::string symbol_prefix)
Load a shared library.
Definition: dl-problem.cpp:31
std::shared_ptr< function_dict_t > extra_functions
An associative array of additional functions exposed by the problem.
Definition: dl-problem.hpp:34
F * load_func(std::string_view name) const
Load a function with signature F from the library using dlsym.
Definition: dl-problem.cpp:20
std::string symbol_prefix
Definition: dl-problem.hpp:27
std::string so_filename
Definition: dl-problem.hpp:26
std::shared_ptr< void > load_lib() const
Open the shared library using dlopen
Definition: dl-problem.cpp:10
dl_handle_t handle
Handle to the shared library (returned by dlopen).
Definition: dl-problem.hpp:31
bool provides_eval_hess_L() const
Definition: dl-problem.cpp:107
real_t eval_prox_grad_step(real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const
Definition: dl-problem.cpp:69
real_t eval_ψ_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const
Definition: dl-problem.cpp:97
void eval_grad_gi(crvec x, index_t i, rvec grad_gi) const
Definition: dl-problem.cpp:82
void eval_hess_L_prod(crvec x, crvec y, real_t scale, crvec v, rvec Hv) const
Definition: dl-problem.cpp:85
bool provides_eval_hess_ψ_prod() const
Definition: dl-problem.cpp:109
void eval_hess_ψ_prod(crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const
Definition: dl-problem.cpp:88
bool provides_eval_ψ_grad_ψ() const
Definition: dl-problem.cpp:118
bool provides_get_box_C() const
Definition: dl-problem.cpp:119
real_t eval_f_g(crvec x, rvec g) const
Definition: dl-problem.cpp:92
bool provides_get_hess_L_num_nonzeros() const
Definition: dl-problem.cpp:108
void eval_hess_L(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
Definition: dl-problem.cpp:86
void eval_grad_f(crvec x, rvec grad_fx) const
Definition: dl-problem.cpp:79
bool provides_get_jac_g_num_nonzeros() const
Definition: dl-problem.cpp:104
bool provides_eval_jac_g() const
Definition: dl-problem.cpp:103
void eval_grad_f_grad_g_prod(crvec x, crvec y, rvec grad_f, rvec grad_gxy) const
Definition: dl-problem.cpp:93
real_t eval_ψ(crvec x, crvec y, crvec Σ, rvec ŷ) const
Definition: dl-problem.cpp:95
std::shared_ptr< void > instance
Problem instance created by the registration function, including the deleter to destroy it.
Definition: dl-problem.hpp:123
bool provides_eval_g() const
Definition: dl-problem.cpp:101
void eval_grad_ψ(crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const
Definition: dl-problem.cpp:96
bool provides_eval_grad_f_grad_g_prod() const
Definition: dl-problem.cpp:114
bool provides_eval_f() const
Definition: dl-problem.cpp:99
bool provides_eval_hess_L_prod() const
Definition: dl-problem.cpp:106
bool provides_eval_grad_g_prod() const
Definition: dl-problem.cpp:102
bool provides_get_hess_ψ_num_nonzeros() const
Definition: dl-problem.cpp:111
real_t eval_f_grad_f(crvec x, rvec grad_fx) const
Definition: dl-problem.cpp:91
bool provides_eval_f_grad_f() const
Definition: dl-problem.cpp:112
bool provides_eval_grad_f() const
Definition: dl-problem.cpp:100
bool provides_eval_grad_gi() const
Definition: dl-problem.cpp:105
bool provides_eval_f_g() const
Definition: dl-problem.cpp:113
problem_functions_t * functions
Pointer to the struct of function pointers for evaluating the objective, constraints,...
Definition: dl-problem.hpp:126
real_t eval_f(crvec x) const
Definition: dl-problem.cpp:78
void eval_jac_g(crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const
Definition: dl-problem.cpp:83
bool provides_eval_grad_L() const
Definition: dl-problem.cpp:115
void eval_grad_g_prod(crvec x, crvec y, rvec grad_gxy) const
Definition: dl-problem.cpp:81
bool provides_eval_grad_ψ() const
Definition: dl-problem.cpp:117
length_t get_jac_g_num_nonzeros() const
Definition: dl-problem.cpp:84
DLProblem(std::string so_filename, std::string symbol_prefix="alpaqa_problem", void *user_param=nullptr)
Load a problem from a shared library.
Definition: dl-problem.cpp:35
bool provides_eval_hess_ψ() const
Definition: dl-problem.cpp:110
void eval_grad_L(crvec x, crvec y, rvec grad_L, rvec work_n) const
Definition: dl-problem.cpp:94
void eval_g(crvec x, rvec gx) const
Definition: dl-problem.cpp:80
void eval_hess_ψ(crvec x, crvec y, crvec Σ, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
Definition: dl-problem.cpp:89
bool provides_eval_ψ() const
Definition: dl-problem.cpp:116
length_t get_hess_ψ_num_nonzeros() const
Definition: dl-problem.cpp:90
length_t get_hess_L_num_nonzeros() const
Definition: dl-problem.cpp:87
typename Conf::rmat rmat
Definition: config.hpp:60
typename Conf::real_t real_t
Definition: config.hpp:51
typename Conf::rindexvec rindexvec
Definition: config.hpp:65
typename Conf::index_t index_t
Definition: config.hpp:63
typename Conf::length_t length_t
Definition: config.hpp:62
typename Conf::rvec rvec
Definition: config.hpp:55
typename Conf::crvec crvec
Definition: config.hpp:56
typename Conf::crindexvec crindexvec
Definition: config.hpp:66
void(* eval_add_gn_hess_constr)(void *instance, alpaqa_index_t timestep, const alpaqa_real_t *x, const alpaqa_real_t *M, alpaqa_real_t *out)
Definition: dl-problem.h:308
alpaqa_length_t(* get_S_work_size)(void *instance)
Definition: dl-problem.h:286
void(* eval_grad_constr_prod_N)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *p, alpaqa_real_t *grad_cx_p)
Definition: dl-problem.h:303
void(* get_D)(void *instance, alpaqa_real_t *lb, alpaqa_real_t *ub)
Definition: dl-problem.h:180
void(* eval_grad_constr_prod)(void *instance, alpaqa_index_t timestep, const alpaqa_real_t *x, const alpaqa_real_t *p, alpaqa_real_t *grad_cx_p)
Definition: dl-problem.h:297
void(* eval_add_R_prod_masked)(void *instance, alpaqa_index_t timestep, const alpaqa_real_t *xu, const alpaqa_real_t *h, const alpaqa_index_t *mask_J, const alpaqa_index_t *mask_K, const alpaqa_real_t *v, alpaqa_real_t *out, alpaqa_real_t *work)
Definition: dl-problem.h:265
void(* eval_add_gn_hess_constr_N)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *M, alpaqa_real_t *out)
Definition: dl-problem.h:314
alpaqa_length_t(* get_R_work_size)(void *instance)
Definition: dl-problem.h:284
void(* get_D_N)(void *instance, alpaqa_real_t *lb, alpaqa_real_t *ub)
Definition: dl-problem.h:184
void(* eval_constr)(void *instance, alpaqa_index_t timestep, const alpaqa_real_t *x, alpaqa_real_t *c)
Definition: dl-problem.h:288
void(* eval_add_Q_N)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *h, alpaqa_real_t *Q)
Definition: dl-problem.h:244
void(* eval_add_S_prod_masked)(void *instance, alpaqa_index_t timestep, const alpaqa_real_t *xu, const alpaqa_real_t *h, const alpaqa_index_t *mask_K, const alpaqa_real_t *v, alpaqa_real_t *out, alpaqa_real_t *work)
Definition: dl-problem.h:275
void(* eval_constr_N)(void *instance, const alpaqa_real_t *x, alpaqa_real_t *c)
Definition: dl-problem.h:293
void(* eval_grad_f)(void *instance, const alpaqa_real_t *x, alpaqa_real_t *grad_fx)
Definition: dl-problem.h:21
alpaqa_real_t(* eval_ψ)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, const alpaqa_real_t *Σ, const alpaqa_real_t *zl, const alpaqa_real_t *zu, alpaqa_real_t *ŷ)
Definition: dl-problem.h:107
void(* eval_hess_ψ_prod)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, const alpaqa_real_t *Σ, alpaqa_real_t scale, const alpaqa_real_t *zl, const alpaqa_real_t *zu, const alpaqa_real_t *v, alpaqa_real_t *Hv)
Definition: dl-problem.h:64
void(* initialize_box_C)(void *instance, alpaqa_real_t *lb, alpaqa_real_t *ub)
Definition: dl-problem.h:142
alpaqa_real_t(* eval_prox_grad_step)(void *instance, alpaqa_real_t γ, const alpaqa_real_t *x, const alpaqa_real_t *grad_ψ, alpaqa_real_t *x̂, alpaqa_real_t *p)
Definition: dl-problem.h:135
alpaqa_real_t(* eval_f_g)(void *instance, const alpaqa_real_t *x, alpaqa_real_t *g)
Definition: dl-problem.h:91
void(* eval_grad_f_grad_g_prod)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, alpaqa_real_t *grad_f, alpaqa_real_t *grad_gxy)
Definition: dl-problem.h:95
alpaqa_length_t(* get_hess_ψ_num_nonzeros)(void *instance)
Definition: dl-problem.h:85
void(* eval_grad_L)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, alpaqa_real_t *grad_L, alpaqa_real_t *work_n)
Definition: dl-problem.h:101
alpaqa_real_t(* eval_f_grad_f)(void *instance, const alpaqa_real_t *x, alpaqa_real_t *grad_fx)
Definition: dl-problem.h:87
alpaqa_real_t(* eval_f)(void *instance, const alpaqa_real_t *x)
Definition: dl-problem.h:18
void(* eval_hess_L)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, alpaqa_real_t scale, alpaqa_index_t *inner_idx, alpaqa_index_t *outer_ptr, alpaqa_real_t *H_values)
Definition: dl-problem.h:54
void(* eval_grad_ψ)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, const alpaqa_real_t *Σ, const alpaqa_real_t *zl, const alpaqa_real_t *zu, alpaqa_real_t *grad_ψ, alpaqa_real_t *work_n, alpaqa_real_t *work_m)
Definition: dl-problem.h:115
void(* eval_grad_gi)(void *instance, const alpaqa_real_t *x, alpaqa_index_t i, alpaqa_real_t *grad_gi)
Definition: dl-problem.h:42
void(* eval_hess_ψ)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, const alpaqa_real_t *Σ, alpaqa_real_t scale, const alpaqa_real_t *zl, const alpaqa_real_t *zu, alpaqa_index_t *inner_idx, alpaqa_index_t *outer_ptr, alpaqa_real_t *H_values)
Definition: dl-problem.h:74
void(* initialize_l1_reg)(void *instance, alpaqa_real_t *lambda, alpaqa_length_t *size)
Definition: dl-problem.h:150
alpaqa_length_t(* get_jac_g_num_nonzeros)(void *instance)
Definition: dl-problem.h:40
void(* eval_hess_L_prod)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, alpaqa_real_t scale, const alpaqa_real_t *v, alpaqa_real_t *Hv)
Definition: dl-problem.h:47
void(* eval_g)(void *instance, const alpaqa_real_t *x, alpaqa_real_t *gx)
Definition: dl-problem.h:25
void(* initialize_box_D)(void *instance, alpaqa_real_t *lb, alpaqa_real_t *ub)
Definition: dl-problem.h:146
void(* eval_jac_g)(void *instance, const alpaqa_real_t *x, alpaqa_index_t *inner_idx, alpaqa_index_t *outer_ptr, alpaqa_real_t *J_values)
Definition: dl-problem.h:34
alpaqa_length_t(* get_hess_L_num_nonzeros)(void *instance)
Definition: dl-problem.h:62
alpaqa_real_t(* eval_ψ_grad_ψ)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, const alpaqa_real_t *Σ, const alpaqa_real_t *zl, const alpaqa_real_t *zu, alpaqa_real_t *grad_ψ, alpaqa_real_t *work_n, alpaqa_real_t *work_m)
Definition: dl-problem.h:125
void(* eval_grad_g_prod)(void *instance, const alpaqa_real_t *x, const alpaqa_real_t *y, alpaqa_real_t *grad_gxy)
Definition: dl-problem.h:29