alpaqa 1.0.0a17
Nonconvex constrained optimization
Loading...
Searching...
No Matches
lbfgs.hpp
Go to the documentation of this file.
1#pragma once
2
6
7namespace alpaqa {
8
9/// Parameters for the @ref LBFGSDirection class.
10/// @ingroup grp_Parameters
11template <Config Conf>
13 /// Instead of flushing the buffer when the step size changes, rescale the
14 /// buffer by a factor @f$ \gamma_k / \gamma_{k-1} @f$.
16};
17
18/// @ingroup grp_DirectionProviders
19template <Config Conf>
22
27
29
34
35 LBFGSDirection() = default;
36 LBFGSDirection(const Params &params)
37 : lbfgs(params.accelerator), direction_params(params.direction) {}
38 LBFGSDirection(const typename LBFGS::Params &params,
46
47 /// @see @ref PANOCDirection::initialize
55
56 /// @see @ref PANOCDirection::has_initial_direction
57 bool has_initial_direction() const { return false; }
58
59 /// @see @ref PANOCDirection::update
66
67 /// @see @ref PANOCDirection::apply
74
75 /// @see @ref PANOCDirection::changed_γ
82
83 /// @see @ref PANOCDirection::reset
84 void reset() { lbfgs.reset(); }
85
86 /// @see @ref PANOCDirection::get_name
87 std::string get_name() const {
88 return "LBFGSDirection<" + std::string(config_t::get_name()) + '>';
89 }
90 auto get_params() const {
91 return std::tie(lbfgs.get_params(), direction_params);
92 }
93
95};
96
97} // namespace alpaqa
LBFGSParams< config_t > Params
Definition lbfgs.hpp:121
const Params & get_params() const
Get the parameters.
Definition lbfgs.hpp:177
void resize(length_t n)
Re-allocate storage for a problem with a different size.
Definition lbfgs.tpp:213
void reset()
Throw away the approximation and all previous vectors s and y.
Definition lbfgs.tpp:207
bool apply(rvec q, real_t γ=-1) const
Apply the inverse Hessian approximation to the given vector q.
Definition lbfgs.tpp:74
void scale_y(real_t factor)
Scale the stored y vectors by the given factor.
Definition lbfgs.tpp:226
bool update(crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, Sign sign=Sign::Positive, bool forced=false)
Update the inverse Hessian approximation using the new vectors xₙₑₓₜ and pₙₑₓₜ.
Definition lbfgs.tpp:65
length_t get_n() const
[Required] Number of decision variables.
#define USING_ALPAQA_CONFIG(Conf)
Definition config.hpp:77
bool rescale_on_step_size_changes
Instead of flushing the buffer when the step size changes, rescale the buffer by a factor .
Definition lbfgs.hpp:15
Parameters for the LBFGSDirection class.
Definition lbfgs.hpp:12
typename Conf::real_t real_t
Definition config.hpp:86
constexpr const auto inf
Definition config.hpp:112
typename Conf::rvec rvec
Definition config.hpp:91
typename Conf::crvec crvec
Definition config.hpp:92
std::string get_name() const
Definition lbfgs.hpp:87
void changed_γ(real_t γₖ, real_t old_γₖ)
Definition lbfgs.hpp:76
DirectionParams direction_params
Definition lbfgs.hpp:94
DirectionParams direction
Definition lbfgs.hpp:32
bool update(real_t γₖ, real_t γₙₑₓₜ, crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, crvec grad_ψxₖ, crvec grad_ψxₙₑₓₜ)
Definition lbfgs.hpp:60
auto get_params() const
Definition lbfgs.hpp:90
LBFGSDirection(const LBFGS &lbfgs, const DirectionParams &directionparams={})
Definition lbfgs.hpp:41
typename LBFGS::Params AcceleratorParams
Definition lbfgs.hpp:25
LBFGSDirection(LBFGS &&lbfgs, const DirectionParams &directionparams={})
Definition lbfgs.hpp:44
void initialize(const Problem &problem, crvec y, crvec Σ, real_t γ_0, crvec x_0, crvec x̂_0, crvec p_0, crvec grad_ψx_0)
Definition lbfgs.hpp:48
bool apply(real_t γₖ, crvec xₖ, crvec x̂ₖ, crvec pₖ, crvec grad_ψxₖ, rvec qₖ) const
Definition lbfgs.hpp:68
bool has_initial_direction() const
Definition lbfgs.hpp:57
AcceleratorParams accelerator
Definition lbfgs.hpp:31
LBFGSDirection(const Params &params)
Definition lbfgs.hpp:36
LBFGSDirection(const typename LBFGS::Params &params, const DirectionParams &directionparams={})
Definition lbfgs.hpp:38