Template Class ActivationModelSmooth2NormTpl

Inheritance Relationships

Base Type

Class Documentation

template<typename _Scalar>
class ActivationModelSmooth2NormTpl : public crocoddyl::ActivationModelAbstractTpl<_Scalar>

Smooth-2Norm activation.

This activation function describes a smooth representation of a 2-norm of a residual vector, i.e.

\[ \begin{equation} \sqrt{\epsilon + sum^nr_{i=0} \|r_i\|^2} \end{equation} \]
where \(\epsilon\) defines the smoothing factor, \(r_i\) is the scalar residual for the \(i\) constraints, \(nr\) is the dimension of the residual vector.

The computation of the function and it derivatives are carried out in calc() and caldDiff(), respectively.

Public Types

typedef MathBaseTpl<Scalar> MathBase
typedef ActivationModelAbstractTpl<Scalar> Base
typedef ActivationDataAbstractTpl<Scalar> ActivationDataAbstract
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs

Public Functions

inline explicit ActivationModelSmooth2NormTpl(const std::size_t nr, const Scalar eps = Scalar(1.))

Initialize the smooth-2Norm activation model.

The default eps value is defined as 1.

Parameters:
  • nr[in] Dimension of the residual vector

  • eps[in] Smoothing factor (default: 1.)

virtual ~ActivationModelSmooth2NormTpl() = default
inline virtual void calc(const std::shared_ptr<ActivationDataAbstract> &data, const Eigen::Ref<const VectorXs> &r) override

Compute the smooth-2Norm function.

Parameters:
  • data[in] Smooth-2Norm activation data

  • r[in] Residual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

inline virtual void calcDiff(const std::shared_ptr<ActivationDataAbstract> &data, const Eigen::Ref<const VectorXs> &r) override

Compute the derivatives of the smooth-2Norm function.

Parameters:
  • data[in] Smooth-2Norm activation data

  • r[in] Residual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

inline virtual std::shared_ptr<ActivationDataAbstract> createData() override

Create the smooth-2norm activation data.

Returns:

the activation data

template<typename NewScalar>
inline ActivationModelSmooth2NormTpl<NewScalar> cast() const

Public Members

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Functions

inline virtual void print(std::ostream &os) const override

Print relevant information of the smooth-1norm model.

Parameters:

os[out] Output stream object

Protected Attributes

Scalar eps_

< Dimension of the residual vector

Smoothing factor