#include <alpaqa/include/alpaqa/problem/problem-with-counters.hpp>
Problem wrapper that keeps track of the number of evaluations and the run time of each function.
You probably want to use problem_with_counters or problem_with_counters_ref instead of instantiating this class directly.
std::shared_pointers
, which means that different copies of a ProblemWithCounters instance all share the same counters. To opt out of this behavior, you can use the decouple_evaluations function. Definition at line 24 of file problem-with-counters.hpp.
Public Types | |
using | Box = typename TypeErasedProblem< config_t >::Box |
Public Member Functions | |
void | eval_proj_diff_g (crvec z, rvec e) const |
void | eval_proj_multipliers (rvec y, real_t M) const |
real_t | eval_prox_grad_step (real_t γ, crvec x, crvec grad_ψ, rvec x̂, rvec p) const |
index_t | eval_inactive_indices_res_lna (real_t γ, crvec x, crvec grad_ψ, rindexvec J) const |
real_t | eval_f (crvec x) const |
void | eval_grad_f (crvec x, rvec grad_fx) const |
void | eval_g (crvec x, rvec gx) const |
void | eval_grad_g_prod (crvec x, crvec y, rvec grad_gxy) const |
void | eval_grad_gi (crvec x, index_t i, rvec grad_gi) const |
void | eval_jac_g (crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const |
length_t | get_jac_g_num_nonzeros () const |
void | eval_hess_L_prod (crvec x, crvec y, real_t scale, crvec v, rvec Hv) const |
void | eval_hess_L (crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const |
length_t | get_hess_L_num_nonzeros () const |
void | eval_hess_ψ_prod (crvec x, crvec y, crvec Σ, real_t scale, crvec v, rvec Hv) const |
void | eval_hess_ψ (crvec x, crvec y, crvec Σ, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const |
length_t | get_hess_ψ_num_nonzeros () const |
real_t | eval_f_grad_f (crvec x, rvec grad_fx) const |
real_t | eval_f_g (crvec x, rvec g) const |
void | eval_grad_f_grad_g_prod (crvec x, crvec y, rvec grad_f, rvec grad_gxy) const |
void | eval_grad_L (crvec x, crvec y, rvec grad_L, rvec work_n) const |
real_t | eval_ψ (crvec x, crvec y, crvec Σ, rvec ŷ) const |
void | eval_grad_ψ (crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const |
real_t | eval_ψ_grad_ψ (crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m) const |
const Box & | get_box_C () const |
const Box & | get_box_D () const |
void | check () const |
bool | provides_eval_grad_gi () const |
bool | provides_eval_inactive_indices_res_lna () const |
bool | provides_eval_jac_g () const |
bool | provides_get_jac_g_num_nonzeros () const |
bool | provides_eval_hess_L_prod () const |
bool | provides_eval_hess_L () const |
bool | provides_get_hess_L_num_nonzeros () const |
bool | provides_eval_hess_ψ_prod () const |
bool | provides_eval_hess_ψ () const |
bool | provides_get_hess_ψ_num_nonzeros () const |
bool | provides_eval_f_grad_f () const |
bool | provides_eval_f_g () const |
bool | provides_eval_grad_f_grad_g_prod () const |
bool | provides_eval_grad_L () const |
bool | provides_eval_ψ () const |
bool | provides_eval_grad_ψ () const |
bool | provides_eval_ψ_grad_ψ () const |
bool | provides_get_box_C () const |
bool | provides_get_box_D () const |
bool | provides_check () const |
length_t | get_n () const |
length_t | get_m () const |
ProblemWithCounters ()=default | |
template<class P > requires std::is_same_v<std::remove_cvref_t<P>, std::remove_cvref_t<Problem>> | |
ProblemWithCounters (P &&problem) | |
template<class... Args> requires (!std::is_lvalue_reference_v<Problem>) | |
ProblemWithCounters (std::in_place_t, Args &&...args) | |
void | reset_evaluations () |
Reset all evaluation counters and timers to zero. | |
void | decouple_evaluations () |
Give this instance its own evaluation counters and timers, decoupling it from any other instances they might have previously been shared with. | |
Public Attributes | |
std::shared_ptr< EvalCounter > | evaluations = std::make_shared<EvalCounter>() |
Problem | problem |
Static Private Member Functions | |
template<class TimeT , class FunT > | |
static decltype(auto) | timed (TimeT &time, FunT &&f) |
using Box = typename TypeErasedProblem<config_t>::Box |
Definition at line 26 of file problem-with-counters.hpp.
|
default |
|
inlineexplicit |
Definition at line 89 of file problem-with-counters.hpp.
|
inlineexplicit |
Definition at line 93 of file problem-with-counters.hpp.
Definition at line 32 of file problem-with-counters.hpp.
Definition at line 37 of file problem-with-counters.hpp.
Definition at line 38 of file problem-with-counters.hpp.
|
inline |
Definition at line 39 of file problem-with-counters.hpp.
Definition at line 40 of file problem-with-counters.hpp.
|
inline |
Definition at line 41 of file problem-with-counters.hpp.
|
inline |
Definition at line 42 of file problem-with-counters.hpp.
Definition at line 43 of file problem-with-counters.hpp.
|
inline |
Definition at line 44 of file problem-with-counters.hpp.
|
inline |
Definition at line 45 of file problem-with-counters.hpp.
Definition at line 46 of file problem-with-counters.hpp.
Definition at line 47 of file problem-with-counters.hpp.
Definition at line 48 of file problem-with-counters.hpp.
Definition at line 49 of file problem-with-counters.hpp.
Definition at line 50 of file problem-with-counters.hpp.
Definition at line 51 of file problem-with-counters.hpp.
|
inline |
Definition at line 52 of file problem-with-counters.hpp.
|
inline |
Definition at line 53 of file problem-with-counters.hpp.
|
inline |
Definition at line 54 of file problem-with-counters.hpp.
|
inline |
Definition at line 55 of file problem-with-counters.hpp.
|
inline |
Definition at line 57 of file problem-with-counters.hpp.
|
inline |
Definition at line 58 of file problem-with-counters.hpp.
|
inline |
Definition at line 59 of file problem-with-counters.hpp.
|
inline |
Definition at line 60 of file problem-with-counters.hpp.
|
inline |
Definition at line 61 of file problem-with-counters.hpp.
|
inline |
Definition at line 62 of file problem-with-counters.hpp.
|
inline |
Definition at line 63 of file problem-with-counters.hpp.
|
inline |
Definition at line 64 of file problem-with-counters.hpp.
|
inline |
Definition at line 65 of file problem-with-counters.hpp.
|
inline |
Definition at line 66 of file problem-with-counters.hpp.
|
inline |
Definition at line 67 of file problem-with-counters.hpp.
|
inline |
Definition at line 68 of file problem-with-counters.hpp.
|
inline |
Definition at line 69 of file problem-with-counters.hpp.
|
inline |
Definition at line 70 of file problem-with-counters.hpp.
|
inline |
Definition at line 71 of file problem-with-counters.hpp.
|
inline |
Definition at line 72 of file problem-with-counters.hpp.
|
inline |
Definition at line 73 of file problem-with-counters.hpp.
|
inline |
Definition at line 74 of file problem-with-counters.hpp.
|
inline |
Definition at line 75 of file problem-with-counters.hpp.
|
inline |
Definition at line 76 of file problem-with-counters.hpp.
|
inline |
Definition at line 79 of file problem-with-counters.hpp.
|
inline |
Definition at line 80 of file problem-with-counters.hpp.
|
inline |
Reset all evaluation counters and timers to zero.
Affects all instances that share the same evaluations. If you only want to reset the counters of this instance, use decouple_evaluations first.
Definition at line 100 of file problem-with-counters.hpp.
|
inline |
Give this instance its own evaluation counters and timers, decoupling it from any other instances they might have previously been shared with.
The evaluation counters and timers are preserved (a copy is made).
Definition at line 104 of file problem-with-counters.hpp.
|
inlinestaticprivate |
Definition at line 108 of file problem-with-counters.hpp.
std::shared_ptr<EvalCounter> evaluations = std::make_shared<EvalCounter>() |
Definition at line 82 of file problem-with-counters.hpp.
Problem problem |
Definition at line 83 of file problem-with-counters.hpp.