5#include <proxsuite-nlp/modelling/spaces/vector-space.hpp>
15template <
typename _Scalar,
unsigned int arg>
16struct StateOrControlErrorResidual;
19template <
typename _Scalar>
24 using Data = StageFunctionDataTpl<Scalar>;
26 using VectorSpace = proxsuite::nlp::VectorSpaceTpl<Scalar, Eigen::Dynamic>;
32 const ConstVectorRef &target)
33 :
Base(xspace->ndx(),
nu, xspace->ndx()),
space_(xspace),
35 if (!xspace->isNormalized(target)) {
37 "Target parameter invalid (not a viable element of state manifold.)");
41 void evaluate(
const ConstVectorRef &x,
Data &data)
const override {
50template <
typename _Scalar,
unsigned int arg>
52 static_assert(arg > 0 && arg <= 2,
"arg value must be 1 or 2!");
55 using Base = StageFunctionTpl<Scalar>;
56 using Data = StageFunctionDataTpl<Scalar>;
58 using VectorSpace = proxsuite::nlp::VectorSpaceTpl<Scalar, Eigen::Dynamic>;
65 template <
unsigned int N = arg,
typename = std::enable_if_t<N == 2>>
67 const ConstVectorRef &target);
71 template <
unsigned int N = arg,
typename = std::enable_if_t<N == 1>>
73 const ConstVectorRef &target)
74 :
Base(ndx, uspace->nx(), uspace->ndx()),
space_(uspace),
76 check_target_viable();
81 template <
unsigned int N = arg,
typename = std::enable_if_t<N == 1>>
84 ndx, std::make_shared<
VectorSpace>(target.size()), target) {}
86 template <
unsigned int N = arg,
typename = std::enable_if_t<N == 1>>
90 check_target_viable();
93 void evaluate(
const ConstVectorRef &,
const ConstVectorRef &u,
94 const ConstVectorRef &y,
Data &data)
const {
108 const ConstVectorRef &y,
Data &data)
const {
122 inline void check_target_viable()
const {
125 "Target parameter invalid (not a viable element of state manifold.)");
130template <
typename Scalar,
unsigned int arg>
131template <
unsigned int N,
typename>
133 const shared_ptr<Manifold> &xspace,
const int nu,
134 const ConstVectorRef &target)
135 :
Base(xspace->ndx(), nu, xspace->ndx()), space_(xspace), target_(target) {
136 check_target_viable();
140template <
typename Scalar>
146template <
typename Scalar>
155#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
156#include "aligator/modelling/state-error.txx"
#define ALIGATOR_RUNTIME_ERROR(msg)
Base definitions for ternary functions.
const int nu
Control dimension.
Represents unary functions of the form , with no control (or next-state) arguments.
void computeJacobians(const ConstVectorRef &x, Data &data) const override
StateOrControlErrorResidual(const shared_ptr< Manifold > &xspace, const int nu, const ConstVectorRef &target)
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
ManifoldAbstractTpl< Scalar > Manifold
void evaluate(const ConstVectorRef &x, Data &data) const override
shared_ptr< Manifold > space_
ALIGATOR_UNARY_FUNCTION_INTERFACE(Scalar)
proxsuite::nlp::VectorSpaceTpl< Scalar, Eigen::Dynamic > VectorSpace
ManifoldAbstractTpl< Scalar > Manifold
StateOrControlErrorResidual(const int ndx, const int nu)
void computeJacobians(const ConstVectorRef &, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const
Compute Jacobians of this function.
StateOrControlErrorResidual(const int ndx, const ConstVectorRef &target)
Constructor using state space and control space dimensions, the control space is assumed to be Euclid...
StateOrControlErrorResidual(const shared_ptr< Manifold > &xspace, const int nu, const ConstVectorRef &target)
Constructor using the state space, control dimension and state target.
shared_ptr< Manifold > space_
proxsuite::nlp::VectorSpaceTpl< Scalar, Eigen::Dynamic > VectorSpace
StateOrControlErrorResidual(const int ndx, const shared_ptr< Manifold > &uspace, const ConstVectorRef &target)
Constructor using the state space dimension, control manifold and control target.
void evaluate(const ConstVectorRef &, const ConstVectorRef &u, const ConstVectorRef &y, Data &data) const
Evaluate the function.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)