51 Sign sign,
bool forced =
false);
59 template <
class Vec,
class IndexVec>
71 std::string
get_name()
const {
return "LBFGS"; }
76 size_t n()
const {
return sto.rows() - 1; }
80 size_t succ(
size_t i)
const {
return i + 1 <
history() ? i + 1 : 0; }
82 auto s(
size_t i) {
return sto.col(2 * i).topRows(
n()); }
83 auto s(
size_t i)
const {
return sto.col(2 * i).topRows(
n()); }
84 auto y(
size_t i) {
return sto.col(2 * i + 1).topRows(
n()); }
85 auto y(
size_t i)
const {
return sto.col(2 * i + 1).topRows(
n()); }
87 const real_t &
ρ(
size_t i)
const {
return sto.coeff(
n(), 2 * i); }
89 const real_t &
α(
size_t i)
const {
return sto.coeff(
n(), 2 * i + 1); }
92 using storage_t = Eigen::Matrix<real_t, Eigen::Dynamic, Eigen::Dynamic>;
114 std::string get_name()
const;
Limited memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) algorithm.
std::string get_name() const
size_t succ(size_t i) const
Get the next index in the circular buffer of previous s and y vectors.
bool apply(Vec &&q, real_t γ)
Apply the inverse Hessian approximation to the given vector q.
bool update(crvec xₖ, crvec xₖ₊₁, crvec pₖ, crvec pₖ₊₁, Sign sign, bool forced=false)
Update the inverse Hessian approximation using the new vectors xₖ₊₁ and pₖ₊₁.
void resize(size_t n)
Re-allocate storage for a problem with a different size.
size_t history() const
Get the number of previous vectors s and y stored in the buffer.
Eigen::Matrix< real_t, Eigen::Dynamic, Eigen::Dynamic > storage_t
const Params & get_params() const
static bool update_valid(LBFGSParams params, real_t yᵀs, real_t sᵀs, real_t pᵀp)
Check if the new vectors s and y allow for a valid BFGS update that preserves the positive definitene...
size_t n() const
Get the size of the s and y vectors in the buffer.
const real_t & α(size_t i) const
void reset()
Throw away the approximation and all previous vectors s and y.
Sign
The sign of the vectors passed to the LBFGS::update method.
void scale_y(real_t factor)
Scale the stored y vectors by the given factor.
const real_t & ρ(size_t i) const
LBFGS(Params params, size_t n)
Eigen::Ref< const vec > crvec
Default type for immutable references to vectors.
bool rescale_when_γ_changes
unsigned memory
Length of the history to keep.
struct alpaqa::LBFGSParams::@0 cbfgs
Parameters in the cautious BFGS update condition.
double real_t
Default floating point type.
Eigen::Ref< vec > rvec
Default type for mutable references to vectors.
Parameters for the LBFGS and SpecializedLBFGS classes.
PANOCDirection(LBFGS &&lbfgs)
PANOCDirection(const LBFGSParams ¶ms)
PANOCDirection(const LBFGS &lbfgs)
static bool update(DirectionProviderT &dp, crvec xₖ, crvec xₖ₊₁, crvec pₖ, crvec pₖ₊₁, crvec gradₖ₊₁, const Box &C, real_t γₖ₊₁)=delete
static bool apply(DirectionProviderT &dp, crvec xₖ, crvec x̂ₖ, crvec pₖ, real_t γ, rvec qₖ)=delete
Apply the direction estimation in the current point.
static void changed_γ(DirectionProviderT &dp, real_t γₖ, real_t old_γₖ)=delete
static void initialize(DirectionProviderT &dp, crvec x₀, crvec x̂₀, crvec p₀, crvec grad₀)=delete