aligator  0.9.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
function-abstract.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include "aligator/fwd.hpp"
7#include <ostream>
8
9namespace aligator {
10
12template <typename _Scalar> struct StageFunctionTpl {
13public:
14 using Scalar = _Scalar;
17
19 const int ndx1;
21 const int nu;
23 const int nr;
24
25 StageFunctionTpl(const int ndx, const int nu, const int nr);
26
33 virtual void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
34 Data &data) const = 0;
35
50 virtual void computeJacobians(const ConstVectorRef &x,
51 const ConstVectorRef &u, Data &data) const = 0;
52
61 virtual void computeVectorHessianProducts(const ConstVectorRef &x,
62 const ConstVectorRef &u,
63 const ConstVectorRef &lbda,
64 Data &data) const;
65
66 virtual ~StageFunctionTpl() = default;
67
69 virtual shared_ptr<Data> createData() const;
70};
71
73template <typename _Scalar> struct StageFunctionDataTpl {
74 using Scalar = _Scalar;
76
77 const int ndx1;
78 const int nu;
79 const int nr;
81 const int nvar = ndx1 + nu;
82
84 VectorXs value_;
85 VectorRef valref_;
87 MatrixXs jac_buffer_;
89 MatrixXs vhp_buffer_;
91 MatrixRef Jx_;
93 MatrixRef Ju_;
94
95 /* Vector-Hessian product buffers */
96
97 MatrixRef Hxx_;
98 MatrixRef Hxu_;
99 MatrixRef Huu_;
100
102 StageFunctionDataTpl(const int ndx, const int nu, const int nr);
104 virtual ~StageFunctionDataTpl() = default;
105};
106
107template <typename T>
108std::ostream &operator<<(std::ostream &oss,
109 const StageFunctionDataTpl<T> &self);
110
111} // namespace aligator
112
113#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
114#include "aligator/core/function-abstract.txx"
115#endif
Forward declarations.
Main package namespace.
std::ostream & operator<<(std::ostream &oss, const ExplicitDynamicsDataTpl< S > &self)
Base struct for function data.
Definition fwd.hpp:62
StageFunctionDataTpl(const int ndx, const int nu, const int nr)
Default constructor.
const int nvar
Total number of variables.
StageFunctionDataTpl(const StageFunctionTpl< Scalar > &model)
MatrixXs vhp_buffer_
Vector-Hessian product buffer.
MatrixXs jac_buffer_
Full Jacobian.
MatrixRef Jx_
Jacobian with respect to .
virtual ~StageFunctionDataTpl()=default
MatrixRef Ju_
Jacobian with respect to .
Class representing ternary functions .
Definition fwd.hpp:56
StageFunctionTpl(const int ndx, const int nu, const int nr)
const int nu
Control dimension.
const int nr
Function codimension.
virtual ~StageFunctionTpl()=default
virtual shared_ptr< Data > createData() const
Instantiate a Data object.
virtual void computeVectorHessianProducts(const ConstVectorRef &x, const ConstVectorRef &u, const ConstVectorRef &lbda, Data &data) const
Compute the vector-hessian products of this function.
const int ndx1
Current state dimension.
virtual void computeJacobians(const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const =0
Compute Jacobians of this function.
virtual void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, Data &data) const =0
Evaluate the function.