15 typename ALMSolver::Params alm_param;
16 alm_param.max_iter = 200;
17 alm_param.tolerance = 1e-8;
18 alm_param.dual_tolerance = 1e-8;
19 alm_param.print_interval = 1;
20 alm_param.print_precision = 1;
22 return ALMSolver{alm_param, std::forward<InnerSolver>(inner_solver)};
30 typename InnerSolver::Params solver_param;
31 solver_param.max_iter = 50'000;
32 solver_param.print_interval = 0;
36 if constexpr (
requires {
typename InnerSolver::Direction; }) {
38 using Direction =
typename InnerSolver::Direction;
39 typename Direction::DirectionParams dir_param;
40 typename Direction::AcceleratorParams accel_param;
46 .accelerator = accel_param,
47 .direction = dir_param,
51 return InnerSolver{solver_param};
57 std::ostream &os,
unsigned N_exp) {
67 auto stats = solver(problem.
problem, x, y, Σ);
70 auto avg_duration = stats.elapsed_time;
71 os.setstate(std::ios_base::badbit);
72 for (
unsigned i = 0; i < N_exp; ++i) {
75 auto s = solver(problem.
problem, x, y);
78 os <<
"\rInterrupted after " << i <<
" runs" << std::endl;
82 avg_duration += s.elapsed_time;
85 avg_duration /= (N_exp + 1);
87 solver.os = &std::cout;
93 real_t final_γ = 0, final_h = 0;
94 if constexpr (
requires { stats.inner.final_γ; })
95 final_γ = stats.inner.final_γ;
96 if constexpr (
requires { stats.inner.final_h; })
97 final_h = stats.inner.final_h;
99 if constexpr (
requires { stats.inner.linesearch_failures; })
101 "linesearch_failures",
102 static_cast<index_t
>(stats.inner.linesearch_failures));
103 if constexpr (
requires { stats.inner.linesearch_backtracks; })
105 "linesearch_backtracks",
106 static_cast<index_t
>(stats.inner.linesearch_backtracks));
107 if constexpr (
requires { stats.inner.stepsize_backtracks; })
109 "stepsize_backtracks",
110 static_cast<index_t
>(stats.inner.stepsize_backtracks));
111 if constexpr (
requires { stats.inner.lbfgs_failures; })
112 extra.emplace_back(
"lbfgs_failures",
113 static_cast<index_t
>(stats.inner.lbfgs_failures));
114 if constexpr (
requires { stats.inner.lbfgs_rejected; })
115 extra.emplace_back(
"lbfgs_rejected",
116 static_cast<index_t
>(stats.inner.lbfgs_rejected));
117 if constexpr (
requires { stats.inner.accelerated_step_rejected; })
119 "accelerated_step_rejected",
120 static_cast<index_t
>(stats.inner.accelerated_step_rejected));
121 if constexpr (
requires { stats.inner.direction_failures; })
123 "direction_failures",
124 static_cast<index_t
>(stats.inner.direction_failures));
125 if constexpr (
requires { stats.inner.direction_update_rejected; })
127 "direction_update_rejected",
128 static_cast<index_t
>(stats.inner.direction_update_rejected));
133 .duration = avg_duration,
134 .solver = solver.get_name(),
139 .Σ = stats.norm_penalty,
142 .multipliers_bounds = vec(0),
144 .outer_iter =
static_cast<index_t
>(stats.outer_iterations),
145 .inner_iter =
static_cast<index_t
>(stats.inner.iterations),
146 .extra = std::move(extra),