aligator  0.16.0
A versatile and efficient C++ library for real-time constrained trajectory optimization.
Loading...
Searching...
No Matches
results.hpp
Go to the documentation of this file.
1
3#pragma once
4
6#include <fmt/ostream.h>
7
8namespace aligator {
9
11template <typename _Scalar> struct ResultsTpl final : ResultsBaseTpl<_Scalar> {
12 using Scalar = _Scalar;
15 using Base::conv;
16 using Base::gains_;
17 using Base::num_iters;
18 using Base::us;
19 using Base::xs;
20
22 std::vector<VectorXs> lams;
24 std::vector<VectorXs> vs;
26 std::size_t al_iter = 0;
27
28 explicit ResultsTpl()
29 : Base() {}
30
31 ResultsTpl(const ResultsTpl &) = default;
32 ResultsTpl &operator=(const ResultsTpl &) = default;
33
34 ResultsTpl(ResultsTpl &&) = default;
36
39 explicit ResultsTpl(const TrajOptProblemTpl<Scalar> &problem);
40
42 const ConstVectorRef &x0);
43};
44
45template <typename Scalar>
46std::ostream &operator<<(std::ostream &oss, const ResultsTpl<Scalar> &self) {
47 return oss << fmt::format("{}", self);
48}
49
50#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
51extern template struct ResultsTpl<context::Scalar>;
52#endif
53} // namespace aligator
54
55template <typename Scalar> struct fmt::formatter<aligator::ResultsTpl<Scalar>> {
56 constexpr auto parse(format_parse_context &ctx) const
57 -> decltype(ctx.begin()) {
58 return ctx.end();
59 }
60
61 auto format(const aligator::ResultsTpl<Scalar> &self,
62 format_context &ctx) const -> decltype(ctx.out()) {
63 auto s = self.printBase();
64 return fmt::format_to(ctx.out(), "Results {{{}\n}}", s);
65 }
66};
Main package namespace.
std::ostream & operator<<(std::ostream &oss, const StageFunctionDataTpl< T > &self)
std::vector< MatrixXs > gains_
Results holder struct.
Definition results.hpp:11
ResultsTpl(ResultsTpl &&)=default
ResultsTpl(const ResultsTpl &)=default
ResultsTpl(const TrajOptProblemTpl< Scalar > &problem)
Create the results struct from a problem (TrajOptProblemTpl) instance.
ALIGATOR_DYNAMIC_TYPEDEFS(Scalar)
std::vector< VectorXs > lams
Definition results.hpp:22
void cycleAppend(const TrajOptProblemTpl< Scalar > &problem, const ConstVectorRef &x0)
ResultsTpl & operator=(ResultsTpl &&)=default
ResultsTpl & operator=(const ResultsTpl &)=default
std::vector< VectorXs > vs
Definition results.hpp:24
ResultsBaseTpl< Scalar > Base
Definition results.hpp:14
Trajectory optimization problem.