aligator  0.14.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
quad-state-cost.hpp
Go to the documentation of this file.
1
4#pragma once
5
8
9namespace aligator {
10
12template <typename Scalar>
19
20 // StateError's space variable holds a pointer to the state manifold
21 QuadraticStateCostTpl(const StateError &resdl, const MatrixXs &weights)
22 : Base(resdl.space_, xyz::polymorphic<StageFunction>(resdl), weights) {}
23
25 const ConstVectorRef &target, const MatrixXs &weights)
26 : QuadraticStateCostTpl(StateError(std::move(space), nu, target),
27 weights) {}
28
29 template <typename U,
30 typename = std::enable_if_t<!is_polymorphic_of_v<Manifold, U>>>
31 QuadraticStateCostTpl(U &&space, const int nu, const ConstVectorRef &target,
32 const MatrixXs &weights)
33 : QuadraticStateCostTpl(StateError(std::forward<U>(space), nu, target),
34 weights) {}
35
36 void setTarget(const ConstVectorRef target) { residual().target_ = target; }
37 ConstVectorRef getTarget() const { return residual().target_; }
38
39protected:
40 StateError &residual() { return static_cast<StateError &>(*this->residual_); }
41 const StateError &residual() const {
42 return static_cast<const StateError &>(*this->residual_);
43 }
44};
45
46template <typename Scalar>
53
55 const ControlError &resdl, const MatrixXs &weights)
56 : Base(std::move(space), xyz::polymorphic<StageFunction>(resdl),
57 weights) {}
58
60 const ConstMatrixRef &weights)
62 weights) {}
63
65 const ConstVectorRef &target,
66 const ConstMatrixRef &weights)
68 weights) {}
69
70 void setTarget(const ConstVectorRef &target) { residual().target_ = target; }
71 ConstVectorRef getTarget() const { return residual().target_; }
72
73protected:
75 return static_cast<ControlError &>(*this->residual_);
76 }
77 const ControlError &residual() const {
78 return static_cast<const ControlError &>(*this->residual_);
79 }
80};
81
82} // namespace aligator
83
84#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
85#include "./quad-state-cost.txx"
86#endif
Main package namespace.
Definition fwd.hpp:52
xyz::polymorphic< Manifold > space
Base class for manifolds, to use in cost funcs, solvers...
void setTarget(const ConstVectorRef &target)
QuadraticResidualCostTpl< Scalar > Base
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, const ControlError &resdl, const MatrixXs &weights)
StageFunctionTpl< Scalar > StageFunction
const ControlError & residual() const
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, const ConstVectorRef &target, const ConstMatrixRef &weights)
ManifoldAbstractTpl< Scalar > Manifold
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, int nu, const ConstMatrixRef &weights)
ControlErrorResidualTpl< Scalar > ControlError
xyz::polymorphic< StageFunction > residual_
QuadraticResidualCostTpl(xyz::polymorphic< Manifold > space, xyz::polymorphic< StageFunction > function, const ConstMatrixRef &weights)
StageFunctionTpl< Scalar > StageFunction
QuadraticStateCostTpl(const StateError &resdl, const MatrixXs &weights)
ManifoldAbstractTpl< Scalar > Manifold
ConstVectorRef getTarget() const
QuadraticStateCostTpl(xyz::polymorphic< Manifold > space, const int nu, const ConstVectorRef &target, const MatrixXs &weights)
const StateError & residual() const
StateErrorResidualTpl< Scalar > StateError
QuadraticStateCostTpl(U &&space, const int nu, const ConstVectorRef &target, const MatrixXs &weights)
void setTarget(const ConstVectorRef target)
QuadraticResidualCostTpl< Scalar > Base
Class representing ternary functions .