16using InnerLBFGSBSolver = lbfgsb::LBFGSBSolver;
18auto make_inner_lbfgsb_solver(Options &opts) {
20 InnerLBFGSBSolver::Params solver_param;
21 solver_param.max_iter = 50'000;
22 solver_param.print_interval = 0;
25 return InnerLBFGSBSolver{solver_param};
28template <
class LoadedProblem>
31 if (!direction.empty())
32 throw std::invalid_argument(
33 "L-BFGS-B solver does not support any directions");
35 std::shared_ptr<collector_t> collector;
36 auto inner_solver = make_inner_lbfgsb_solver(opts);
37 bool extra_stats =
false;
40 collector = std::make_shared<collector_t>();
41 inner_solver.set_progress_callback(
42 [collector](
const auto &progress_info) {
43 collector->update_iter(progress_info);
49 auto run = [solver{std::move(solver)},
50 N_exp](LoadedProblem &problem,
55 return std::make_shared<AlpaqaSolverWrapperStats<config_t>>(
56 std::move(run), std::move(collector));
63 static constexpr bool valid_config =
64 std::is_same_v<LoadedProblem::config_t, InnerLBFGSBSolver::config_t>;
65 if constexpr (valid_config)
66 return make_lbfgsb_driver_impl<LoadedProblem>(direction, opts);
68 throw std::invalid_argument(
69 "L-BFGS-B solver only supports double precision");
81 throw std::invalid_argument(
82 "This version of alpaqa was compiled without L-BFGS-B support.");
Augmented Lagrangian Method solver.
SharedSolverWrapper make_lbfgsb_driver(std::string_view, alpaqa::Options &)
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)
@ ProjGradUnitNorm
∞-norm of the projected gradient with unit step size:
void set_params(T &t, std::string_view prefix, Options &opts)
auto attach_cancellation(Solver &solver)
Attach SIGINT and SIGTERM handlers to stop the given solver.