aligator  0.14.0
A primal-dual augmented Lagrangian-type solver for nonlinear 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#include <sstream>
8
9namespace aligator {
10
12template <typename _Scalar> struct ResultsTpl final : ResultsBaseTpl<_Scalar> {
13 using Scalar = _Scalar;
16 using Base::conv;
17 using Base::gains_;
18 using Base::num_iters;
19 using Base::us;
20 using Base::xs;
21
23 std::vector<VectorXs> lams;
25 std::vector<VectorXs> vs;
27 std::size_t al_iter = 0;
28
29 explicit ResultsTpl()
30 : Base() {}
31
32 ResultsTpl(const ResultsTpl &) = delete;
33 ResultsTpl &operator=(const ResultsTpl &) = delete;
34
35 ResultsTpl(ResultsTpl &&) = default;
37
40 explicit ResultsTpl(const TrajOptProblemTpl<Scalar> &problem);
41
43 const ConstVectorRef &x0);
44};
45
46template <typename Scalar>
47std::ostream &operator<<(std::ostream &oss, const ResultsTpl<Scalar> &self) {
48 return oss << fmt::format("{}", self);
49}
50
51} // namespace aligator
52
53template <typename Scalar> struct fmt::formatter<aligator::ResultsTpl<Scalar>> {
54 constexpr auto parse(format_parse_context &ctx) const
55 -> decltype(ctx.begin()) {
56 return ctx.end();
57 }
58
59 auto format(const aligator::ResultsTpl<Scalar> &self,
60 format_context &ctx) const -> decltype(ctx.out()) {
61 auto s = self.printBase();
62 return fmt::format_to(ctx.out(), "Results {{{}\n}}", s);
63 }
64};
65
66#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
67#include "./results.txx"
68#endif
Main package namespace.
std::ostream & operator<<(std::ostream &oss, const ExplicitDynamicsDataTpl< S > &self)
std::vector< MatrixXs > gains_
Results holder struct.
Definition results.hpp:12
ResultsTpl(ResultsTpl &&)=default
ResultsTpl(const ResultsTpl &)=delete
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:23
void cycleAppend(const TrajOptProblemTpl< Scalar > &problem, const ConstVectorRef &x0)
ResultsTpl & operator=(ResultsTpl &&)=default
std::vector< VectorXs > vs
Definition results.hpp:25
ResultsTpl & operator=(const ResultsTpl &)=delete
ResultsBaseTpl< Scalar > Base
Definition results.hpp:15
Trajectory optimization problem.