17#error "OCP support disabled"
147 if (
nc > 0 &&
get_D ==
nullptr)
148 throw std::runtime_error(
"ControlProblem: missing 'get_D'");
150 throw std::runtime_error(
"ControlProblem: missing 'eval_constr'");
152 throw std::runtime_error(
"ControlProblem: missing 'eval_grad_constr_prod'");
154 throw std::runtime_error(
"ControlProblem: missing 'eval_h'");
156 throw std::runtime_error(
"ControlProblem: missing 'eval_h_N'");
170 [[nodiscard]] ALPAQA_EXPORT
static length_t
172 [[nodiscard]] ALPAQA_EXPORT
static length_t
248 using TypeErased::TypeErased;
251 using TypeErased::call;
252 using TypeErased::self;
253 using TypeErased::vtable;
256 template <
class T,
class... Args>
258 return TypeErased::template make<TypeErasedControlProblem, T>(std::forward<Args>(args)...);
291 [[nodiscard]]
length_t get_m()
const {
return get_N() * get_nc() + get_nc_N(); }
453 [[nodiscard]]
bool provides_get_D_N()
const {
return vtable.get_D_N != &vtable.default_get_D_N; }
483template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_grad_f_prod(
index_t timestep,
crvec x,
crvec u,
crvec p,
rvec grad_fxu_p)
const {
return call(vtable.eval_grad_f_prod, timestep, x, u, p, grad_fxu_p); }
492template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_R_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat R,
rvec work)
const {
return call(vtable.eval_add_R_masked, timestep, xu, h, mask, R, work); }
493template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_S_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat S,
rvec work)
const {
return call(vtable.eval_add_S_masked, timestep, xu, h, mask, S, work); }
494template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::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 {
return call(vtable.eval_add_R_prod_masked, timestep, xu, h, mask_J, mask_K, v, out, work); }
495template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_S_prod_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask_K,
crvec v,
rvec out,
rvec work)
const {
return call(vtable.eval_add_S_prod_masked, timestep, xu, h, mask_K, v, out, work); }
511 if (!v.allFinite()) {
512 std::cout << msg << std::endl;
513 throw std::runtime_error(std::string(msg));
517 if (!std::isfinite(v)) {
518 std::cout << msg << std::endl;
519 throw std::runtime_error(std::string(msg));
528template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_f(
index_t timestep,
crvec x,
crvec u,
rvec fxu)
const {
check_finiteness(x,
"Infinite input x of f");
check_finiteness(u,
"Infinite input u of f"); call(vtable.eval_f, timestep, x, u, fxu);
check_finiteness(fxu,
"Infinite output of f"); }
529template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_jac_f(
index_t timestep,
crvec x,
crvec u,
rmat J_fxu)
const {
check_finiteness(x,
"Infinite input x of jac_f");
check_finiteness(u,
"Infinite input u of jac_f"); call(vtable.eval_jac_f, timestep, x, u, J_fxu);
check_finiteness(J_fxu.reshaped(),
"Infinite output of jac_f"); }
530template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_grad_f_prod(
index_t timestep,
crvec x,
crvec u,
crvec p,
rvec grad_fxu_p)
const {
check_finiteness(x,
"Infinite input x of grad_f_prod");
check_finiteness(u,
"Infinite input u of grad_f_prod");
check_finiteness(p,
"Infinite input p of grad_f_prod"); call(vtable.eval_grad_f_prod, timestep, x, u, p, grad_fxu_p);
check_finiteness(grad_fxu_p,
"Infinite output of jac_f"); }
531template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_h(
index_t timestep,
crvec x,
crvec u,
rvec h)
const {
check_finiteness(x,
"Infinite input x of h");
check_finiteness(u,
"Infinite input u of h"); call(vtable.eval_h, timestep, x, u, h);
check_finiteness(h,
"Infinite output of h"); }
536template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_q_N(
crvec x,
crvec h,
rvec q)
const {
check_finiteness(x,
"Infinite input x of q_N");
check_finiteness(h,
"Infinite input h of q_N"); call(vtable.eval_q_N, x, h, q);
check_finiteness(q,
"Infinite output of q_N"); }
539template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_R_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat R,
rvec work)
const {
return call(vtable.eval_add_R_masked, timestep, xu, h, mask, R, work); }
540template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_S_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat S,
rvec work)
const {
return call(vtable.eval_add_S_masked, timestep, xu, h, mask, S, work); }
541template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::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 {
return call(vtable.eval_add_R_prod_masked, timestep, xu, h, mask_J, mask_K, v, out, work); }
542template <Config Conf,
class Allocator> [[gnu::always_inline]]
inline void TypeErasedControlProblem<Conf, Allocator>::eval_add_S_prod_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask_K,
crvec v,
rvec out,
rvec work)
const {
return call(vtable.eval_add_S_prod_masked, timestep, xu, h, mask_K, v, out, work); }
555template <
class Problem>
572 [[nodiscard, gnu::always_inline]]
length_t get_R_work_size() const requires requires { &std::remove_cvref_t<Problem>::get_R_work_size; } {
return problem.get_R_work_size(); }
573 [[nodiscard, gnu::always_inline]]
length_t get_S_work_size() const requires requires { &std::remove_cvref_t<Problem>::get_S_work_size; } {
return problem.get_S_work_size(); }
574 [[gnu::always_inline]]
void get_U(
Box &U)
const requires requires { &std::remove_cvref_t<Problem>::get_U; } {
return problem.get_U(U); }
575 [[gnu::always_inline]]
void get_D(
Box &D)
const requires requires { &std::remove_cvref_t<Problem>::get_D; } {
return problem.get_D(D); }
576 [[gnu::always_inline]]
void get_D_N(
Box &D)
const requires requires { &std::remove_cvref_t<Problem>::get_D_N; } {
return problem.get_D_N(D); }
579 [[gnu::always_inline]]
void eval_grad_f_prod(
index_t timestep,
crvec x,
crvec u,
crvec p,
rvec grad_fxu_p)
const { ++
evaluations->grad_f_prod;
return timed(
evaluations->time.grad_f_prod, std::bind(&std::remove_cvref_t<Problem>::eval_grad_f_prod, &
problem, timestep, x, u, p, grad_fxu_p)); }
588 [[gnu::always_inline]]
void eval_add_R_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat R,
rvec work)
const { ++
evaluations->add_R_masked;
return timed(
evaluations->time.add_R_masked, std::bind(&std::remove_cvref_t<Problem>::eval_add_R_masked, &
problem, timestep, xu, h, mask, R, work)); }
589 [[gnu::always_inline]]
void eval_add_S_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask,
rmat S,
rvec work)
const { ++
evaluations->add_S_masked;
return timed(
evaluations->time.add_S_masked, std::bind(&std::remove_cvref_t<Problem>::eval_add_S_masked, &
problem, timestep, xu, h, mask, S, work)); }
590 [[gnu::always_inline]]
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 requires requires { &std::remove_cvref_t<Problem>::eval_add_R_prod_masked; } { ++
evaluations->add_R_prod_masked;
return timed(
evaluations->time.add_R_prod_masked, std::bind(&std::remove_cvref_t<Problem>::eval_add_R_prod_masked, &
problem, timestep, xu, h, mask_J, mask_K, v, out, work)); }
591 [[gnu::always_inline]]
void eval_add_S_prod_masked(
index_t timestep,
crvec xu,
crvec h,
crindexvec mask_K,
crvec v,
rvec out,
rvec work)
const requires requires { &std::remove_cvref_t<Problem>::eval_add_S_prod_masked; } { ++
evaluations->add_S_prod_masked;
return timed(
evaluations->time.add_S_prod_masked, std::bind(&std::remove_cvref_t<Problem>::eval_add_S_prod_masked, &
problem, timestep, xu, h, mask_K, v, out, work)); }
600 [[nodiscard]]
bool provides_get_D() const requires requires (Problem p) { { p.provides_get_D() } -> std::convertible_to<bool>; } {
return problem.provides_get_D(); }
601 [[nodiscard]]
bool provides_get_D_N() const requires requires (Problem p) { { p.provides_get_D_N() } -> std::convertible_to<bool>; } {
return problem.provides_get_D_N(); }
602 [[nodiscard]]
bool provides_eval_add_Q_N() const requires requires (Problem p) { { p.provides_eval_add_Q_N() } -> std::convertible_to<bool>; } {
return problem.provides_eval_add_Q_N(); }
603 [[nodiscard]]
bool provides_eval_add_R_prod_masked() const requires requires (Problem p) { { p.provides_eval_add_R_prod_masked() } -> std::convertible_to<bool>; } {
return problem.provides_eval_add_R_prod_masked(); }
604 [[nodiscard]]
bool provides_eval_add_S_prod_masked() const requires requires (Problem p) { { p.provides_eval_add_S_prod_masked() } -> std::convertible_to<bool>; } {
return problem.provides_eval_add_S_prod_masked(); }
605 [[nodiscard]]
bool provides_get_R_work_size() const requires requires (Problem p) { { p.provides_get_R_work_size() } -> std::convertible_to<bool>; } {
return problem.provides_get_R_work_size(); }
606 [[nodiscard]]
bool provides_get_S_work_size() const requires requires (Problem p) { { p.provides_get_S_work_size() } -> std::convertible_to<bool>; } {
return problem.provides_get_S_work_size(); }
607 [[nodiscard]]
bool provides_eval_constr() const requires requires (Problem p) { { p.provides_eval_constr() } -> std::convertible_to<bool>; } {
return problem.provides_eval_constr(); }
608 [[nodiscard]]
bool provides_eval_constr_N() const requires requires (Problem p) { { p.provides_eval_constr_N() } -> std::convertible_to<bool>; } {
return problem.provides_eval_constr_N(); }
609 [[nodiscard]]
bool provides_eval_grad_constr_prod() const requires requires (Problem p) { { p.provides_eval_grad_constr_prod() } -> std::convertible_to<bool>; } {
return problem.provides_eval_grad_constr_prod(); }
610 [[nodiscard]]
bool provides_eval_grad_constr_prod_N() const requires requires (Problem p) { { p.provides_eval_grad_constr_prod_N() } -> std::convertible_to<bool>; } {
return problem.provides_eval_grad_constr_prod_N(); }
611 [[nodiscard]]
bool provides_eval_add_gn_hess_constr() const requires requires (Problem p) { { p.provides_eval_add_gn_hess_constr() } -> std::convertible_to<bool>; } {
return problem.provides_eval_add_gn_hess_constr(); }
612 [[nodiscard]]
bool provides_eval_add_gn_hess_constr_N() const requires requires (Problem p) { { p.provides_eval_add_gn_hess_constr_N() } -> std::convertible_to<bool>; } {
return problem.provides_eval_add_gn_hess_constr_N(); }
615 std::shared_ptr<OCPEvalCounter>
evaluations = std::make_shared<OCPEvalCounter>();
619 requires std::is_default_constructible_v<Problem>
623 requires std::is_same_v<std::remove_cvref_t<P>, std::remove_cvref_t<Problem>>
625 template <
class... Args>
627 requires(!std::is_lvalue_reference_v<Problem>)
628 :
problem{std::forward<Args>(args)...} {}
640 template <
class TimeT,
class FunT>
641 [[gnu::always_inline]]
static decltype(
auto)
timed(TimeT &time, FunT &&f) {
643 return std::forward<FunT>(f)();
647template <
class Problem>
649 using Prob = std::remove_cvref_t<Problem>;
651 return ProbWithCnt{std::forward<Problem>(p)};
654template <
class Problem>
656 using Prob = std::remove_cvref_t<Problem>;
658 return ProbWithCnt{p};
Nonlinear optimal control problem with finite horizon .
Dim get_dim() const
All dimensions.
void eval_jac_f(index_t timestep, crvec x, crvec u, rmat J_fxu) const
Jacobian of discrete-time dynamics .
bool provides_eval_grad_constr_prod() const
bool provides_eval_add_gn_hess_constr() 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
.
bool provides_eval_add_R_prod_masked() const
length_t get_nc() const
Number of constraints.
void eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) const
Gauss-Newton Hessian of terminal constraints .
length_t get_S_work_size() const
Size of the workspace required by eval_add_S_masked() and eval_add_S_prod_masked().
void check() const
Check that the problem formulation is well-defined, the dimensions match, etc.
void eval_qr(index_t timestep, crvec xu, crvec h, rvec qr) const
Cost gradients w.r.t.
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
Terminal constraints .
bool provides_get_D() const
bool provides_get_S_work_size() const
void eval_grad_constr_prod_N(crvec x, crvec p, rvec grad_cx_p) const
Gradient-vector product of terminal constraints .
length_t get_nu() const
Number of inputs.
void eval_add_R_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const
Cost Hessian w.r.t.
bool provides_eval_add_Q_N() const
void get_U(Box &U) const
Input box constraints .
real_t eval_l_N(crvec h) const
Terminal cost .
length_t get_m() const
Total number of constraints.
real_t eval_l(index_t timestep, crvec h) const
Stage cost .
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
Gradient-vector product of discrete-time dynamics .
bool provides_eval_constr() const
bool provides_get_D_N() const
void eval_add_gn_hess_constr(index_t timestep, crvec x, crvec M, rmat out) const
Gauss-Newton Hessian of stage constraints .
void eval_constr(index_t timestep, crvec x, rvec c) const
Stage constraints .
length_t get_nh() const
Number of outputs.
length_t get_nh_N() const
void eval_h(index_t timestep, crvec x, crvec u, rvec h) const
Stage output mapping .
void get_D_N(Box &D) const
Terminal box constraints .
static TypeErasedControlProblem make(Args &&...args)
bool provides_eval_grad_constr_prod_N() const
length_t get_R_work_size() const
Size of the workspace required by eval_add_R_masked() and eval_add_R_prod_masked().
length_t get_nx() const
Number of states.
void eval_add_S_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const
Cost Hessian w.r.t.
void get_x_init(rvec x_init) const
Initial state .
void get_D(Box &D) const
Stage box constraints .
void eval_proj_multipliers(rvec y, real_t M) const
[Required] Function that projects the Lagrange multipliers for ALM.
void eval_q_N(crvec x, crvec h, rvec q) const
Terminal cost gradient w.r.t.
bool provides_eval_add_S_prod_masked() const
void eval_add_Q_N(crvec x, crvec h, rmat Q) const
Terminal cost Hessian w.r.t.
bool provides_eval_h() const
void eval_grad_constr_prod(index_t timestep, crvec x, crvec p, rvec grad_cx_p) const
Gradient-vector product of stage constraints .
void eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) const
Cost Hessian w.r.t.
length_t get_n() const
Total number of variables.
bool provides_eval_constr_N() const
void eval_proj_diff_g(crvec z, rvec e) const
[Required] Function that evaluates the difference between the given point and its projection onto th...
void eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const
Discrete-time dynamics .
bool provides_eval_h_N() const
void eval_h_N(crvec x, rvec h) const
Terminal output mapping .
bool provides_get_R_work_size() const
bool provides_eval_add_gn_hess_constr_N() const
length_t get_N() const
Horizon length.
Class for polymorphism through type erasure.
#define USING_ALPAQA_CONFIG(Conf)
#define ALPAQA_IF_QUADF(...)
#define ALPAQA_IF_LONGD(...)
#define ALPAQA_IF_FLOAT(...)
#define USING_ALPAQA_CONFIG_TEMPLATE(Conf)
#define ALPAQA_EXPORT_EXTERN_TEMPLATE(...)
auto ocproblem_with_counters_ref(Problem &p)
auto ocproblem_with_counters(Problem &&p)
typename Conf::real_t real_t
typename Conf::index_t index_t
void check_finiteness(const auto &v, std::string_view msg)
If the given vector v is not finite, break or throw an exception with the given message msg.
typename Conf::length_t length_t
typename Conf::crvec crvec
typename Conf::crindexvec crindexvec
#define ALPAQA_TE_OPTIONAL_METHOD(vtable, type, member, instance)
#define ALPAQA_TE_REQUIRED_METHOD(vtable, type, member)
required_const_function_t< void(index_t timestep, crvec x, crvec u, rmat J_fxu)> eval_jac_f
optional_const_function_t< length_t()> get_S_work_size
optional_const_function_t< void(crvec x, crvec h, rmat Q)> eval_add_Q_N
ControlProblemVTable()=default
optional_const_function_t< void(index_t timestep, crvec x, crvec p, rvec grad_cx_p)> eval_grad_constr_prod
ControlProblemVTable(std::in_place_t, P &p)
static length_t default_get_R_work_size(const void *, const ControlProblemVTable &)
static length_t default_get_S_work_size(const void *, const ControlProblemVTable &)
static void default_eval_add_S_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
required_const_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work)> eval_add_S_masked
optional_const_function_t< void(Box &D)> get_D
optional_const_function_t< void(crvec x, crvec M, rmat out)> eval_add_gn_hess_constr_N
required_const_function_t< real_t(crvec h)> eval_l_N
optional_const_function_t< void(crvec x, rvec h)> eval_h_N
optional_const_function_t< void(crvec x, rvec c)> eval_constr_N
optional_const_function_t< void(Box &D)> get_D_N
required_const_function_t< real_t(index_t timestep, crvec h)> eval_l
required_const_function_t< void()> check
optional_const_function_t< void(crvec x, crvec p, rvec grad_cx_p)> eval_grad_constr_prod_N
static void default_eval_constr_N(const void *self, crvec x, rvec c, const ControlProblemVTable &vtable)
optional_const_function_t< void(index_t timestep, crvec x, crvec u, rvec h)> eval_h
required_const_function_t< void(crvec x, crvec h, rvec q)> eval_q_N
required_const_function_t< void(rvec x_init)> get_x_init
required_const_function_t< void(crvec z, rvec e)> eval_proj_diff_g
util::BasicVTable::optional_const_function_t< F, ControlProblemVTable > optional_const_function_t
static void default_eval_add_R_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
static void default_eval_grad_constr_prod_N(const void *self, crvec x, crvec p, rvec grad_cx_p, const ControlProblemVTable &vtable)
required_const_function_t< void(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p)> eval_grad_f_prod
util::BasicVTable::optional_function_t< F, ControlProblemVTable > optional_function_t
static void default_eval_add_gn_hess_constr_N(const void *self, crvec x, crvec M, rmat out, const ControlProblemVTable &vtable)
static void default_eval_add_Q_N(const void *self, crvec x, crvec h, rmat Q, const ControlProblemVTable &vtable)
static void default_get_D_N(const void *self, Box &D, const ControlProblemVTable &vtable)
optional_const_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask_J, crindexvec mask_K, crvec v, rvec out, rvec work)> eval_add_R_prod_masked
required_const_function_t< void(Box &U)> get_U
required_const_function_t< void(index_t timestep, crvec xu, crvec h, rvec qr)> eval_qr
optional_const_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work)> eval_add_S_prod_masked
optional_const_function_t< void(index_t timestep, crvec x, crvec M, rmat out)> eval_add_gn_hess_constr
required_const_function_t< void(index_t timestep, crvec x, crvec u, rvec fxu)> eval_f
required_const_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work)> eval_add_R_masked
optional_const_function_t< length_t()> get_R_work_size
required_const_function_t< void(rvec y, real_t M)> eval_proj_multipliers
required_const_function_t< void(index_t timestep, crvec xu, crvec h, rmat Q)> eval_add_Q
optional_const_function_t< void(index_t timestep, crvec x, rvec c)> eval_constr
void eval_jac_f(index_t timestep, crvec x, crvec u, rmat J_fxu) const
void eval_add_gn_hess_constr_N(crvec x, crvec M, rmat out) const
length_t get_R_work_size() const
void eval_add_gn_hess_constr(index_t timestep, crvec x, crvec M, rmat out) const
void decouple_evaluations()
Give this instance its own evaluation counters and timers, decoupling it from any other instances the...
ControlProblemWithCounters()=default
void eval_qr(index_t timestep, crvec xu, crvec h, rvec qr) const
bool provides_get_D_N() const
void eval_add_R_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const
bool provides_get_S_work_size() const
length_t get_nc_N() const
bool provides_eval_constr() const
void eval_grad_f_prod(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const
void get_D_N(Box &D) const
bool provides_eval_add_R_prod_masked() const
void eval_constr(index_t timestep, crvec x, rvec c) const
bool provides_eval_grad_constr_prod() const
real_t eval_l(index_t timestep, crvec h) const
bool provides_get_D() const
void eval_grad_constr_prod_N(crvec x, crvec p, rvec grad_cx_p) const
length_t get_nh_N() const
bool provides_eval_constr_N() const
void eval_h(index_t timestep, crvec x, crvec u, rvec h) const
void reset_evaluations()
Reset all evaluation counters and timers to zero.
void eval_add_S_prod_masked(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const
bool provides_eval_add_gn_hess_constr() const
bool provides_get_R_work_size() const
void eval_q_N(crvec x, crvec h, rvec q) const
void eval_add_S_masked(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const
std::shared_ptr< OCPEvalCounter > evaluations
ControlProblemWithCounters(std::in_place_t, Args &&...args)
void get_x_init(rvec x_init) const
typename TypeErasedControlProblem< config_t >::Box Box
void eval_proj_multipliers(rvec y, real_t M) const
bool provides_eval_add_S_prod_masked() const
void eval_add_Q_N(crvec x, crvec h, rmat Q) const
real_t eval_l_N(crvec h) const
length_t get_S_work_size() const
bool provides_eval_add_Q_N() const
void eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) 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
bool provides_eval_grad_constr_prod_N() const
void eval_proj_diff_g(crvec z, rvec e) const
void eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const
static decltype(auto) timed(TimeT &time, FunT &&f)
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
bool provides_eval_add_gn_hess_constr_N() const
void eval_h_N(crvec x, rvec h) const
Double-precision double configuration.
Single-precision float configuration.
long double configuration.
Struct that stores the size of a polymorphic object, as well as pointers to functions to copy,...
typename optional_function< F, VTable >::type optional_function_t
An optional function includes a void pointer to self, the arguments of F, and an additional reference...
typename required_const_function< F >::type required_const_function_t
A required function includes a void pointer to self, in addition to the arguments of F.
typename optional_const_function< F, VTable >::type optional_const_function_t
An optional function includes a void pointer to self, the arguments of F, and an additional reference...