alpaqa 1.0.0a15
Nonconvex constrained optimization
Loading...
Searching...
No Matches
fista-driver.cpp
Go to the documentation of this file.
3
4#include "alm-driver.hpp"
5#include "cancel.hpp"
6#include "fista-driver.hpp"
7#include "solver-driver.hpp"
8
9namespace {
10
12
14 USING_ALPAQA_CONFIG(FISTASolver::config_t);
15 // Settings for the solver
16 FISTASolver::Params solver_param;
17 solver_param.max_iter = 50'000;
18 solver_param.print_interval = 0;
20 set_params(solver_param, "solver", opts);
21 return FISTASolver{solver_param};
22}
23
24template <class LoadedProblem>
26 Options &opts) {
27 if (!direction.empty())
28 throw std::invalid_argument(
29 "FISTA solver does not support any directions");
30 auto inner_solver = make_inner_fista_solver(opts);
31 auto solver = make_alm_solver(std::move(inner_solver), opts);
32 unsigned N_exp = 0;
33 set_params(N_exp, "num_exp", opts);
34 return std::make_shared<SolverWrapper>(
35 [solver{std::move(solver)}, N_exp](
36 LoadedProblem &problem, std::ostream &os) mutable -> SolverResults {
37 auto cancel = alpaqa::attach_cancellation(solver);
38 return run_alm_solver(problem, solver, os, N_exp);
39 });
40}
41
42} // namespace
43
44SharedSolverWrapper make_fista_driver(std::string_view direction,
45 Options &opts) {
46 return make_fista_driver_impl<LoadedProblem>(direction, opts);
47}
48
SolverResults run_alm_solver(LoadedProblem &problem, Solver &solver, std::ostream &os, unsigned N_exp)
auto make_alm_solver(InnerSolver &&inner_solver, Options &opts)
Augmented Lagrangian Method solver.
Definition alm.hpp:69
FISTA solver for ALM.
Definition fista.hpp:106
#define USING_ALPAQA_CONFIG(Conf)
Definition config.hpp:56
SharedSolverWrapper make_fista_driver(std::string_view direction, Options &opts)
unsigned print_interval
When to print progress.
Definition fista.hpp:45
unsigned max_iter
Maximum number of inner FISTA iterations.
Definition fista.hpp:31
PANOCStopCrit stop_crit
What stopping criterion to use.
Definition fista.hpp:39
@ FPRNorm
∞-norm of fixed point residual:
auto attach_cancellation(Solver &solver)
Attach SIGINT and SIGTERM handlers to stop the given solver.
Definition cancel.hpp:21
SharedSolverWrapper make_fista_driver_impl(std::string_view direction, Options &opts)
auto make_inner_fista_solver(Options &opts)
decltype(auto) set_params(T &t, std::string_view prefix, Options &opts)
Definition options.hpp:86
std::shared_ptr< SolverWrapper > SharedSolverWrapper