alpaqa pantr
Nonconvex constrained optimization
Loading...
Searching...
No Matches
lbfgsb-driver.cpp
Go to the documentation of this file.
3
4#include "alm-driver.hpp"
5#include "cancel.hpp"
6#include "lbfgsb-driver.hpp"
7#include "solver-driver.hpp"
8#include "util.hpp"
9
10namespace {
11
12using InnerLBFGSBSolver = alpaqa::lbfgsb::LBFGSBSolver;
13
14auto make_inner_lbfgsb_solver(Options &opts) {
15 // Settings for the solver
16 InnerLBFGSBSolver::Params solver_param;
17 solver_param.max_iter = 50'000;
18 solver_param.print_interval = 0;
19 solver_param.stop_crit = alpaqa::PANOCStopCrit::ProjGradUnitNorm;
20 set_params(solver_param, "solver", opts);
21 return InnerLBFGSBSolver{solver_param};
22}
23
24} // namespace
25
26solver_func_t make_lbfgsb_driver(std::string_view direction, Options &opts) {
28 if (!direction.empty())
29 throw std::invalid_argument(
30 "L-BFGS-B solver does not support any directions");
31 auto inner_solver = make_inner_lbfgsb_solver(opts);
32 auto solver = make_alm_solver(std::move(inner_solver), opts);
33 unsigned N_exp = 0;
34 set_params(N_exp, "num_exp", opts);
35 return [solver{std::move(solver)},
36 N_exp](LoadedProblem &problem,
37 std::ostream &os) mutable -> SolverResults {
38 static std::atomic<decltype(solver) *> solver_to_stop;
39 auto cancel = attach_cancellation<solver_to_stop>(solver);
40 return run_alm_solver(problem, solver, os, N_exp);
41 };
42}
43
SolverResults run_alm_solver(LoadedProblem &problem, Solver &solver, std::ostream &os, unsigned N_exp)
Definition: alm-driver.hpp:56
auto make_alm_solver(InnerSolver &&inner_solver, Options &opts)
Definition: alm-driver.hpp:12
Augmented Lagrangian Method solver.
Definition: alm.hpp:96
#define USING_ALPAQA_CONFIG(Conf)
Definition: config.hpp:42
solver_func_t make_lbfgsb_driver(std::string_view direction, Options &opts)
@ ProjGradUnitNorm
∞-norm of the projected gradient with unit step size:
decltype(auto) set_params(T &t, std::string_view prefix, Options &opts)
Definition: options.hpp:29
std::function< solver_free_func_t > solver_func_t