aligator 0.17.1
A versatile and efficient C++ library for real-time constrained 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 {
22template <typename Scalar> struct LogResidualCostTpl : CostAbstractTpl<Scalar> {
29
31 xyz::polymorphic<StageFunction> residual_;
32
33 LogResidualCostTpl(xyz::polymorphic<Manifold> space,
34 xyz::polymorphic<StageFunction> function,
35 const ConstVectorRef &scale);
36
37 LogResidualCostTpl(xyz::polymorphic<Manifold> space,
38 xyz::polymorphic<StageFunction> function,
39 const Scalar scale);
40
41 void evaluate(const ConstVectorRef &x, const ConstVectorRef &u,
42 CostDataAbstract &data) const;
43
44 void computeGradients(const ConstVectorRef &x, const ConstVectorRef &u,
45 CostDataAbstract &data) const;
46
47 void computeHessians(const ConstVectorRef &, const ConstVectorRef &,
48 CostDataAbstract &data) const;
49
50 shared_ptr<CostDataAbstract> createData() const {
51 return std::make_shared<Data>(this->ndx(), this->nu,
52 residual_->createData());
53 }
54
57 template <typename Derived> Derived *getResidual() {
58 return dynamic_cast<Derived *>(&*residual_);
59 }
60
62 template <typename Derived> const Derived *getResidual() const {
63 return dynamic_cast<const Derived *>(&*residual_);
64 }
65};
66
67extern template struct LogResidualCostTpl<context::Scalar>;
68
69} // namespace aligator
70
71#include "./log-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.
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)
CompositeCostDataTpl< Scalar > Data
CostAbstractTpl< Scalar > Base
StageFunctionTpl< Scalar > StageFunction
CostDataAbstractTpl< Scalar > CostDataAbstract
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 .
Base class for manifolds, to use in cost funcs, solvers...
Class representing ternary functions .