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 eps=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< ActivationDataAbstractcreateData () override
 Create the smooth-abs activation data.
 
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 eps_
 < Dimension of the residual vector
 
- 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 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.

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

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

Member Typedef Documentation

◆ MathBase

template<typename _Scalar >
typedef MathBaseTpl<Scalar> MathBase

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

◆ Base

template<typename _Scalar >
typedef ActivationModelAbstractTpl<Scalar> Base

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

◆ ActivationDataAbstract

template<typename _Scalar >
typedef ActivationDataAbstractTpl<Scalar> ActivationDataAbstract

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

◆ Data

template<typename _Scalar >
typedef ActivationDataSmooth1NormTpl<Scalar> Data

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

◆ VectorXs

template<typename _Scalar >
typedef MathBase::VectorXs VectorXs

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

◆ MatrixXs

template<typename _Scalar >
typedef MathBase::MatrixXs MatrixXs

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

Constructor & Destructor Documentation

◆ ActivationModelSmooth1NormTpl()

template<typename _Scalar >
ActivationModelSmooth1NormTpl ( const std::size_t  nr,
const Scalar  eps = Scalar(1.) 
)
inlineexplicit

Initialize the smooth-abs activation model.

The default eps value is defined as 1.

Parameters
[in]nrDimension of the residual vector
[in]epsSmoothing factor (default: 1.)

Definition at line 56 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 76 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 95 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 114 of file smooth-1norm.hpp.

◆ cast()

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

Definition at line 119 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 130 of file smooth-1norm.hpp.

Member Data Documentation

◆ Scalar

template<typename _Scalar >
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar Scalar

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

◆ eps_

template<typename _Scalar >
Scalar eps_
protected

< Dimension of the residual vector

Smoothing factor

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


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