Template Class ActivationModelSmooth1NormTpl

Inheritance Relationships

Base Type

Class Documentation

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

Smooth-abs activation.

This activation function describes a smooth representation of an absolute activation (1-norm) for each element of a residual vector, i.e.

\[ \begin{equation} sum^nr_{i=0} \sqrt{\epsilon + \|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 ActivationDataSmooth1NormTpl<Scalar> Data
typedef MathBase::VectorXs VectorXs
typedef MathBase::MatrixXs MatrixXs

Public Functions

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

Initialize the smooth-abs 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 ~ActivationModelSmooth1NormTpl() = default
inline virtual void calc(const std::shared_ptr<ActivationDataAbstract> &data, const Eigen::Ref<const VectorXs> &r) override

Compute the smooth-abs function.

Parameters:
  • data[in] Smooth-abs 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-abs function.

Parameters:
  • data[in] Smooth-abs activation data

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

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

Create the smooth-abs activation data.

Returns:

the activation data

template<typename NewScalar>
inline ActivationModelSmooth1NormTpl<NewScalar> cast() const
inline virtual void print(std::ostream &os) const override

Print relevant information of the smooth-1norm model.

Parameters:

os[out] Output stream object

Public Members

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Attributes

Scalar eps_

< Dimension of the residual vector

Smoothing factor