aligator  0.10.0
A primal-dual augmented Lagrangian-type solver for nonlinear trajectory optimization.
Loading...
Searching...
No Matches
history-callback.hpp
Go to the documentation of this file.
1
2#pragma once
3
7
8#include <typeindex>
9#include <any>
10
11namespace aligator {
12
14template <typename Scalar> struct HistoryCallbackTpl : CallbackBaseTpl<Scalar> {
17 template <typename Solver>
18 HistoryCallbackTpl(Solver *solver, bool store_pd_vars = false,
19 bool store_values = true)
20 : store_primal_dual_vars_(store_pd_vars), store_values_(store_values),
21 rtti_(typeid(*solver)), solver_(solver) {}
22
24
25 std::vector<std::vector<VectorXs>> xs;
26 std::vector<std::vector<VectorXs>> us;
27 std::vector<std::vector<VectorXs>> lams;
28 std::vector<Scalar> values;
29 std::vector<Scalar> merit_values;
30 std::vector<Scalar> prim_infeas;
31 std::vector<Scalar> dual_infeas;
32 std::vector<Scalar> inner_crits;
33 std::vector<std::size_t> al_index;
34 std::vector<Scalar> prim_tols;
35 std::vector<Scalar> dual_tols;
36
37 void call(const Workspace & /*workspace*/, const Results &results);
38
41
42private:
43 std::type_index rtti_;
44 std::any solver_;
45};
46
47} // namespace aligator
48
49#ifdef ALIGATOR_ENABLE_TEMPLATE_INSTANTIATION
50#include "./history-callback.txx"
51#endif
Main package namespace.
Base callback class.
Definition fwd.hpp:96
Store the history of results.
std::vector< Scalar > prim_tols
std::vector< Scalar > dual_tols
std::vector< Scalar > prim_infeas
std::vector< std::size_t > al_index
void call(const Workspace &, const Results &results)
std::vector< std::vector< VectorXs > > xs
HistoryCallbackTpl(Solver *solver, bool store_pd_vars=false, bool store_values=true)
std::vector< Scalar > dual_infeas
std::vector< Scalar > merit_values
std::vector< std::vector< VectorXs > > us
std::vector< Scalar > inner_crits
std::vector< std::vector< VectorXs > > lams
Base workspace struct for the algorithms.
Definition fwd.hpp:116