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

Weighted smooth-1norm activation. More...

#include <weighted-smooth-1norm.hpp>

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

Public Types

typedef ActivationDataAbstractTpl< Scalar > ActivationDataAbstract
typedef ActivationModelAbstractTpl< Scalar > Base
typedef ActivationDataWeightedSmooth1NormTpl< Scalar > Data
typedef MathBaseTpl< Scalar > MathBase
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

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

Protected Attributes

std::size_t nr_
Protected Attributes inherited from ActivationModelAbstractTpl< _Scalar >
std::size_t nr_

Additional Inherited Members

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

Detailed Description

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

Weighted smooth-1norm activation.

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

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

where $\delta > 0$ is the smoothing scale, $w_i \geq 0$ is the weight associated with the scalar residual $r_i$, and $nr$ is the residual dimension. This is the weighted classical pseudo-Huber form, equivalently $w_i(\delta\sqrt{\delta^2 + r_i^2} - \delta^2)$.

The weights scale the activation without changing the smoothing transition, which occurs around $|r_i| = \delta$. The local quadratic approximation is $w_i r_i^2/2$ for every $\delta$, while the asymptotic slope of each term is $w_i\delta$.

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

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

Member Typedef Documentation

◆ MathBase

template<typename _Scalar>
typedef MathBaseTpl<Scalar> MathBase

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

◆ Base

template<typename _Scalar>
typedef ActivationModelAbstractTpl<Scalar> Base

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

◆ ActivationDataAbstract

template<typename _Scalar>
typedef ActivationDataAbstractTpl<Scalar> ActivationDataAbstract

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

◆ Data

template<typename _Scalar>
typedef ActivationDataWeightedSmooth1NormTpl<Scalar> Data

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

◆ VectorXs

template<typename _Scalar>
typedef MathBase::VectorXs VectorXs

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

Constructor & Destructor Documentation

◆ ActivationModelWeightedSmooth1NormTpl()

template<typename _Scalar>
ActivationModelWeightedSmooth1NormTpl(const VectorXs &weights,
const Scalardelta = Scalar(1.) )
inlineexplicit

Initialize the weighted smooth-1norm activation model.

Parameters
[in]weightsNonnegative residual weights
[in]deltaStrictly positive smoothing scale (default: 1)

Definition at line 60 of file weighted-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 weighted smooth-1norm activation.

Parameters
[in]dataWeighted smooth-1norm activation data
[in]rResidual vector $\mathbf{r}\in\mathbb{R}^{nr}$

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 77 of file weighted-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 activation derivatives.

Parameters
[in]dataWeighted smooth-1norm activation data
[in]rResidual vector $\mathbf{r}\in\mathbb{R}^{nr}$

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 98 of file weighted-smooth-1norm.hpp.

◆ createData()

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

Create the weighted smooth-1norm activation data.

Returns
the activation data

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 118 of file weighted-smooth-1norm.hpp.

◆ cast()

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

Definition at line 123 of file weighted-smooth-1norm.hpp.

◆ get_weights()

template<typename _Scalar>
const VectorXs & get_weights()const
inline

Definition at line 129 of file weighted-smooth-1norm.hpp.

◆ get_delta()

template<typename _Scalar>
Scalar get_delta()const
inline

Definition at line 130 of file weighted-smooth-1norm.hpp.

◆ set_weights()

template<typename _Scalar>
void set_weights(const VectorXs &weights)
inline

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

◆ print()

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

Print relevant information of the weighted smooth-1norm model.

Parameters
[out]osOutput stream object

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 147 of file weighted-smooth-1norm.hpp.

Member Data Documentation

◆ 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: