18using std::chrono::duration_cast;
19using std::chrono::microseconds;
23template <
template <
class>
class LineSearchT = LBFGSpp::LineSearchBacktracking>
26 using Params = LBFGSpp::LBFGSParam<real_t>;
46 bool always_overwrite_results,
52 auto start_time = std::chrono::steady_clock::now();
67 }
catch (std::runtime_error &) {
69 }
catch (std::logic_error &) {
74 auto time_elapsed = std::chrono::steady_clock::now() - start_time;
75 s.
elapsed_time = duration_cast<microseconds>(time_elapsed);
81 if (conv || interrupted || always_overwrite_results) {
91 std::string
get_name()
const {
return "LBFGSSolver<?>"; }
112template <
template <
class>
class LineSearchT = LBFGSpp::LineSearchBacktracking>
115 using Params = LBFGSpp::LBFGSBParam<real_t>;
124 bool always_overwrite_results,
130 auto start_time = std::chrono::steady_clock::now();
147 }
catch (std::runtime_error &) {
149 }
catch (std::logic_error &) {
154 auto time_elapsed = std::chrono::steady_clock::now() - start_time;
155 s.
elapsed_time = duration_cast<microseconds>(time_elapsed);
161 if (conv || interrupted || always_overwrite_results) {
171 std::string
get_name()
const {
return "LBFGSBSolver<?>"; }
183template <
class InnerSolverStats>
189 unsigned iterations = 0;
bool stop_requested() const
Box-constrained LBFGS solver for ALM.
std::string get_name() const
LBFGSBSolver(Params params)
AtomicStopSignal stop_signal
Stats operator()(const Problem &problem, crvec Σ, real_t ε, bool always_overwrite_results, rvec x, rvec y, rvec err_z)
const Params & get_params() const
LBFGSpp::LBFGSBParam< real_t > Params
LineSearchT< real_t > LineSearch
Unconstrained LBFGS solver for ALM.
std::string get_name() const
AtomicStopSignal stop_signal
Stats operator()(const Problem &problem, crvec Σ, real_t ε, bool always_overwrite_results, rvec x, rvec y, rvec err_z)
LBFGSSolver(Params params)
const Params & get_params() const
LBFGSpp::LBFGSParam< real_t > Params
std::chrono::microseconds elapsed_time
unsigned linesearch_failures
LineSearchT< real_t > LineSearch
real_t calc_ψ_ŷ(const Problem &p, crvec x, crvec y, crvec Σ, rvec ŷ)
Calculate both ψ(x) and the vector ŷ that can later be used to compute ∇ψ.
real_t calc_ψ_grad_ψ(const Problem &p, crvec x, crvec y, crvec Σ, rvec grad_ψ, rvec work_n, rvec work_m)
Calculate both ψ(x) and its gradient ∇ψ(x).
void calc_err_z(const Problem &p, crvec x̂, crvec y, crvec Σ, rvec err_z)
Calculate the error between ẑ and g(x).
InnerStatsAccumulator< PolymorphicInnerSolverWrapper::Stats > & operator+=(InnerStatsAccumulator< PolymorphicInnerSolverWrapper::Stats > &acc, const PolymorphicInnerSolverWrapper::Stats &s)
Eigen::Ref< const vec > crvec
Default type for immutable references to vectors.
SolverStatus
Exit status of a numerical solver such as ALM or PANOC.
@ Interrupted
Solver was interrupted by the user.
@ MaxIter
Maximum number of iterations exceeded.
@ Converged
Converged and reached given tolerance.
@ NotFinite
Intermediate results were infinite or not-a-number.
realvec vec
Default type for vectors.
std::chrono::microseconds elapsed_time
double real_t
Default floating point type.
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Problem description for minimization problems.