alpaqa matlab
Nonconvex constrained optimization
Loading...
Searching...
No Matches
problem-counters.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <alpaqa/export.h>
4
5#include <chrono>
6#include <iosfwd>
7
8namespace alpaqa {
9
11 unsigned proj_diff_g{};
12 unsigned proj_multipliers{};
13 unsigned prox_grad_step{};
15 unsigned f{};
16 unsigned grad_f{};
17 unsigned f_grad_f{};
18 unsigned f_g{};
20 unsigned g{};
21 unsigned grad_g_prod{};
22 unsigned grad_gi{};
23 unsigned jac_g{};
24 unsigned grad_L{};
25 unsigned hess_L_prod{};
26 unsigned hess_L{};
27 unsigned hess_ψ_prod{};
28 unsigned hess_ψ{};
29 unsigned ψ{};
30 unsigned grad_ψ{};
31 unsigned ψ_grad_ψ{};
32
33 struct EvalTimer {
34 std::chrono::nanoseconds proj_diff_g{};
35 std::chrono::nanoseconds proj_multipliers{};
36 std::chrono::nanoseconds prox_grad_step{};
37 std::chrono::nanoseconds inactive_indices_res_lna{};
38 std::chrono::nanoseconds f{};
39 std::chrono::nanoseconds grad_f{};
40 std::chrono::nanoseconds f_grad_f{};
41 std::chrono::nanoseconds f_g{};
42 std::chrono::nanoseconds grad_f_grad_g_prod{};
43 std::chrono::nanoseconds g{};
44 std::chrono::nanoseconds grad_g_prod{};
45 std::chrono::nanoseconds grad_gi{};
46 std::chrono::nanoseconds jac_g{};
47 std::chrono::nanoseconds grad_L{};
48 std::chrono::nanoseconds hess_L_prod{};
49 std::chrono::nanoseconds hess_L{};
50 std::chrono::nanoseconds hess_ψ_prod{};
51 std::chrono::nanoseconds hess_ψ{};
52 std::chrono::nanoseconds ψ{};
53 std::chrono::nanoseconds grad_ψ{};
54 std::chrono::nanoseconds ψ_grad_ψ{};
56
57 void reset() { *this = {}; }
58};
59
60ALPAQA_EXPORT std::ostream &operator<<(std::ostream &, const EvalCounter &);
61
63 const EvalCounter::EvalTimer &b) {
64 a.proj_diff_g += b.proj_diff_g;
65 a.proj_multipliers += b.proj_multipliers;
66 a.prox_grad_step += b.prox_grad_step;
67 a.inactive_indices_res_lna += b.inactive_indices_res_lna;
68 a.f += b.f;
69 a.grad_f += b.grad_f;
70 a.f_grad_f += b.f_grad_f;
71 a.f_g += b.f_g;
72 a.grad_f_grad_g_prod += b.grad_f_grad_g_prod;
73 a.g += b.g;
74 a.grad_g_prod += b.grad_g_prod;
75 a.grad_gi += b.grad_gi;
76 a.jac_g += b.jac_g;
77 a.grad_L += b.grad_L;
78 a.hess_L_prod += b.hess_L_prod;
79 a.hess_L += b.hess_L;
80 a.hess_ψ_prod += b.hess_ψ_prod;
81 a.hess_ψ += b.hess_ψ;
82 a.ψ += b.ψ;
83 a.grad_ψ += b.grad_ψ;
84 a.ψ_grad_ψ += b.ψ_grad_ψ;
85 return a;
86}
87
89 a.proj_diff_g += b.proj_diff_g;
90 a.proj_multipliers += b.proj_multipliers;
91 a.prox_grad_step += b.prox_grad_step;
92 a.inactive_indices_res_lna += b.inactive_indices_res_lna;
93 a.f += b.f;
94 a.grad_f += b.grad_f;
95 a.f_grad_f += b.f_grad_f;
96 a.f_g += b.f_g;
97 a.grad_f_grad_g_prod += b.grad_f_grad_g_prod;
98 a.g += b.g;
99 a.grad_g_prod += b.grad_g_prod;
100 a.grad_gi += b.grad_gi;
101 a.jac_g += b.jac_g;
102 a.grad_L += b.grad_L;
103 a.hess_L_prod += b.hess_L_prod;
104 a.hess_L += b.hess_L;
105 a.hess_ψ_prod += b.hess_ψ_prod;
106 a.hess_ψ += b.hess_ψ;
107 a.ψ += b.ψ;
108 a.grad_ψ += b.grad_ψ;
109 a.ψ_grad_ψ += b.ψ_grad_ψ;
110 a.time += b.time;
111 return a;
112}
113
114inline EvalCounter operator+(EvalCounter a, const EvalCounter &b) { return a += b; }
115
116} // namespace alpaqa
std::ostream & operator<<(std::ostream &os, PANOCStopCrit s)
OCPEvalCounter operator+(OCPEvalCounter a, const OCPEvalCounter &b)
InnerStatsAccumulator< FISTAStats< Conf > > & operator+=(InnerStatsAccumulator< FISTAStats< Conf > > &acc, const FISTAStats< Conf > &s)
Definition fista.hpp:189
constexpr const auto inf
Definition config.hpp:85
std::chrono::nanoseconds grad_gi
std::chrono::nanoseconds proj_diff_g
std::chrono::nanoseconds inactive_indices_res_lna
std::chrono::nanoseconds jac_g
std::chrono::nanoseconds ψ_grad_ψ
std::chrono::nanoseconds grad_f_grad_g_prod
struct alpaqa::EvalCounter::EvalTimer time
std::chrono::nanoseconds hess_L
std::chrono::nanoseconds f_grad_f
std::chrono::nanoseconds grad_f
std::chrono::nanoseconds hess_ψ
std::chrono::nanoseconds grad_ψ
std::chrono::nanoseconds hess_ψ_prod
std::chrono::nanoseconds prox_grad_step
std::chrono::nanoseconds ψ
std::chrono::nanoseconds f_g
std::chrono::nanoseconds grad_L
std::chrono::nanoseconds proj_multipliers
std::chrono::nanoseconds grad_g_prod
std::chrono::nanoseconds hess_L_prod