alpaqa 0.0.1
Nonconvex constrained optimization
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members

#include <alpaqa/inner/directions/decl/lbfgs.hpp>

Detailed Description

Limited memory Broyden–Fletcher–Goldfarb–Shanno (L-BFGS) algorithm.

Definition at line 29 of file decl/lbfgs.hpp.

+ Collaboration diagram for LBFGS:

Public Types

enum class  Sign { Positive , Negative }
 The sign of the vectors \( p \) passed to the LBFGS::update method. More...
 
using Params = LBFGSParams
 

Public Member Functions

 LBFGS (Params params)
 
 LBFGS (Params params, size_t n)
 
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ₖ₊₁. More...
 
template<class Vec >
bool apply (Vec &&q, real_t γ)
 Apply the inverse Hessian approximation to the given vector q. More...
 
template<class Vec , class IndexVec >
bool apply (Vec &&q, real_t γ, const IndexVec &J)
 Apply the inverse Hessian approximation to the given vector q, applying only the columns and rows of the Hessian in the index set J. More...
 
void reset ()
 Throw away the approximation and all previous vectors s and y. More...
 
void resize (size_t n)
 Re-allocate storage for a problem with a different size. More...
 
void scale_y (real_t factor)
 Scale the stored y vectors by the given factor. More...
 
std::string get_name () const
 
const Paramsget_params () const
 
size_t n () const
 Get the size of the s and y vectors in the buffer. More...
 
size_t history () const
 Get the number of previous vectors s and y stored in the buffer. More...
 
size_t succ (size_t i) const
 Get the next index in the circular buffer of previous s and y vectors. More...
 
auto s (size_t i)
 
auto s (size_t i) const
 
auto y (size_t i)
 
auto y (size_t i) const
 
real_tρ (size_t i)
 
const real_tρ (size_t i) const
 
real_tα (size_t i)
 
const real_tα (size_t i) const
 

Static Public Member Functions

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 definiteness of the Hessian approximation. More...
 

Private Types

using storage_t = Eigen::Matrix< real_t, Eigen::Dynamic, Eigen::Dynamic >
 

Private Attributes

storage_t sto
 
size_t idx = 0
 
bool full = false
 
Params params
 

Member Typedef Documentation

◆ Params

Definition at line 31 of file decl/lbfgs.hpp.

◆ storage_t

using storage_t = Eigen::Matrix<real_t, Eigen::Dynamic, Eigen::Dynamic>
private

Definition at line 92 of file decl/lbfgs.hpp.

Member Enumeration Documentation

◆ Sign

enum class Sign
strong

The sign of the vectors \( p \) passed to the LBFGS::update method.

Enumerator
Positive 

\( p \sim \nabla \psi(x) \)

Negative 

\( p \sim -\nabla \psi(x) \)

Definition at line 35 of file decl/lbfgs.hpp.

Constructor & Destructor Documentation

◆ LBFGS() [1/2]

LBFGS ( Params  params)
inline

Definition at line 40 of file decl/lbfgs.hpp.

◆ LBFGS() [2/2]

LBFGS ( Params  params,
size_t  n 
)
inline

Definition at line 41 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ update_valid()

bool update_valid ( LBFGSParams  params,
real_t  yᵀs,
real_t  sᵀs,
real_t  pᵀp 
)
inlinestatic

Check if the new vectors s and y allow for a valid BFGS update that preserves the positive definiteness of the Hessian approximation.

Definition at line 9 of file lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

bool update ( crvec  xₖ,
crvec  xₖ₊₁,
crvec  pₖ,
crvec  pₖ₊₁,
Sign  sign,
bool  forced = false 
)
inline

Update the inverse Hessian approximation using the new vectors xₖ₊₁ and pₖ₊₁.

Definition at line 33 of file lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply() [1/2]

bool apply ( Vec &&  q,
real_t  γ 
)

Apply the inverse Hessian approximation to the given vector q.

Definition at line 59 of file lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ apply() [2/2]

bool apply ( Vec &&  q,
real_t  γ,
const IndexVec &  J 
)

Apply the inverse Hessian approximation to the given vector q, applying only the columns and rows of the Hessian in the index set J.

Definition at line 99 of file lbfgs.hpp.

+ Here is the call graph for this function:

◆ reset()

void reset ( )
inline

Throw away the approximation and all previous vectors s and y.

Definition at line 183 of file lbfgs.hpp.

+ Here is the caller graph for this function:

◆ resize()

void resize ( size_t  n)
inline

Re-allocate storage for a problem with a different size.

Causes a reset.

Definition at line 188 of file lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scale_y()

void scale_y ( real_t  factor)
inline

Scale the stored y vectors by the given factor.

Definition at line 195 of file lbfgs.hpp.

+ Here is the call graph for this function:

◆ get_name()

std::string get_name ( ) const
inline

Definition at line 71 of file decl/lbfgs.hpp.

◆ get_params()

const Params & get_params ( ) const
inline

Definition at line 73 of file decl/lbfgs.hpp.

◆ n()

size_t n ( ) const
inline

Get the size of the s and y vectors in the buffer.

Definition at line 76 of file decl/lbfgs.hpp.

+ Here is the caller graph for this function:

◆ history()

size_t history ( ) const
inline

Get the number of previous vectors s and y stored in the buffer.

Definition at line 78 of file decl/lbfgs.hpp.

+ Here is the caller graph for this function:

◆ succ()

size_t succ ( size_t  i) const
inline

Get the next index in the circular buffer of previous s and y vectors.

Definition at line 80 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ s() [1/2]

auto s ( size_t  i)
inline

Definition at line 82 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ s() [2/2]

auto s ( size_t  i) const
inline

Definition at line 83 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:

◆ y() [1/2]

auto y ( size_t  i)
inline

Definition at line 84 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ y() [2/2]

auto y ( size_t  i) const
inline

Definition at line 85 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ρ() [1/2]

real_t & ρ ( size_t  i)
inline

Definition at line 86 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ρ() [2/2]

const real_t & ρ ( size_t  i) const
inline

Definition at line 87 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:

◆ α() [1/2]

real_t & α ( size_t  i)
inline

Definition at line 88 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ α() [2/2]

const real_t & α ( size_t  i) const
inline

Definition at line 89 of file decl/lbfgs.hpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ sto

storage_t sto
private

Definition at line 94 of file decl/lbfgs.hpp.

◆ idx

size_t idx = 0
private

Definition at line 95 of file decl/lbfgs.hpp.

◆ full

bool full = false
private

Definition at line 96 of file decl/lbfgs.hpp.

◆ params

Params params
private

Definition at line 97 of file decl/lbfgs.hpp.


The documentation for this class was generated from the following files: