12namespace casadi_loader {
68 rvec grad_fxu_p)
const;
91 rvec grad_cx_p)
const;
100 "Length of problem.U.lowerbound does not "
101 "match problem size problem.nu");
103 "Length of problem.U.upperbound does not "
104 "match problem size problem.nu");
106 "Length of problem.D.lowerbound does not "
107 "match problem size problem.nc");
109 "Length of problem.D.upperbound does not "
110 "match problem size problem.nc");
112 "Length of problem.D_N.lowerbound does "
113 "not match problem size problem.nc_N");
115 "Length of problem.D_N.upperbound does "
116 "not match problem size problem.nc_N");
117 if (penalty_alm_split < 0 || penalty_alm_split >
nc)
118 throw std::invalid_argument(
"Invalid penalty_alm_split");
119 if (penalty_alm_split_N < 0 || penalty_alm_split >
nc_N)
120 throw std::invalid_argument(
"Invalid penalty_alm_split_N");
134 e.segment(t *
nc,
nc) =
143 real_t y_lb = z_lb == -alpaqa::inf<config_t> ? 0 : -M;
144 return std::max(y, y_lb);
148 real_t y_ub = z_ub == alpaqa::inf<config_t> ? 0 : M;
149 return std::min(y, y_ub);
153 auto &&yt = y.segment(t *
nc,
nc);
155 auto &&y_alm = yt.bottomRows(num_alm);
156 auto &&z_alm_lb =
D.
lowerbound.bottomRows(num_alm);
157 auto &&z_alm_ub =
D.
upperbound.bottomRows(num_alm);
160 y_alm.binaryExpr(z_alm_lb, max_lb).binaryExpr(z_alm_ub, min_ub);
163 auto &&yt = y.segment(
N *
nc,
nc_N);
166 auto &&y_alm = yt.bottomRows(num_alm);
167 auto &&z_alm_lb =
D.
lowerbound.bottomRows(num_alm);
168 auto &&z_alm_ub =
D.
upperbound.bottomRows(num_alm);
171 y_alm.binaryExpr(z_alm_lb, max_lb).binaryExpr(z_alm_ub, min_ub);
#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 &)
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
CasADiControlProblem & operator=(const CasADiControlProblem &)
void eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) 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
void eval_h(index_t timestep, crvec x, crvec u, rvec h) const
util::copyable_unique_ptr< Functions > impl
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
void get_x_init(rvec x_init) const
void eval_proj_multipliers(rvec y, real_t M) const
void eval_q_N(crvec x, crvec h, rvec q) 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_proj_diff_g(crvec z, rvec e) 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)
auto projecting_difference(const auto &v, const Box< Conf > &box)
Get the difference between the given vector and its projection.
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.