Crocoddyl
ActivationModelSmooth2NormTpl< _Scalar > Class Template Reference

Smooth-2Norm activation. More...

#include <smooth-2norm.hpp>

Inheritance diagram for ActivationModelSmooth2NormTpl< _Scalar >:
ActivationModelAbstractTpl< _Scalar >

Public Types

typedef ActivationDataAbstractTpl< Scalar > ActivationDataAbstract
 
typedef ActivationModelAbstractTpl< Scalar > Base
 
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

 ActivationModelSmooth2NormTpl (const std::size_t nr, const Scalar eps=Scalar(1.))
 Initialize the smooth-2Norm activation model. More...
 
virtual void calc (const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
 Compute the smooth-2Norm function. More...
 
virtual void calcDiff (const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
 Compute the derivatives of the smooth-2Norm function. More...
 
virtual boost::shared_ptr< ActivationDataAbstractcreateData ()
 Create the smooth-2Norm activation data. More...
 
- 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 Member Functions

virtual void print (std::ostream &os) const
 Print relevant information of the smooth-1norm model. More...
 

Protected Attributes

Scalar eps_
 < Dimension of the residual vector More...
 
std::size_t nr_
 
- Protected Attributes inherited from ActivationModelAbstractTpl< _Scalar >
std::size_t nr_
 

Detailed Description

template<typename _Scalar>
class crocoddyl::ActivationModelSmooth2NormTpl< _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.

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

Definition at line 35 of file smooth-2norm.hpp.

Constructor & Destructor Documentation

◆ ActivationModelSmooth2NormTpl()

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

Initialize the smooth-2Norm 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 55 of file smooth-2norm.hpp.

Member Function Documentation

◆ calc()

virtual void calc ( const boost::shared_ptr< ActivationDataAbstract > &  data,
const Eigen::Ref< const VectorXs > &  r 
)
inlinevirtual

Compute the smooth-2Norm function.

Parameters
[in]dataSmooth-2Norm activation data
[in]rResidual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 71 of file smooth-2norm.hpp.

◆ calcDiff()

virtual void calcDiff ( const boost::shared_ptr< ActivationDataAbstract > &  data,
const Eigen::Ref< const VectorXs > &  r 
)
inlinevirtual

Compute the derivatives of the smooth-2Norm function.

Parameters
[in]dataSmooth-2Norm activation data
[in]rResidual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 88 of file smooth-2norm.hpp.

◆ createData()

virtual boost::shared_ptr<ActivationDataAbstract> createData ( )
inlinevirtual

Create the smooth-2Norm activation data.

Returns
the activation data

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 106 of file smooth-2norm.hpp.

◆ print()

virtual void print ( std::ostream &  os) const
inlineprotectedvirtual

Print relevant information of the smooth-1norm model.

Parameters
[out]osOutput stream object

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 117 of file smooth-2norm.hpp.

Member Data Documentation

◆ eps_

Scalar eps_
protected

< Dimension of the residual vector

Smoothing factor

Definition at line 122 of file smooth-2norm.hpp.


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