aligator  0.14.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
quad-residual-cost.hpp
Go to the documentation of this file.
1
3#pragma once
4
7
8namespace aligator {
9
17template <typename _Scalar>
19 using Scalar = _Scalar;
26
27 MatrixXs weights_;
29 bool gauss_newton = true;
30
33 const ConstMatrixRef &weights);
34
35 void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
36 CostData &data_) const;
37
38 void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u,
39 CostData &data_) const;
40
41 void computeHessians(const ConstVectorRef &x, const ConstVectorRef &u,
42 CostData &data_) const;
43
44 shared_ptr<CostData> createData() const {
45 return std::make_shared<Data>(this->ndx(), this->nu,
46 residual_->createData());
47 }
48
51 template <typename Derived> Derived *getResidual() {
52 return dynamic_cast<Derived *>(&*residual_);
53 }
54
56 template <typename Derived> const Derived *getResidual() const {
57 return dynamic_cast<const Derived *>(&*residual_);
58 }
59};
60
61#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
62extern template struct QuadraticResidualCostTpl<context::Scalar>;
63#endif
64
65} // namespace aligator
66
67#include "./quad-residual-cost.hxx"
Main package namespace.
Data struct for composite costs.
xyz::polymorphic< Manifold > space
CostAbstractTpl(U &&space, const int nu)
Data struct for CostAbstractTpl.
Base class for manifolds, to use in cost funcs, solvers...
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, CostData &data_) const
Evaluate the cost function.
ManifoldAbstractTpl< Scalar > Manifold
void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u, CostData &data_) const
Compute the cost gradients .
shared_ptr< CostData > createData() const
Derived * getResidual()
Get a pointer to the underlying type of the residual, by attempting to cast.
void computeHessians(const ConstVectorRef &x, const ConstVectorRef &u, CostData &data_) const
Compute the cost Hessians .
StageFunctionTpl< Scalar > StageFunction
xyz::polymorphic< StageFunction > residual_
CostDataAbstractTpl< Scalar > CostData
const Derived * getResidual() const
Get a pointer to the underlying type of the residual, by attempting to cast.
CompositeCostDataTpl< Scalar > Data
QuadraticResidualCostTpl(xyz::polymorphic< Manifold > space, xyz::polymorphic< StageFunction > function, const ConstMatrixRef &weights)
Class representing ternary functions .