#include <alpaqa/casadi/CasADiProblem.hpp>
Problem definition for a CasADi problem, loaded from a DLL.
Definition at line 40 of file CasADiProblem.hpp.
Public Types | |
using | Sparsity = alpaqa::Sparsity< config_t > |
Public Member Functions | |
CasADiProblem (const std::string &filename) | |
Load a problem generated by CasADi (with parameters). | |
CasADiProblem (const SerializedCasADiFunctions &functions) | |
Create a problem from a collection of serialized CasADi functions. | |
CasADiProblem (const CasADiFunctions &functions) | |
Create a problem from a collection of CasADi functions. | |
~CasADiProblem () | |
CasADiProblem (const CasADiProblem &) | |
CasADiProblem & | operator= (const CasADiProblem &) |
CasADiProblem (CasADiProblem &&) noexcept | |
CasADiProblem & | operator= (CasADiProblem &&) noexcept |
void | load_numerical_data (const std::filesystem::path &filepath, char sep=',') |
Load the numerical problem data (bounds and parameters) from a CSV file. | |
real_t | eval_f (crvec x) const |
void | eval_grad_f (crvec x, rvec grad_fx) const |
real_t | eval_f_grad_f (crvec x, rvec grad_fx) const |
void | eval_g (crvec x, rvec g) const |
void | eval_grad_g_prod (crvec x, crvec y, rvec grad_gxy) const |
void | eval_grad_ψ (crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const |
real_t | eval_ψ_grad_ψ (crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const |
void | eval_grad_L (crvec x, crvec y, rvec grad_L, rvec work_n) const |
real_t | eval_ψ (crvec x, crvec y, crvec Σ, rvec ŷ) const |
void | eval_grad_gi (crvec x, index_t i, rvec grad_i) const |
Sparsity | get_jac_g_sparsity () const |
void | eval_jac_g (crvec x, rvec J_values) const |
void | eval_hess_L_prod (crvec x, crvec y, real_t scale, crvec v, rvec Hv) const |
Sparsity | get_hess_L_sparsity () const |
void | eval_hess_L (crvec x, crvec y, real_t scale, rvec H_values) const |
void | eval_hess_ψ_prod (crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const |
Sparsity | get_hess_ψ_sparsity () const |
void | eval_hess_ψ (crvec x, crvec y, crvec Σ, real_t scale, rvec H_values) const |
bool | provides_eval_grad_L () const |
bool | provides_eval_ψ () const |
bool | provides_eval_grad_ψ () const |
bool | provides_eval_ψ_grad_ψ () const |
bool | provides_eval_grad_gi () const |
bool | provides_eval_jac_g () const |
bool | provides_eval_hess_L_prod () const |
bool | provides_eval_hess_L () const |
bool | provides_eval_hess_ψ_prod () const |
bool | provides_eval_hess_ψ () const |
std::string | get_name () const |
Public Attributes | |
vec | param |
std::string | name = "CasADiProblem" |
Private Types | |
using | Functions = casadi_loader::CasADiFunctionsWithParam< Conf > |
Private Attributes | |
util::copyable_unique_ptr< Functions > | impl |
using Sparsity = alpaqa::Sparsity<config_t> |
Definition at line 43 of file CasADiProblem.hpp.
|
private |
Definition at line 134 of file CasADiProblem.hpp.
CasADiProblem | ( | const std::string & | filename | ) |
Load a problem generated by CasADi (with parameters).
filename | Filename of the shared library to load the functions from. |
The file should contain functions with the names f
, grad_f
, g
and grad_g
. These functions evaluate the objective function, its gradient, the constraints, and the constraint gradient times a vector respectively. For second order solvers, additional functions hess_L
, hess_ψ
, hess_L_prod
and hess_ψ_prod
can be provided to evaluate the Hessian of the (augmented) Lagrangian and Hessian-vector products.
std::invalid_argument | The dimensions of the loaded functions do not match. |
Definition at line 138 of file CasADiProblem.tpp.
CasADiProblem | ( | const SerializedCasADiFunctions & | functions | ) |
Create a problem from a collection of serialized CasADi functions.
Definition at line 164 of file CasADiProblem.tpp.
CasADiProblem | ( | const CasADiFunctions & | functions | ) |
Create a problem from a collection of CasADi functions.
Definition at line 191 of file CasADiProblem.tpp.
|
default |
|
default |
|
defaultnoexcept |
|
default |
|
defaultnoexcept |
void load_numerical_data | ( | const std::filesystem::path & | filepath, |
char | sep = ',' |
||
) |
Load the numerical problem data (bounds and parameters) from a CSV file.
The file should contain 7 rows, with the following contents:
Line endings are encoded using a single line feed (\n
), and the column separator can be specified using the sep
argument.
Definition at line 213 of file CasADiProblem.tpp.
auto eval_f | ( | crvec | x | ) | const |
Definition at line 278 of file CasADiProblem.tpp.
void eval_grad_f | ( | crvec | x, |
rvec | grad_fx | ||
) | const |
Definition at line 285 of file CasADiProblem.tpp.
auto eval_f_grad_f | ( | crvec | x, |
rvec | grad_fx | ||
) | const |
Definition at line 291 of file CasADiProblem.tpp.
void eval_g | ( | crvec | x, |
rvec | g | ||
) | const |
Definition at line 298 of file CasADiProblem.tpp.
void eval_grad_g_prod | ( | crvec | x, |
crvec | y, | ||
rvec | grad_gxy | ||
) | const |
Definition at line 308 of file CasADiProblem.tpp.
void eval_grad_ψ | ( | crvec | x, |
crvec | y, | ||
crvec | Σ, | ||
rvec | grad_ψ, | ||
rvec | work_n, | ||
rvec | work_m | ||
) | const |
Definition at line 320 of file CasADiProblem.tpp.
CasADiProblem< Conf >::real_t eval_ψ_grad_ψ | ( | crvec | x, |
crvec | y, | ||
crvec | Σ, | ||
rvec | grad_ψ, | ||
rvec | work_n, | ||
rvec | work_m | ||
) | const |
Definition at line 335 of file CasADiProblem.tpp.
void eval_grad_L | ( | crvec | x, |
crvec | y, | ||
rvec | grad_L, | ||
rvec | work_n | ||
) | const |
Definition at line 347 of file CasADiProblem.tpp.
CasADiProblem< Conf >::real_t eval_ψ | ( | crvec | x, |
crvec | y, | ||
crvec | Σ, | ||
rvec | ŷ | ||
) | const |
Definition at line 356 of file CasADiProblem.tpp.
void eval_grad_gi | ( | crvec | x, |
index_t | i, | ||
rvec | grad_i | ||
) | const |
Definition at line 367 of file CasADiProblem.tpp.
auto get_jac_g_sparsity | ( | ) | const |
Definition at line 387 of file CasADiProblem.tpp.
void eval_jac_g | ( | crvec | x, |
rvec | J_values | ||
) | const |
Definition at line 402 of file CasADiProblem.tpp.
void eval_hess_L_prod | ( | crvec | x, |
crvec | y, | ||
real_t | scale, | ||
crvec | v, | ||
rvec | Hv | ||
) | const |
Definition at line 409 of file CasADiProblem.tpp.
auto get_hess_L_sparsity | ( | ) | const |
Definition at line 418 of file CasADiProblem.tpp.
void eval_hess_L | ( | crvec | x, |
crvec | y, | ||
real_t | scale, | ||
rvec | H_values | ||
) | const |
Definition at line 432 of file CasADiProblem.tpp.
void eval_hess_ψ_prod | ( | crvec | x, |
crvec | y, | ||
crvec | Σ, | ||
real_t | scale, | ||
crvec | v, | ||
rvec | Hv | ||
) | const |
Definition at line 441 of file CasADiProblem.tpp.
auto get_hess_ψ_sparsity | ( | ) | const |
Definition at line 453 of file CasADiProblem.tpp.
void eval_hess_ψ | ( | crvec | x, |
crvec | y, | ||
crvec | Σ, | ||
real_t | scale, | ||
rvec | H_values | ||
) | const |
Definition at line 467 of file CasADiProblem.tpp.
bool provides_eval_grad_L | ( | ) | const |
Definition at line 493 of file CasADiProblem.tpp.
bool provides_eval_ψ | ( | ) | const |
Definition at line 481 of file CasADiProblem.tpp.
bool provides_eval_grad_ψ | ( | ) | const |
Definition at line 485 of file CasADiProblem.tpp.
bool provides_eval_ψ_grad_ψ | ( | ) | const |
Definition at line 489 of file CasADiProblem.tpp.
bool provides_eval_grad_gi | ( | ) | const |
Definition at line 477 of file CasADiProblem.tpp.
bool provides_eval_jac_g | ( | ) | const |
Definition at line 497 of file CasADiProblem.tpp.
bool provides_eval_hess_L_prod | ( | ) | const |
Definition at line 501 of file CasADiProblem.tpp.
bool provides_eval_hess_L | ( | ) | const |
Definition at line 505 of file CasADiProblem.tpp.
bool provides_eval_hess_ψ_prod | ( | ) | const |
Definition at line 509 of file CasADiProblem.tpp.
bool provides_eval_hess_ψ | ( | ) | const |
Definition at line 513 of file CasADiProblem.tpp.
std::string get_name | ( | ) | const |
Definition at line 518 of file CasADiProblem.tpp.
vec param |
Definition at line 44 of file CasADiProblem.hpp.
std::string name = "CasADiProblem" |
Definition at line 45 of file CasADiProblem.hpp.
|
private |
Definition at line 135 of file CasADiProblem.hpp.