2-norm barrier activation More...
#include <2norm-barrier.hpp>
Public Types | |
typedef ActivationDataAbstractTpl< Scalar > | ActivationDataAbstract |
typedef ActivationModelAbstractTpl< Scalar > | Base |
typedef ActivationData2NormBarrierTpl< Scalar > | Data |
typedef MathBaseTpl< Scalar > | MathBase |
typedef MathBase::VectorXs | VectorXs |
![]() | |
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< ActivationDataAbstract > | createData () |
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) |
![]() | |
ActivationModelAbstractTpl (const std::size_t nr) | |
std::size_t | get_nr () const |
Public Attributes | |
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef _Scalar | 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_ |
![]() | |
std::size_t | nr_ |
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.
ActivationModelAbstractTpl
, calc()
, calcDiff()
, createData()
Definition at line 42 of file 2norm-barrier.hpp.
|
inlineexplicit |
Initialize the 2-norm barrier activation model.
The default alpha
value is defined as 0.1.
[in] | nr | Dimension of the residual vector |
[in] | alpha | Threshold factor (default 0.1) |
[in] | true_hessian | Boolean 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.
|
inlinevirtual |
Compute the 2-norm barrier function.
[in] | data | 2-norm barrier activation data |
[in] | r | Residual vector \(\mathbf{r}\in\mathbb{R}^{nr}\) |
Implements ActivationModelAbstractTpl< _Scalar >.
Definition at line 80 of file 2norm-barrier.hpp.
|
inlinevirtual |
Compute the derivatives of the 2norm-barrier function.
[in] | data | 2-norm barrier activation data |
[in] | r | Residual vector \(\mathbf{r}\in\mathbb{R}^{nr}\) |
Implements ActivationModelAbstractTpl< _Scalar >.
Definition at line 103 of file 2norm-barrier.hpp.
|
inlinevirtual |
Create the 2norm-barrier activation data.
Reimplemented from ActivationModelAbstractTpl< _Scalar >.
Definition at line 133 of file 2norm-barrier.hpp.
|
inlinevirtual |
Print relevant information of the 2-norm barrier model.
[out] | os | Output stream object |
Reimplemented from ActivationModelAbstractTpl< _Scalar >.
Definition at line 148 of file 2norm-barrier.hpp.
|
protected |
< Dimension of the residual vector
Threshold factor
Definition at line 155 of file 2norm-barrier.hpp.
|
protected |
Use true Hessian in calcDiff if true, Gauss-Newton approximation if false
Definition at line 156 of file 2norm-barrier.hpp.