proxsuite-nlp  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear programming on manifolds.
Loading...
Searching...
No Matches
proxsuite::nlp::CostSumTpl< _Scalar > Struct Template Reference

Defines the sum of one or more cost functions \(c_1 + c_2 + \cdots\). More...

#include <proxsuite-nlp/cost-sum.hpp>

Inheritance diagram for proxsuite::nlp::CostSumTpl< _Scalar >:
[legend]
Collaboration diagram for proxsuite::nlp::CostSumTpl< _Scalar >:
[legend]

Public Types

using Scalar = _Scalar
 
using Base = CostFunctionBaseTpl<Scalar>
 
using BasePtr = shared_ptr<Base>
 
- Public Types inherited from proxsuite::nlp::CostFunctionBaseTpl< _Scalar >
using Scalar
 
using Base
 
- Public Types inherited from proxsuite::nlp::C2FunctionTpl< _Scalar >
using Scalar
 
using Base
 
- Public Types inherited from proxsuite::nlp::C1FunctionTpl< _Scalar >
using Scalar
 
using Base
 
- Public Types inherited from proxsuite::nlp::BaseFunctionTpl< _Scalar >
using Scalar
 
- Public Types inherited from proxsuite::nlp::math_types< _Scalar >
using Scalar = _Scalar
 

Public Member Functions

 CostSumTpl (int nx, int ndx)
 cost component weights
 
 CostSumTpl (int nx, int ndx, const std::vector< BasePtr > &comps, const std::vector< Scalar > &weights)
 Constructor with a predefined vector of components.
 
std::size_t numComponents () const
 
auto clone () const
 
Scalar call (const ConstVectorRef &x) const
 Evaluate the cost function.
 
void computeGradient (const ConstVectorRef &x, VectorRef out) const
 
void computeHessian (const ConstVectorRef &x, MatrixRef out) const
 
void addComponent (shared_ptr< Base > comp, const Scalar w=1.)
 
CostSumTpl< Scalar > & operator+= (const shared_ptr< Base > &other)
 
CostSumTpl< Scalar > & operator+= (const CostSumTpl< Scalar > &other)
 
CostSumTpl< Scalar > & operator*= (Scalar rhs)
 
- Public Member Functions inherited from proxsuite::nlp::CostFunctionBaseTpl< _Scalar >
 CostFunctionBaseTpl (const int nx, const int ndx)
 
 CostFunctionBaseTpl (const ManifoldAbstractTpl< _Scalar > &manifold)
 
VectorXs computeGradient (const ConstVectorRef &x) const
 
MatrixXs computeHessian (const ConstVectorRef &x) const
 
VectorXs operator() (const ConstVectorRef &x) const
 Evaluate the residual at a given point x.
 
void computeJacobian (const ConstVectorRef &x, MatrixRef Jout) const
 Jacobian matrix of the constraint function.
 
void vectorHessianProduct (const ConstVectorRef &x, const ConstVectorRef &v, MatrixRef Hout) const
 Vector-hessian product.
 
virtual ~CostFunctionBaseTpl ()=default
 
- Public Member Functions inherited from proxsuite::nlp::C2FunctionTpl< _Scalar >
 C2FunctionTpl (const int nx, const int ndx, const int nr)
 
 C2FunctionTpl (const ManifoldAbstractTpl< _Scalar > &manifold, const int nr)
 
- Public Member Functions inherited from proxsuite::nlp::C1FunctionTpl< _Scalar >
 C1FunctionTpl (const int nx, const int ndx, const int nr)
 
 C1FunctionTpl (const ManifoldAbstractTpl< _Scalar > &manifold, const int nr)
 
MatrixXs computeJacobian (const ConstVectorRef &x) const
 Jacobian matrix of the constraint function.
 
- Public Member Functions inherited from proxsuite::nlp::BaseFunctionTpl< _Scalar >
 BaseFunctionTpl (const int nx, const int ndx, const int nr)
 
 BaseFunctionTpl (const ManifoldAbstractTpl< _Scalar > &manifold, const int nr)
 
virtual ~BaseFunctionTpl ()=default
 
int nx () const
 Get function input vector size (representation of manifold).
 
int ndx () const
 Get input manifold's tangent space dimension.
 
int nr () const
 Get function codimension.
 

Public Attributes

 Scalar
 
std::vector< BasePtrcomponents_
 
std::vector< Scalarweights_
 component sub-costs
 
- Public Attributes inherited from proxsuite::nlp::CostFunctionBaseTpl< _Scalar >
 Scalar
 
- Public Attributes inherited from proxsuite::nlp::C2FunctionTpl< _Scalar >
 Scalar
 
- Public Attributes inherited from proxsuite::nlp::C1FunctionTpl< _Scalar >
 Scalar
 
- Public Attributes inherited from proxsuite::nlp::BaseFunctionTpl< _Scalar >
 Scalar
 
- Public Attributes inherited from proxsuite::nlp::math_types< _Scalar >
 _Scalar
 

Friends

std::ostream & operator<< (std::ostream &ostr, const CostSumTpl< Scalar > &cost)
 
auto operator* (CostSumTpl const &self, Scalar a) -> shared_ptr< CostSumTpl >
 
auto operator* (Scalar a, CostSumTpl const &self)
 
auto operator- (CostSumTpl const &self)
 

Additional Inherited Members

- Protected Attributes inherited from proxsuite::nlp::BaseFunctionTpl< _Scalar >
int nx_
 
int ndx_
 
int nr_
 

Detailed Description

template<typename _Scalar>
struct proxsuite::nlp::CostSumTpl< _Scalar >

Defines the sum of one or more cost functions \(c_1 + c_2 + \cdots\).

Definition at line 12 of file cost-sum.hpp.

Member Typedef Documentation

◆ Scalar

template<typename _Scalar >
using proxsuite::nlp::CostSumTpl< _Scalar >::Scalar = _Scalar

Definition at line 14 of file cost-sum.hpp.

◆ Base

template<typename _Scalar >
using proxsuite::nlp::CostSumTpl< _Scalar >::Base = CostFunctionBaseTpl<Scalar>

Definition at line 16 of file cost-sum.hpp.

◆ BasePtr

template<typename _Scalar >
using proxsuite::nlp::CostSumTpl< _Scalar >::BasePtr = shared_ptr<Base>

Definition at line 17 of file cost-sum.hpp.

Constructor & Destructor Documentation

◆ CostSumTpl() [1/2]

template<typename _Scalar >
proxsuite::nlp::CostSumTpl< _Scalar >::CostSumTpl ( int nx,
int ndx )
inline

cost component weights

Definition at line 22 of file cost-sum.hpp.

◆ CostSumTpl() [2/2]

template<typename _Scalar >
proxsuite::nlp::CostSumTpl< _Scalar >::CostSumTpl ( int nx,
int ndx,
const std::vector< BasePtr > & comps,
const std::vector< Scalar > & weights )
inline

Constructor with a predefined vector of components.

Definition at line 25 of file cost-sum.hpp.

Member Function Documentation

◆ numComponents()

template<typename _Scalar >
std::size_t proxsuite::nlp::CostSumTpl< _Scalar >::numComponents ( ) const
inline

Definition at line 31 of file cost-sum.hpp.

◆ clone()

template<typename _Scalar >
auto proxsuite::nlp::CostSumTpl< _Scalar >::clone ( ) const
inline

Definition at line 33 of file cost-sum.hpp.

◆ call()

template<typename _Scalar >
Scalar proxsuite::nlp::CostSumTpl< _Scalar >::call ( const ConstVectorRef & x) const
inlinevirtual

Evaluate the cost function.

Implements proxsuite::nlp::CostFunctionBaseTpl< _Scalar >.

Definition at line 35 of file cost-sum.hpp.

◆ computeGradient()

template<typename _Scalar >
void proxsuite::nlp::CostSumTpl< _Scalar >::computeGradient ( const ConstVectorRef & x,
VectorRef out ) const
inlinevirtual

Implements proxsuite::nlp::CostFunctionBaseTpl< _Scalar >.

Definition at line 43 of file cost-sum.hpp.

◆ computeHessian()

template<typename _Scalar >
void proxsuite::nlp::CostSumTpl< _Scalar >::computeHessian ( const ConstVectorRef & x,
MatrixRef out ) const
inlinevirtual

Implements proxsuite::nlp::CostFunctionBaseTpl< _Scalar >.

Definition at line 50 of file cost-sum.hpp.

◆ addComponent()

template<typename _Scalar >
void proxsuite::nlp::CostSumTpl< _Scalar >::addComponent ( shared_ptr< Base > comp,
const Scalar w = 1. )
inline

Definition at line 59 of file cost-sum.hpp.

◆ operator+=() [1/2]

template<typename _Scalar >
CostSumTpl< Scalar > & proxsuite::nlp::CostSumTpl< _Scalar >::operator+= ( const shared_ptr< Base > & other)
inline

Definition at line 64 of file cost-sum.hpp.

◆ operator+=() [2/2]

template<typename _Scalar >
CostSumTpl< Scalar > & proxsuite::nlp::CostSumTpl< _Scalar >::operator+= ( const CostSumTpl< Scalar > & other)
inline

Definition at line 69 of file cost-sum.hpp.

◆ operator*=()

template<typename _Scalar >
CostSumTpl< Scalar > & proxsuite::nlp::CostSumTpl< _Scalar >::operator*= ( Scalar rhs)
inline

Definition at line 77 of file cost-sum.hpp.

Friends And Related Symbol Documentation

◆ operator<<

template<typename _Scalar >
std::ostream & operator<< ( std::ostream & ostr,
const CostSumTpl< Scalar > & cost )
friend

Definition at line 85 of file cost-sum.hpp.

◆ operator* [1/2]

template<typename _Scalar >
auto operator* ( CostSumTpl< _Scalar > const & self,
Scalar a ) -> shared_ptr<CostSumTpl>
friend

Definition at line 100 of file cost-sum.hpp.

◆ operator* [2/2]

template<typename _Scalar >
auto operator* ( Scalar a,
CostSumTpl< _Scalar > const & self )
friend

Definition at line 107 of file cost-sum.hpp.

◆ operator-

template<typename _Scalar >
auto operator- ( CostSumTpl< _Scalar > const & self)
friend

Definition at line 109 of file cost-sum.hpp.

Member Data Documentation

◆ Scalar

template<typename _Scalar >
proxsuite::nlp::CostSumTpl< _Scalar >::Scalar

Definition at line 15 of file cost-sum.hpp.

◆ components_

template<typename _Scalar >
std::vector<BasePtr> proxsuite::nlp::CostSumTpl< _Scalar >::components_

Definition at line 19 of file cost-sum.hpp.

◆ weights_

template<typename _Scalar >
std::vector<Scalar> proxsuite::nlp::CostSumTpl< _Scalar >::weights_

component sub-costs

Definition at line 20 of file cost-sum.hpp.


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