Crocoddyl
ActivationModel2NormBarrierTpl< _Scalar > Class Template Reference

2-norm barrier activation More...

#include <2norm-barrier.hpp>

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

Public Types

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

 ActivationModel2NormBarrierTpl (const std::size_t nr, const Scalar alpha=Scalar(0.1), const bool true_hessian=false)
 Initialize the 2-norm barrier activation model. More...
 
virtual void calc (const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
 Compute the 2-norm barrier function. More...
 
virtual void calcDiff (const boost::shared_ptr< ActivationDataAbstract > &data, const Eigen::Ref< const VectorXs > &r)
 Compute the derivatives of the 2norm-barrier function. More...
 
virtual boost::shared_ptr< ActivationDataAbstractcreateData ()
 Create the 2norm-barrier activation data. More...
 
const Scalar & get_alpha () const
 Get and set the threshold factor.
 
virtual void print (std::ostream &os) const
 Print relevant information of the 2-norm barrier model. More...
 
void set_alpha (const Scalar &alpha)
 
- 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 alpha_
 < Dimension of the residual vector More...
 
std::size_t nr_
 
bool true_hessian_
 
- Protected Attributes inherited from ActivationModelAbstractTpl< _Scalar >
std::size_t nr_
 

Detailed Description

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

2-norm barrier activation

This activation function describes a quadratic barrier of the 2-norm of a residual vector, i.e.,

\[ \Bigg\{\begin{aligned} &\frac{1}{2} (d - \alpha)^2, &\textrm{if} \,\,\, d < \alpha \\ &0, &\textrm{otherwise}, \end{aligned} \]

where \(d = \|r\|\) is the norm of the residual, \(\alpha\) the threshold distance from which the barrier is active, \(nr\) is the dimension of the residual vector.

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

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

Definition at line 42 of file 2norm-barrier.hpp.

Constructor & Destructor Documentation

◆ ActivationModel2NormBarrierTpl()

ActivationModel2NormBarrierTpl ( const std::size_t  nr,
const Scalar  alpha = Scalar(0.1),
const bool  true_hessian = false 
)
inlineexplicit

Initialize the 2-norm barrier activation model.

The default alpha value is defined as 0.1.

Parameters
[in]nrDimension of the residual vector
[in]alphaThreshold factor (default 0.1)
[in]true_hessianBoolean indicating whether to use the Gauss-Newton approximation or true Hessian in computing the derivatives (default: false)

Definition at line 64 of file 2norm-barrier.hpp.

Member Function Documentation

◆ calc()

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

Compute the 2-norm barrier function.

Parameters
[in]data2-norm barrier activation data
[in]rResidual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 81 of file 2norm-barrier.hpp.

◆ calcDiff()

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

Compute the derivatives of the 2norm-barrier function.

Parameters
[in]data2-norm barrier activation data
[in]rResidual vector \(\mathbf{r}\in\mathbb{R}^{nr}\)

Implements ActivationModelAbstractTpl< _Scalar >.

Definition at line 104 of file 2norm-barrier.hpp.

◆ createData()

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

Create the 2norm-barrier activation data.

Returns
the activation data

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 134 of file 2norm-barrier.hpp.

◆ print()

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

Print relevant information of the 2-norm barrier model.

Parameters
[out]osOutput stream object

Reimplemented from ActivationModelAbstractTpl< _Scalar >.

Definition at line 149 of file 2norm-barrier.hpp.

Member Data Documentation

◆ alpha_

Scalar alpha_
protected

< Dimension of the residual vector

Threshold factor

Definition at line 156 of file 2norm-barrier.hpp.

◆ true_hessian_

bool true_hessian_
protected

Use true Hessian in calcDiff if true, Gauss-Newton approximation if false

Definition at line 157 of file 2norm-barrier.hpp.


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