#include <alpaqa/dl/dl-problem.hpp>
Class that loads an optimal control problem using dlopen
.
The shared library should export a C function with the name <symbol_prefix>_register
that accepts a void pointer with user data, and returns a struct of type alpaqa_control_problem_register_t that contains all data to represent the problem, as well as function pointers for all required operations. See C++/DLProblem/main.cpp
Definition at line 197 of file dl-problem.hpp.
Public Types | |
using | Box = alpaqa::Box< config_t > |
using | instance_t = ExtraFuncs::instance_t |
Public Member Functions | |
DLControlProblem (const std::string &so_filename, std::string symbol_prefix="alpaqa_control_problem", void *user_param=nullptr) | |
Load a problem from a shared library. | |
length_t | get_N () const |
length_t | get_nx () const |
length_t | get_nu () const |
length_t | get_nh () const |
length_t | get_nh_N () const |
length_t | get_nc () const |
length_t | get_nc_N () const |
void | check () const |
void | get_U (Box &U) const |
void | get_D (Box &D) const |
void | get_D_N (Box &D) const |
void | get_x_init (rvec x_init) const |
void | eval_f (index_t timestep, crvec x, crvec u, rvec fxu) const |
void | eval_jac_f (index_t timestep, crvec x, crvec u, rmat J_fxu) const |
void | eval_grad_f_prod (index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const |
void | eval_h (index_t timestep, crvec x, crvec u, rvec h) const |
void | eval_h_N (crvec x, rvec h) const |
real_t | eval_l (index_t timestep, crvec h) const |
real_t | eval_l_N (crvec h) const |
void | eval_qr (index_t timestep, crvec xu, crvec h, rvec qr) const |
void | eval_q_N (crvec x, crvec h, rvec q) const |
void | eval_add_Q (index_t timestep, crvec xu, crvec h, rmat Q) const |
void | eval_add_Q_N (crvec x, crvec h, rmat Q) const |
void | eval_add_R_masked (index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const |
void | eval_add_S_masked (index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const |
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 |
void | eval_add_S_prod_masked (index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const |
length_t | get_R_work_size () const |
length_t | get_S_work_size () const |
void | eval_constr (index_t timestep, crvec x, rvec c) const |
void | eval_constr_N (crvec x, rvec c) const |
void | eval_grad_constr_prod (index_t timestep, crvec x, crvec p, rvec grad_cx_p) const |
void | eval_grad_constr_prod_N (crvec x, crvec p, rvec grad_cx_p) const |
void | eval_add_gn_hess_constr (index_t timestep, crvec x, crvec M, rmat out) const |
void | eval_add_gn_hess_constr_N (crvec x, crvec M, rmat out) const |
bool | provides_get_D () const |
bool | provides_get_D_N () const |
bool | provides_eval_add_Q_N () const |
bool | provides_eval_add_R_prod_masked () const |
bool | provides_eval_add_S_prod_masked () const |
bool | provides_get_R_work_size () const |
bool | provides_get_S_work_size () const |
bool | provides_eval_constr () const |
bool | provides_eval_constr_N () const |
bool | provides_eval_grad_constr_prod () const |
bool | provides_eval_grad_constr_prod_N () const |
bool | provides_eval_add_gn_hess_constr () const |
bool | provides_eval_add_gn_hess_constr_N () const |
template<class Signature , class... Args> | |
decltype(auto) | call_extra_func (const std::string &name, Args &&...args) const |
template<class Signature , class... Args> | |
decltype(auto) | call_extra_func (const std::string &name, Args &&...args) |
Private Attributes | |
std::shared_ptr< void > | handle |
Handle to the shared module defining the problem. | |
std::shared_ptr< void > | instance |
Problem instance created by the registration function, including the deleter to destroy it. | |
control_problem_functions_t * | functions = nullptr |
Pointer to the struct of function pointers for evaluating the objective, constraints, their gradients, etc. | |
ExtraFuncs | extra_funcs |
Dictionary of extra functions that were registered by the problem. | |
using Box = alpaqa::Box<config_t> |
Definition at line 200 of file dl-problem.hpp.
using instance_t = ExtraFuncs::instance_t |
Definition at line 278 of file dl-problem.hpp.
DLControlProblem | ( | const std::string & | so_filename, |
std::string | symbol_prefix = "alpaqa_control_problem" , |
||
void * | user_param = nullptr |
||
) |
Load a problem from a shared library.
so_filename | Filename of the shared library to load. |
symbol_prefix | Prefix of the registration function. |
user_param | Pointer to custom user data to pass to the registration function. |
Definition at line 179 of file dl-problem.cpp.
|
inline |
Definition at line 224 of file dl-problem.hpp.
|
inline |
Definition at line 225 of file dl-problem.hpp.
|
inline |
Definition at line 226 of file dl-problem.hpp.
|
inline |
Definition at line 227 of file dl-problem.hpp.
|
inline |
Definition at line 228 of file dl-problem.hpp.
|
inline |
Definition at line 229 of file dl-problem.hpp.
|
inline |
Definition at line 230 of file dl-problem.hpp.
|
inline |
Definition at line 232 of file dl-problem.hpp.
auto get_U | ( | Box & | U | ) | const |
Definition at line 214 of file dl-problem.cpp.
auto get_D | ( | Box & | D | ) | const |
Definition at line 215 of file dl-problem.cpp.
auto get_D_N | ( | Box & | D | ) | const |
Definition at line 216 of file dl-problem.cpp.
auto get_x_init | ( | rvec | x_init | ) | const |
Definition at line 217 of file dl-problem.cpp.
Definition at line 218 of file dl-problem.cpp.
Definition at line 219 of file dl-problem.cpp.
Definition at line 220 of file dl-problem.cpp.
Definition at line 221 of file dl-problem.cpp.
Definition at line 222 of file dl-problem.cpp.
Definition at line 223 of file dl-problem.cpp.
auto eval_l_N | ( | crvec | h | ) | const |
Definition at line 224 of file dl-problem.cpp.
Definition at line 225 of file dl-problem.cpp.
Definition at line 226 of file dl-problem.cpp.
Definition at line 227 of file dl-problem.cpp.
Definition at line 228 of file dl-problem.cpp.
auto eval_add_R_masked | ( | index_t | timestep, |
crvec | xu, | ||
crvec | h, | ||
crindexvec | mask, | ||
rmat | R, | ||
rvec | work | ||
) | const |
Definition at line 229 of file dl-problem.cpp.
auto eval_add_S_masked | ( | index_t | timestep, |
crvec | xu, | ||
crvec | h, | ||
crindexvec | mask, | ||
rmat | S, | ||
rvec | work | ||
) | const |
Definition at line 230 of file dl-problem.cpp.
auto 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 at line 231 of file dl-problem.cpp.
auto eval_add_S_prod_masked | ( | index_t | timestep, |
crvec | xu, | ||
crvec | h, | ||
crindexvec | mask_K, | ||
crvec | v, | ||
rvec | out, | ||
rvec | work | ||
) | const |
Definition at line 232 of file dl-problem.cpp.
auto get_R_work_size | ( | ) | const |
Definition at line 233 of file dl-problem.cpp.
auto get_S_work_size | ( | ) | const |
Definition at line 234 of file dl-problem.cpp.
Definition at line 235 of file dl-problem.cpp.
Definition at line 236 of file dl-problem.cpp.
Definition at line 237 of file dl-problem.cpp.
Definition at line 238 of file dl-problem.cpp.
Definition at line 239 of file dl-problem.cpp.
Definition at line 240 of file dl-problem.cpp.
bool provides_get_D | ( | ) | const |
Definition at line 242 of file dl-problem.cpp.
bool provides_get_D_N | ( | ) | const |
Definition at line 243 of file dl-problem.cpp.
bool provides_eval_add_Q_N | ( | ) | const |
Definition at line 244 of file dl-problem.cpp.
bool provides_eval_add_R_prod_masked | ( | ) | const |
Definition at line 245 of file dl-problem.cpp.
bool provides_eval_add_S_prod_masked | ( | ) | const |
Definition at line 246 of file dl-problem.cpp.
bool provides_get_R_work_size | ( | ) | const |
Definition at line 247 of file dl-problem.cpp.
bool provides_get_S_work_size | ( | ) | const |
Definition at line 248 of file dl-problem.cpp.
bool provides_eval_constr | ( | ) | const |
Definition at line 249 of file dl-problem.cpp.
bool provides_eval_constr_N | ( | ) | const |
Definition at line 250 of file dl-problem.cpp.
bool provides_eval_grad_constr_prod | ( | ) | const |
Definition at line 251 of file dl-problem.cpp.
bool provides_eval_grad_constr_prod_N | ( | ) | const |
Definition at line 252 of file dl-problem.cpp.
bool provides_eval_add_gn_hess_constr | ( | ) | const |
Definition at line 253 of file dl-problem.cpp.
bool provides_eval_add_gn_hess_constr_N | ( | ) | const |
Definition at line 254 of file dl-problem.cpp.
|
inline |
|
inline |
|
private |
Handle to the shared module defining the problem.
Definition at line 213 of file dl-problem.hpp.
|
private |
Problem instance created by the registration function, including the deleter to destroy it.
Definition at line 216 of file dl-problem.hpp.
|
private |
Pointer to the struct of function pointers for evaluating the objective, constraints, their gradients, etc.
Definition at line 219 of file dl-problem.hpp.
|
private |
Dictionary of extra functions that were registered by the problem.
Definition at line 221 of file dl-problem.hpp.