8#include <guanaqo/copyable-unique_ptr.hpp>
9#include <guanaqo/dl-flags.hpp>
14using guanaqo::DynamicLoadFlags;
43 DynamicLoadFlags dl_flags = {});
75 rvec grad_fxu_p)
const;
98 rvec grad_cx_p)
const;
107 "Length of problem.U.lower does not "
108 "match problem size problem.nu");
110 "Length of problem.U.upper does not "
111 "match problem size problem.nu");
113 "Length of problem.D.lower does not "
114 "match problem size problem.nc");
116 "Length of problem.D.upper does not "
117 "match problem size problem.nc");
119 "Length of problem.D_N.lower does not "
120 "match problem size problem.nc_N");
122 "Length of problem.D_N.upper does not "
123 "match problem size problem.nc_N");
125 throw std::invalid_argument(
"Invalid penalty_alm_split");
127 throw std::invalid_argument(
"Invalid penalty_alm_split_N");
141 e.segment(t *
nc,
nc) =
142 projecting_difference(z.segment(t *
nc,
nc),
D);
144 projecting_difference(z.segment(
N *
nc,
nc_N),
D_N);
151 return std::max(y, y_lb);
156 return std::min(y, y_ub);
160 auto &&yt = y.segment(t *
nc,
nc);
162 auto &&y_alm = yt.bottomRows(num_alm);
163 auto &&z_alm_lb =
D.lower.bottomRows(num_alm);
164 auto &&z_alm_ub =
D.upper.bottomRows(num_alm);
167 y_alm.binaryExpr(z_alm_lb, max_lb).binaryExpr(z_alm_ub, min_ub);
170 auto &&yt = y.segment(
N *
nc,
nc_N);
173 auto &&y_alm = yt.bottomRows(num_alm);
174 auto &&z_alm_lb =
D.lower.bottomRows(num_alm);
175 auto &&z_alm_ub =
D.upper.bottomRows(num_alm);
178 y_alm.binaryExpr(z_alm_lb, max_lb).binaryExpr(z_alm_ub, min_ub);
184 guanaqo::copyable_unique_ptr<Functions>
impl;
#define BEGIN_ALPAQA_CASADI_LOADER_NAMESPACE
#define END_ALPAQA_CASADI_LOADER_NAMESPACE
#define CASADI_OCP_LOADER_EXPORT_EXTERN_TEMPLATE(strcls, name,...)
void eval_jac_f(index_t timestep, crvec x, crvec u, rmat J_fxu) const
CasADiControlProblem(const CasADiControlProblem &)
guanaqo::copyable_unique_ptr< Functions > impl
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
casadi_loader::CasADiControlFunctionsWithParam< Conf > Functions
CasADiControlProblem & operator=(const CasADiControlProblem &)
void eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) const
void eval_projection_multipliers(rvec y, real_t M) const
length_t get_S_work_size() const
void eval_qr(index_t timestep, crvec xu, crvec h, rvec qr) const
index_t penalty_alm_split_N
Same as penalty_alm_split, but for the terminal constraint.
void eval_add_S_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const
void eval_constr_N(crvec x, rvec c) const
void load_numerical_data(const std::filesystem::path &filepath, char sep=',')
Load the numerical problem data (bounds and parameters) from a CSV file.
void eval_grad_constr_prod_N(crvec x, crvec p, rvec grad_cx_p) const
void eval_add_R_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const
real_t eval_l_N(crvec h) const
real_t eval_l(index_t timestep, crvec h) const
length_t get_nc_N() const
void eval_grad_f_prod(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const
index_t penalty_alm_split
Components of the constraint function with indices below this number are handled using a quadratic pe...
void eval_add_gn_hess_constr(index_t timestep, crvec x, crvec M, rmat out) const
void eval_constr(index_t timestep, crvec x, rvec c) const
length_t get_nh_N() const
CasADiControlProblem(const std::string &filename, length_t N, DynamicLoadFlags dl_flags={})
void eval_h(index_t timestep, crvec x, crvec u, rvec h) const
length_t get_R_work_size() const
void eval_add_S_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const
alpaqa::Box< config_t > Box
void get_x_init(rvec x_init) const
void eval_q_N(crvec x, crvec h, rvec q) const
void eval_projecting_difference_constraints(crvec z, rvec e) const
void eval_add_Q_N(crvec x, crvec h, rmat Q) const
void eval_grad_constr_prod(index_t timestep, crvec x, crvec p, rvec grad_cx_p) const
void eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) const
void eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const
void eval_h_N(crvec x, rvec h) const
void get_D_N(Box &D_N) const
CasADiControlProblem(CasADiControlProblem &&) noexcept
#define USING_ALPAQA_CONFIG(Conf)
void check_dim_msg(const V &v, auto sz, std::string msg)
typename Conf::real_t real_t
typename Conf::index_t index_t
typename Conf::length_t length_t
typename Conf::crvec crvec
typename Conf::crindexvec crindexvec
Double-precision double configuration.