Crocoddyl
Loading...
Searching...
No Matches
ActivationModelSmooth1NormTpl< _Scalar > Class Template Reference

Smooth-abs activation. More...

#include <smooth-1norm.hpp>

Inheritance diagram for ActivationModelSmooth1NormTpl< _Scalar >:
ActivationModelAbstractTpl< _Scalar >ActivationModelBase

Public Types

typedef ActivationDataAbstractTpl< Scalar > ActivationDataAbstract
typedef ActivationModelAbstractTpl< Scalar > Base
typedef ActivationDataSmooth1NormTpl< Scalar > Data
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef MathBase::VectorXs VectorXs
Public Types inherited from ActivationModelAbstractTpl< _Scalar >
typedef ActivationDataAbstractTpl< Scalar > ActivationDataAbstract
typedef MathBaseTpl< Scalar > MathBase
typedef MathBase::MatrixXs MatrixXs
typedef MathBase::VectorXs VectorXs

Public Member Functions

 ActivationModelSmooth1NormTpl (const std::size_t nr, const Scalar delta=Scalar(1.))
 Initialize the smooth-abs activation model.
virtual void calc (const std::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r) override
 Compute the smooth-abs function.
virtual void calcDiff (const std::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r) override
 Compute the derivatives of the smooth-abs function.
template<typename NewScalar>
ActivationModelSmooth1NormTpl< NewScalar > cast () const
virtual std::shared_ptr< ActivationDataAbstract > createData () override
 Create the smooth-abs activation data.
Scalar get_delta () const
virtual void print (std::ostream &os) const override
 Print relevant information of the smooth-1norm model.
Public Member Functions inherited from ActivationModelAbstractTpl< _Scalar >
 ActivationModelAbstractTpl (const std::size_t nr)
std::size_t get_nr () const

Public Attributes

EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar
Public Attributes inherited from ActivationModelAbstractTpl< _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Protected Attributes

Scalar delta_
 < Dimension of the residual vector
std::size_t nr_
Protected Attributes inherited from ActivationModelAbstractTpl< _Scalar >
std::size_t nr_

Detailed Description

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

Smooth-abs activation.

This activation function describes a smooth representation of the 1-norm of a residual vector:

\‍[  a(\mathbf{r}) =
    \sum_{i=0}^{nr-1}
      \delta^2\left(\sqrt{1 + (r_i/\delta)^2} - 1\right).
\‍]

Here, $\delta > 0$ is the smoothing scale, $r_i$ is a scalar residual, and $nr$ is the residual dimension. This is the classical pseudo-Huber form, equivalently $\delta\sqrt{\delta^2 + r_i^2} - \delta^2$. Its local quadratic approximation is $r_i^2/2$ for every $\delta$. The transition to the linear regime occurs around $|r_i| = \delta$, with asymptotic slope $\delta$.

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

See also
calc(), calcDiff(), createData()

Definition at line 42 of file smooth-1norm.hpp.

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

Definition at line 49 of file smooth-1norm.hpp.

◆ Base

template<typename _Scalar>
typedef ActivationModelAbstractTpl<Scalar> Base

Definition at line 50 of file smooth-1norm.hpp.

◆ ActivationDataAbstract

template<typename _Scalar>
typedef ActivationDataAbstractTpl<Scalar> ActivationDataAbstract

Definition at line 51 of file smooth-1norm.hpp.

◆ Data

template<typename _Scalar>
typedef ActivationDataSmooth1NormTpl<Scalar> Data

Definition at line 52 of file smooth-1norm.hpp.

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

Definition at line 53 of file smooth-1norm.hpp.

◆ MatrixXs

template<typename _Scalar>
typedef MathBase::MatrixXs MatrixXs

Definition at line 54 of file smooth-1norm.hpp.

Constructor & Destructor Documentation

◆ ActivationModelSmooth1NormTpl()

template<typename _Scalar>
ActivationModelSmooth1NormTpl(const std::size_tnr,
const Scalardelta = Scalar(1.) )
inlineexplicit

Initialize the smooth-abs activation model.

The default delta value is defined as 1.

Parameters
[in]nrDimension of the residual vector
[in]deltaStrictly positive smoothing scale (default: 1)

Definition at line 64 of file smooth-1norm.hpp.

Member Function Documentation

◆ calc()

template<typename _Scalar>
virtual void calc(const std::shared_ptr< ActivationDataAbstract > &data,
const Eigen::Ref< const VectorXs > &r )
inlineoverridevirtual

Compute the smooth-abs function.

Parameters
[in]dataSmooth-abs activation data
[in]rResidual vector $\mathbf{r}\in\mathbb{R}^{nr}$

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 80 of file smooth-1norm.hpp.

◆ calcDiff()

template<typename _Scalar>
virtual void calcDiff(const std::shared_ptr< ActivationDataAbstract > &data,
const Eigen::Ref< const VectorXs > &r )
inlineoverridevirtual

Compute the derivatives of the smooth-abs function.

Parameters
[in]dataSmooth-abs activation data
[in]rResidual vector $\mathbf{r}\in\mathbb{R}^{nr}$

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 100 of file smooth-1norm.hpp.

◆ createData()

template<typename _Scalar>
virtual std::shared_ptr< ActivationDataAbstract > createData()
inlineoverridevirtual

Create the smooth-abs activation data.

Returns
the activation data

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 121 of file smooth-1norm.hpp.

◆ cast()

template<typename _Scalar>
template<typename NewScalar>
ActivationModelSmooth1NormTpl< NewScalar > cast()const
inline

Definition at line 126 of file smooth-1norm.hpp.

◆ get_delta()

template<typename _Scalar>
Scalar get_delta()const
inline

Definition at line 132 of file smooth-1norm.hpp.

◆ print()

template<typename _Scalar>
virtual void print(std::ostream &os)const
inlineoverridevirtual

Print relevant information of the smooth-1norm model.

Parameters
[out]osOutput stream object

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 139 of file smooth-1norm.hpp.

Member Data Documentation

◆ Scalar

template<typename _Scalar>
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

Definition at line 48 of file smooth-1norm.hpp.

◆ delta_

template<typename _Scalar>
Scalar delta_
protected

< Dimension of the residual vector

Smoothing scale

Definition at line 146 of file smooth-1norm.hpp.

◆ nr_

template<typename _Scalar>
std::size_t nr_
protected

Definition at line 68 of file activation-base.hpp.


The documentation for this class was generated from the following file: