aligator  0.10.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>
17 using Manifold = ManifoldAbstractTpl<Scalar>;
18
19 // StateError's space variable holds a pointer to the state manifold
20 QuadraticStateCostTpl(StateError resdl, const MatrixXs &weights)
21 : Base(resdl.space_, resdl, weights) {}
22
23 QuadraticStateCostTpl(xyz::polymorphic<Manifold> space, const int nu,
24 const ConstVectorRef &target, const MatrixXs &weights)
25 : QuadraticStateCostTpl(StateError(space, nu, target), weights) {}
26
27 void setTarget(const ConstVectorRef target) { residual().target_ = target; }
28 ConstVectorRef getTarget() const { return residual().target_; }
29
30protected:
31 StateError &residual() { return static_cast<StateError &>(*this->residual_); }
32 const StateError &residual() const {
33 return static_cast<const StateError &>(*this->residual_);
34 }
35};
36
37template <typename Scalar>
41 using Manifold = ManifoldAbstractTpl<Scalar>;
43
44 QuadraticControlCostTpl(xyz::polymorphic<Manifold> space, Error resdl,
45 const MatrixXs &weights)
46 : Base(space, resdl, weights) {}
47
48 QuadraticControlCostTpl(xyz::polymorphic<Manifold> space, int nu,
49 const ConstMatrixRef &weights)
50 : QuadraticControlCostTpl(space, Error(space->ndx(), nu), weights) {}
51
52 QuadraticControlCostTpl(xyz::polymorphic<Manifold> space,
53 const ConstVectorRef &target,
54 const ConstMatrixRef &weights)
55 : QuadraticControlCostTpl(space, Error(space->ndx(), target), weights) {}
56
57 void setTarget(const ConstVectorRef &target) { residual().target_ = target; }
58 ConstVectorRef getTarget() const { return residual().target_; }
59
60protected:
61 Error &residual() { return static_cast<Error &>(*this->residual_); }
62 const Error &residual() const {
63 return static_cast<const Error &>(*this->residual_);
64 }
65};
66
67} // namespace aligator
68
69#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
70#include "./quad-state-cost.txx"
71#endif
Main package namespace.
int nu
Control dimension.
xyz::polymorphic< Manifold > space
State dimension.
void setTarget(const ConstVectorRef &target)
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, Error resdl, const MatrixXs &weights)
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, const ConstVectorRef &target, const ConstMatrixRef &weights)
ManifoldAbstractTpl< Scalar > Manifold
QuadraticControlCostTpl(xyz::polymorphic< Manifold > space, int nu, const ConstMatrixRef &weights)
Quadratic composite of an underlying function.
xyz::polymorphic< StageFunction > residual_
Quadratic distance cost over the state manifold.
ManifoldAbstractTpl< Scalar > Manifold
QuadraticStateCostTpl(StateError resdl, const MatrixXs &weights)
ConstVectorRef getTarget() const
QuadraticStateCostTpl(xyz::polymorphic< Manifold > space, const int nu, const ConstVectorRef &target, const MatrixXs &weights)
const StateError & residual() const
void setTarget(const ConstVectorRef target)