8#include <guanaqo/not-implemented.hpp>
9#include <guanaqo/required-method.hpp>
10#include <guanaqo/timed.hpp>
11#include <guanaqo/type-erasure.hpp>
18#error "OCP support disabled"
27using guanaqo::not_implemented_error;
114 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
get_U);
115 GUANAQO_TE_OPTIONAL_METHOD(*
this, P,
get_D, p);
116 GUANAQO_TE_OPTIONAL_METHOD(*
this, P,
get_D_N, p);
117 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
get_x_init);
118 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_f);
119 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_jac_f);
121 GUANAQO_TE_OPTIONAL_METHOD(*
this, P,
eval_h, p);
122 GUANAQO_TE_OPTIONAL_METHOD(*
this, P,
eval_h_N, p);
123 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_l);
124 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_l_N);
125 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_qr);
126 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_q_N);
127 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
eval_add_Q);
135 GUANAQO_TE_OPTIONAL_METHOD(*
this, P,
eval_constr, p);
141 GUANAQO_TE_REQUIRED_METHOD(*
this, P,
check);
149 if (
nc > 0 &&
get_D ==
nullptr)
150 throw std::runtime_error(
"ControlProblem: missing 'get_D'");
152 throw std::runtime_error(
"ControlProblem: missing 'eval_constr'");
154 throw std::runtime_error(
"ControlProblem: missing 'eval_grad_constr_prod'");
156 throw std::runtime_error(
"ControlProblem: missing 'eval_h'");
158 throw std::runtime_error(
"ControlProblem: missing 'eval_h_N'");
172 [[nodiscard]] ALPAQA_EXPORT
static length_t
174 [[nodiscard]] ALPAQA_EXPORT
static length_t
249 using TypeErased = guanaqo::TypeErased<VTable, allocator_type>;
250 using TypeErased::TypeErased;
253 using TypeErased::call;
254 using TypeErased::self;
255 using TypeErased::vtable;
258 template <
class T,
class... Args>
455 [[nodiscard]]
bool provides_get_D_N()
const {
return vtable.get_D_N != &vtable.default_get_D_N; }
485template <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); }
494template <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); }
495template <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); }
496template <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); }
497template <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); }
513 if (!v.allFinite()) {
514 std::cout << msg << std::endl;
515 throw std::runtime_error(std::string(msg));
519 if (!std::isfinite(v)) {
520 std::cout << msg << std::endl;
521 throw std::runtime_error(std::string(msg));
530template <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"); }
531template <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"); }
532template <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"); }
533template <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"); }
538template <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"); }
541template <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); }
542template <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); }
543template <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); }
544template <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); }
557template <
class Problem>
574 [[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(); }
575 [[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(); }
576 [[gnu::always_inline]]
void get_U(
Box &U)
const requires requires { &std::remove_cvref_t<Problem>::get_U; } {
return problem.get_U(U); }
577 [[gnu::always_inline]]
void get_D(
Box &D)
const requires requires { &std::remove_cvref_t<Problem>::get_D; } {
return problem.get_D(D); }
578 [[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); }
590 [[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, [&] { return problem.eval_add_R_masked(timestep, xu, h, mask, R, work); }); }
591 [[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, [&] { return problem.eval_add_S_masked(timestep, xu, h, mask, S, work); }); }
592 [[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, [&] { return problem.eval_add_R_prod_masked(timestep, xu, h, mask_J, mask_K, v, out, work); }); }
593 [[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, [&] { return problem.eval_add_S_prod_masked(timestep, xu, h, mask_K, v, out, work); }); }
602 [[nodiscard]]
bool provides_get_D() const requires requires (Problem p) { { p.provides_get_D() } -> std::convertible_to<bool>; } {
return problem.provides_get_D(); }
603 [[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(); }
604 [[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(); }
605 [[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(); }
606 [[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(); }
607 [[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(); }
608 [[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(); }
609 [[nodiscard]]
bool provides_eval_constr() const requires requires (Problem p) { { p.provides_eval_constr() } -> std::convertible_to<bool>; } {
return problem.provides_eval_constr(); }
610 [[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(); }
611 [[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(); }
612 [[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(); }
613 [[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(); }
614 [[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(); }
617 std::shared_ptr<OCPEvalCounter>
evaluations = std::make_shared<OCPEvalCounter>();
621 requires std::is_default_constructible_v<Problem>
625 requires std::is_same_v<std::remove_cvref_t<P>, std::remove_cvref_t<Problem>>
627 template <
class... Args>
629 requires(!std::is_lvalue_reference_v<Problem>)
630 :
problem{std::forward<Args>(args)...} {}
642 template <
class TimeT,
class FunT>
643 [[gnu::always_inline]]
static decltype(
auto)
timed(TimeT &time, FunT &&f) {
644 guanaqo::Timed
timed{time};
645 return std::forward<FunT>(f)();
649template <
class Problem>
651 using Prob = std::remove_cvref_t<Problem>;
653 return ProbWithCnt{std::forward<Problem>(p)};
656template <
class Problem>
658 using Prob = std::remove_cvref_t<Problem>;
660 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
ControlProblemVTable< config_t > VTable
bool provides_eval_add_gn_hess_constr() const
std::allocator< std::byte > allocator_type
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 .
void eval_projection_multipliers(rvec y, real_t M) const
[Required] Function that projects the Lagrange multipliers for ALM.
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 .
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_q_N(crvec x, crvec h, rvec q) const
Terminal cost gradient w.r.t.
guanaqo::TypeErased< VTable, allocator_type > TypeErased
bool provides_eval_add_S_prod_masked() const
void eval_projecting_difference_constraints(crvec z, rvec e) const
[Required] Function that evaluates the difference between the given point and its projection onto th...
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 .
length_t get_num_constraints() const
Total number of constraints.
void eval_add_Q(index_t timestep, crvec xu, crvec h, rmat Q) const
Cost Hessian w.r.t.
bool provides_eval_constr_N() const
void eval_f(index_t timestep, crvec x, crvec u, rvec fxu) const
Discrete-time dynamics .
bool provides_eval_h_N() const
length_t get_num_variables() const
Total number of variables.
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.
#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)
EigenConfigd DefaultConfig
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
required_function_t< void(index_t timestep, crvec x, crvec u, rmat J_fxu) const > eval_jac_f
required_function_t< void(index_t timestep, crvec x, crvec u, rvec fxu) const > eval_f
guanaqo::required_function_t< F > required_function_t
required_function_t< void(rvec x_init) const > get_x_init
optional_function_t< void(index_t timestep, crvec x, crvec M, rmat out) const > eval_add_gn_hess_constr
optional_function_t< void(index_t timestep, crvec x, rvec c) const > eval_constr
ControlProblemVTable()=default
ControlProblemVTable(std::in_place_t, P &p)
required_function_t< void(index_t timestep, crvec xu, crvec h, rvec qr) const > eval_qr
required_function_t< void(rvec y, real_t M) const > eval_projection_multipliers
static length_t default_get_R_work_size(const void *, const ControlProblemVTable &)
static length_t default_get_S_work_size(const void *, const ControlProblemVTable &)
optional_function_t< void(crvec x, rvec c) const > eval_constr_N
static void default_eval_add_S_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
optional_function_t< void(crvec x, crvec M, rmat out) const > eval_add_gn_hess_constr_N
optional_function_t< void(crvec x, rvec h) const > eval_h_N
optional_function_t< void(index_t timestep, crvec x, crvec p, rvec grad_cx_p) const > eval_grad_constr_prod
optional_function_t< length_t() const > get_R_work_size
required_function_t< void(crvec z, rvec e) const > eval_projecting_difference_constraints
optional_function_t< void(crvec x, crvec p, rvec grad_cx_p) const > eval_grad_constr_prod_N
required_function_t< void() const > check
static void default_eval_constr_N(const void *self, crvec x, rvec c, const ControlProblemVTable &vtable)
optional_function_t< void(index_t timestep, crvec x, crvec u, rvec h) const > eval_h
optional_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask_J, crindexvec mask_K, crvec v, rvec out, rvec work) const > eval_add_R_prod_masked
guanaqo::optional_function_t< F, ControlProblemVTable > optional_function_t
optional_function_t< void(Box &D) const > get_D_N
required_function_t< void(Box &U) const > get_U
static void default_eval_add_R_prod_masked(const void *, index_t, crvec, crvec, crindexvec, crindexvec, crvec, rvec, rvec, const ControlProblemVTable &)
alpaqa::Box< config_t > Box
static void default_eval_grad_constr_prod_N(const void *self, crvec x, crvec p, rvec grad_cx_p, const ControlProblemVTable &vtable)
required_function_t< void(crvec x, crvec h, rvec q) const > eval_q_N
required_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat S, rvec work) const > eval_add_S_masked
required_function_t< real_t(index_t timestep, crvec h) const > eval_l
optional_function_t< void(Box &D) const > get_D
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)
required_function_t< real_t(crvec h) const > eval_l_N
required_function_t< void(index_t timestep, crvec x, crvec u, crvec p, rvec grad_fxu_p) const > eval_grad_f_prod
required_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask, rmat R, rvec work) const > eval_add_R_masked
optional_function_t< void(index_t timestep, crvec xu, crvec h, crindexvec mask_K, crvec v, rvec out, rvec work) const > eval_add_S_prod_masked
optional_function_t< void(crvec x, crvec h, rmat Q) const > eval_add_Q_N
optional_function_t< length_t() const > get_S_work_size
required_function_t< void(index_t timestep, crvec xu, crvec h, rmat Q) const > eval_add_Q
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_projection_multipliers(rvec y, real_t M) const
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_projecting_difference_constraints(crvec z, rvec e) 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_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.