alpaqa 1.0.0a15
Nonconvex constrained optimization
Loading...
Searching...
No Matches
ocproblem-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 f{};
12 unsigned jac_f{};
13 unsigned grad_f_prod{};
14 unsigned h{};
15 unsigned h_N{};
16 unsigned l{};
17 unsigned l_N{};
18 unsigned qr{};
19 unsigned q_N{};
20 unsigned add_Q{};
21 unsigned add_Q_N{};
22 unsigned add_R_masked{};
23 unsigned add_S_masked{};
26 unsigned constr{};
27 unsigned constr_N{};
28 unsigned grad_constr_prod{};
32
33 struct OCPEvalTimer {
34 std::chrono::nanoseconds f{};
35 std::chrono::nanoseconds jac_f{};
36 std::chrono::nanoseconds grad_f_prod{};
37 std::chrono::nanoseconds h{};
38 std::chrono::nanoseconds h_N{};
39 std::chrono::nanoseconds l{};
40 std::chrono::nanoseconds l_N{};
41 std::chrono::nanoseconds qr{};
42 std::chrono::nanoseconds q_N{};
43 std::chrono::nanoseconds add_Q{};
44 std::chrono::nanoseconds add_Q_N{};
45 std::chrono::nanoseconds add_R_masked{};
46 std::chrono::nanoseconds add_S_masked{};
47 std::chrono::nanoseconds add_R_prod_masked{};
48 std::chrono::nanoseconds add_S_prod_masked{};
49 std::chrono::nanoseconds constr{};
50 std::chrono::nanoseconds constr_N{};
51 std::chrono::nanoseconds grad_constr_prod{};
52 std::chrono::nanoseconds grad_constr_prod_N{};
53 std::chrono::nanoseconds add_gn_hess_constr{};
54 std::chrono::nanoseconds add_gn_hess_constr_N{};
56
57 void reset() { *this = {}; }
58};
59
60ALPAQA_EXPORT std::ostream &operator<<(std::ostream &, const OCPEvalCounter &);
61
64 a.f += b.f;
65 a.jac_f += b.jac_f;
66 a.grad_f_prod += b.grad_f_prod;
67 a.h += b.h;
68 a.h_N += b.h_N;
69 a.l += b.l;
70 a.l_N += b.l_N;
71 a.qr += b.qr;
72 a.q_N += b.q_N;
73 a.add_Q += b.add_Q;
74 a.add_Q_N += b.add_Q_N;
75 a.add_R_masked += b.add_R_masked;
76 a.add_S_masked += b.add_S_masked;
77 a.add_R_prod_masked += b.add_R_prod_masked;
78 a.add_S_prod_masked += b.add_S_prod_masked;
79 a.constr += b.constr;
80 a.constr_N += b.constr_N;
81 a.grad_constr_prod += b.grad_constr_prod;
82 a.grad_constr_prod_N += b.grad_constr_prod_N;
83 a.add_gn_hess_constr += b.add_gn_hess_constr;
84 a.add_gn_hess_constr_N += b.add_gn_hess_constr_N;
85 return a;
86}
87
89 a.f += b.f;
90 a.jac_f += b.jac_f;
91 a.grad_f_prod += b.grad_f_prod;
92 a.h += b.h;
93 a.h_N += b.h_N;
94 a.l += b.l;
95 a.l_N += b.l_N;
96 a.qr += b.qr;
97 a.q_N += b.q_N;
98 a.add_Q += b.add_Q;
99 a.add_Q_N += b.add_Q_N;
100 a.add_R_masked += b.add_R_masked;
101 a.add_S_masked += b.add_S_masked;
102 a.add_R_prod_masked += b.add_R_prod_masked;
103 a.add_S_prod_masked += b.add_S_prod_masked;
104 a.constr += b.constr;
105 a.constr_N += b.constr_N;
106 a.grad_constr_prod += b.grad_constr_prod;
107 a.grad_constr_prod_N += b.grad_constr_prod_N;
108 a.add_gn_hess_constr += b.add_gn_hess_constr;
109 a.add_gn_hess_constr_N += b.add_gn_hess_constr_N;
110 a.time += b.time;
111 return a;
112}
113
114inline OCPEvalCounter operator+(OCPEvalCounter a, const OCPEvalCounter &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_constr_prod_N
struct alpaqa::OCPEvalCounter::OCPEvalTimer time
std::chrono::nanoseconds add_gn_hess_constr
std::chrono::nanoseconds add_gn_hess_constr_N