140 nh_N = t.
t->get_nh_N();
142 nc_N = t.
t->get_nc_N();
143 if (
nc > 0 &&
get_D ==
nullptr)
144 throw std::runtime_error(
"ControlProblem: missing 'get_D'");
146 throw std::runtime_error(
"ControlProblem: missing 'eval_constr'");
148 throw std::runtime_error(
"ControlProblem: missing 'eval_grad_constr_prod'");
150 throw std::runtime_error(
"ControlProblem: missing 'eval_h'");
152 throw std::runtime_error(
"ControlProblem: missing 'eval_h_N'");
157 vtable.
get_D(self, D, vtable);
242template <Config Conf = DefaultConfig,
class Allocator = std::allocator<std::
byte>>
259 template <
class T,
class... Args>
261 return TypeErased::template make<TypeErasedControlProblem, T>(std::forward<Args>(args)...);
486template <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); }
495template <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); }
496template <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); }
497template <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); }
498template <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); }
514 if (!v.allFinite()) {
515 std::cout << msg << std::endl;
516 throw std::runtime_error(std::string(msg));
520 if (!std::isfinite(v)) {
521 std::cout << msg << std::endl;
522 throw std::runtime_error(std::string(msg));
531template <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"); }
532template <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"); }
533template <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"); }
534template <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"); }
539template <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"); }
542template <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); }
543template <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); }
544template <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); }
545template <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); }
558template <
class Problem>
575 [[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(); }
576 [[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(); }
577 [[gnu::always_inline]]
void get_U(
Box &U)
const requires requires { &std::remove_cvref_t<Problem>::get_U; } {
return problem.get_U(U); }
578 [[gnu::always_inline]]
void get_D(
Box &D)
const requires requires { &std::remove_cvref_t<Problem>::get_D; } {
return problem.get_D(D); }
579 [[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); }
582 [[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)); }
591 [[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)); }
592 [[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)); }
593 [[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)); }
594 [[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)); }
603 [[nodiscard]]
bool provides_get_D() const requires requires (Problem p) { { p.provides_get_D() } -> std::convertible_to<bool>; } {
return problem.provides_get_D(); }
604 [[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(); }
605 [[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(); }
606 [[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(); }
607 [[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(); }
608 [[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(); }
609 [[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(); }
610 [[nodiscard]]
bool provides_eval_constr() const requires requires (Problem p) { { p.provides_eval_constr() } -> std::convertible_to<bool>; } {
return problem.provides_eval_constr(); }
611 [[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(); }
612 [[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(); }
613 [[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(); }
614 [[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(); }
615 [[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(); }
618 std::shared_ptr<OCPEvalCounter>
evaluations = std::make_shared<OCPEvalCounter>();
622 requires std::is_default_constructible_v<Problem>
626 requires std::is_same_v<std::remove_cvref_t<P>, std::remove_cvref_t<Problem>>
628 template <
class... Args>
630 requires(!std::is_lvalue_reference_v<Problem>)
631 :
problem{std::forward<Args>(args)...} {}
643 template <
class TimeT,
class FunT>
644 [[gnu::always_inline]]
static decltype(
auto)
timed(TimeT &time, FunT &&f) {
646 return std::forward<FunT>(f)();
650template <
class Problem>
652 using Prob = std::remove_cvref_t<Problem>;
654 return ProbWithCnt{std::forward<Problem>(p)};
657template <
class Problem>
659 using Prob = std::remove_cvref_t<Problem>;
661 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.
decltype(auto) call(Ret(*f)(const void *, FArgs...), Args &&...args) const
Call the vtable function f with the given arguments args, implicitly passing the self pointer and vta...
TypeErased() noexcept(noexcept(allocator_type()))=default
Default constructor.
void * self
Pointer to the stored object.
#define USING_ALPAQA_CONFIG(Conf)
#define USING_ALPAQA_CONFIG_TEMPLATE(Conf)
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_REQUIRED_METHOD(vtable, type, member)
#define ALPAQA_TE_OPTIONAL_METHOD(vtable, type, member, instance_p)
required_const_function_t< void(index_t timestep, crvec x, crvec u, rmat J_fxu)> eval_jac_f
static void default_eval_add_S_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
static void default_eval_add_R_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
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
static length_t default_get_R_work_size(const void *, const ControlProblemVTable &)
static void default_eval_add_gn_hess_constr_N(const void *self, crvec x, crvec M, rmat out, const ControlProblemVTable &vtable)
ControlProblemVTable(util::VTableTypeTag< P > t)
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
static length_t default_get_S_work_size(const void *, const ControlProblemVTable &)
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
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
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(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
alpaqa::Box< config_t > Box
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_constr_N(const void *self, crvec x, rvec c, 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
static void default_eval_add_Q_N(const void *self, crvec x, crvec h, rmat Q, const ControlProblemVTable &vtable)
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
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...