aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
log-residual-cost.hpp
Go to the documentation of this file.
1
3#pragma once
4
6
7namespace aligator {
8
10template <typename Scalar> struct LogResidualCostTpl : CostAbstractTpl<Scalar> {
16 using Manifold = ManifoldAbstractTpl<Scalar>;
17
19 xyz::polymorphic<StageFunction> residual_;
20
21 LogResidualCostTpl(xyz::polymorphic<Manifold> space,
22 xyz::polymorphic<StageFunction> function,
23 const ConstVectorRef &scale);
24
25 LogResidualCostTpl(xyz::polymorphic<Manifold> space,
26 xyz::polymorphic<StageFunction> function,
27 const Scalar scale);
28
29 void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
30 CostDataAbstract &data) const;
31
32 void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u,
33 CostDataAbstract &data) const;
34
35 void computeHessians(const ConstVectorRef &, const ConstVectorRef &,
36 CostDataAbstract &data) const;
37
38 shared_ptr<CostDataAbstract> createData() const {
39 return std::make_shared<Data>(this->ndx(), this->nu,
40 residual_->createData());
41 }
42
45 template <typename Derived> Derived *getResidual() {
46 return dynamic_cast<Derived *>(&*residual_);
47 }
48
50 template <typename Derived> const Derived *getResidual() const {
51 return dynamic_cast<const Derived *>(&*residual_);
52 }
53};
54
55extern template struct LogResidualCostTpl<context::Scalar>;
56
57} // namespace aligator
58
59#include "./log-residual-cost.hxx"
Main package namespace.
Data struct for composite costs.
Stage costs for control problems.
Definition fwd.hpp:62
int nu
Control dimension.
xyz::polymorphic< Manifold > space
State dimension.
Data struct for CostAbstractTpl.
Definition fwd.hpp:65
Log-barrier of an underlying cost function.
xyz::polymorphic< StageFunction > residual_
shared_ptr< CostDataAbstract > createData() const
LogResidualCostTpl(xyz::polymorphic< Manifold > space, xyz::polymorphic< StageFunction > function, const Scalar scale)
Derived * getResidual()
Get a pointer to the underlying type of the residual, by attempting to cast.
LogResidualCostTpl(xyz::polymorphic< Manifold > space, xyz::polymorphic< StageFunction > function, const ConstVectorRef &scale)
const Derived * getResidual() const
Get a pointer to the underlying type of the residual, by attempting to cast.
ManifoldAbstractTpl< Scalar > Manifold
void evaluate(const ConstVectorRef &x, const ConstVectorRef &u, CostDataAbstract &data) const
Evaluate the cost function.
void computeHessians(const ConstVectorRef &, const ConstVectorRef &, CostDataAbstract &data) const
Compute the cost Hessians .
void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u, CostDataAbstract &data) const
Compute the cost gradients .
Class representing ternary functions .
Definition fwd.hpp:53