alpaqa 1.0.0a12
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.
10template <Config Conf>
14
15/// @ingroup grp_DirectionProviders
16template <Config Conf>
19
24
26
31
32 LBFGSDirection() = default;
33 LBFGSDirection(const Params &params)
34 : lbfgs(params.accelerator), direction_params(params.direction) {}
35 LBFGSDirection(const typename LBFGS::Params &params,
43
44 /// @see @ref PANOCDirection::initialize
52
53 /// @see @ref PANOCDirection::has_initial_direction
54 bool has_initial_direction() const { return false; }
55
56 /// @see @ref PANOCDirection::update
63
64 /// @see @ref PANOCDirection::apply
71
72 /// @see @ref PANOCDirection::changed_γ
79
80 /// @see @ref PANOCDirection::reset
81 void reset() { lbfgs.reset(); }
82
83 /// @see @ref PANOCDirection::get_name
84 std::string get_name() const {
85 return "LBFGSDirection<" + std::string(config_t::get_name()) + '>';
86 }
87 auto get_params() const {
88 return std::tie(lbfgs.get_params(), direction_params);
89 }
90
92};
93
94} // namespace alpaqa
LBFGSParams< config_t > Params
Definition lbfgs.hpp:112
const Params & get_params() const
Get the parameters.
Definition lbfgs.hpp:168
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:56
typename Conf::real_t real_t
Definition config.hpp:65
constexpr const auto inf
Definition config.hpp:85
typename Conf::rvec rvec
Definition config.hpp:69
typename Conf::crvec crvec
Definition config.hpp:70
Parameters for the LBFGSDirection class.
Definition lbfgs.hpp:11
std::string get_name() const
Definition lbfgs.hpp:84
void changed_γ(real_t γₖ, real_t old_γₖ)
Definition lbfgs.hpp:73
DirectionParams direction_params
Definition lbfgs.hpp:91
DirectionParams direction
Definition lbfgs.hpp:29
bool update(real_t γₖ, real_t γₙₑₓₜ, crvec xₖ, crvec xₙₑₓₜ, crvec pₖ, crvec pₙₑₓₜ, crvec grad_ψxₖ, crvec grad_ψxₙₑₓₜ)
Definition lbfgs.hpp:57
auto get_params() const
Definition lbfgs.hpp:87
LBFGSDirection(const LBFGS &lbfgs, const DirectionParams &directionparams={})
Definition lbfgs.hpp:38
typename LBFGS::Params AcceleratorParams
Definition lbfgs.hpp:22
LBFGSDirection(LBFGS &&lbfgs, const DirectionParams &directionparams={})
Definition lbfgs.hpp:41
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:45
bool apply(real_t γₖ, crvec xₖ, crvec x̂ₖ, crvec pₖ, crvec grad_ψxₖ, rvec qₖ) const
Definition lbfgs.hpp:65
bool has_initial_direction() const
Definition lbfgs.hpp:54
AcceleratorParams accelerator
Definition lbfgs.hpp:28
LBFGSDirection(const Params &params)
Definition lbfgs.hpp:33
LBFGSDirection(const typename LBFGS::Params &params, const DirectionParams &directionparams={})
Definition lbfgs.hpp:35