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