Quasi-Newton method

From HandWiki
Revision as of 23:16, 6 March 2023 by Dennis Ross (talk | contribs) (fixing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Quasi-Newton methods are methods used to either find zeroes or local maxima and minima of functions, as an alternative to Newton's method. They can be used if the Jacobian or Hessian is unavailable or is too expensive to compute at every iteration. The "full" Newton's method requires the Jacobian in order to search for zeros, or the Hessian for finding extrema.

Search for zeros: root finding

Newton's method to find zeroes of a function [math]\displaystyle{ g }[/math] of multiple variables is given by [math]\displaystyle{ x_{n+1} = x_n -[J_g(x_n)]^{-1} g(x_n) }[/math], where [math]\displaystyle{ [J_g(x_n)]^{-1} }[/math] is the left inverse of the Jacobian matrix [math]\displaystyle{ J_g(x_n) }[/math] of [math]\displaystyle{ g }[/math] evaluated for [math]\displaystyle{ x_n }[/math].

Strictly speaking, any method that replaces the exact Jacobian [math]\displaystyle{ J_g(x_n) }[/math] with an approximation is a quasi-Newton method.[1] For instance, the chord method (where [math]\displaystyle{ J_g(x_n) }[/math] is replaced by [math]\displaystyle{ J_g(x_0) }[/math] for all iterations) is a simple example. The methods given below for optimization refer to an important subclass of quasi-Newton methods, secant methods.[2]

Using methods developed to find extrema in order to find zeroes is not always a good idea, as the majority of the methods used to find extrema require that the matrix that is used is symmetrical. While this holds in the context of the search for extrema, it rarely holds when searching for zeroes. Broyden's "good" and "bad" methods are two methods commonly used to find extrema that can also be applied to find zeroes. Other methods that can be used are the column-updating method, the inverse column-updating method, the quasi-Newton least squares method and the quasi-Newton inverse least squares method.

More recently quasi-Newton methods have been applied to find the solution of multiple coupled systems of equations (e.g. fluid–structure interaction problems or interaction problems in physics). They allow the solution to be found by solving each constituent system separately (which is simpler than the global system) in a cyclic, iterative fashion until the solution of the global system is found.[2][3]

Search for extrema: optimization

The search for a minimum or maximum of a scalar-valued function is nothing else than the search for the zeroes of the gradient of that function. Therefore, quasi-Newton methods can be readily applied to find extrema of a function. In other words, if [math]\displaystyle{ g }[/math] is the gradient of [math]\displaystyle{ f }[/math], then searching for the zeroes of the vector-valued function [math]\displaystyle{ g }[/math] corresponds to the search for the extrema of the scalar-valued function [math]\displaystyle{ f }[/math]; the Jacobian of [math]\displaystyle{ g }[/math] now becomes the Hessian of [math]\displaystyle{ f }[/math]. The main difference is that the Hessian matrix is a symmetric matrix, unlike the Jacobian when searching for zeroes. Most quasi-Newton methods used in optimization exploit this property.

In optimization, quasi-Newton methods (a special case of variable-metric methods) are algorithms for finding local maxima and minima of functions. Quasi-Newton methods are based on Newton's method to find the stationary point of a function, where the gradient is 0. Newton's method assumes that the function can be locally approximated as a quadratic in the region around the optimum, and uses the first and second derivatives to find the stationary point. In higher dimensions, Newton's method uses the gradient and the Hessian matrix of second derivatives of the function to be minimized.

In quasi-Newton methods the Hessian matrix does not need to be computed. The Hessian is updated by analyzing successive gradient vectors instead. Quasi-Newton methods are a generalization of the secant method to find the root of the first derivative for multidimensional problems. In multiple dimensions the secant equation is under-determined, and quasi-Newton methods differ in how they constrain the solution, typically by adding a simple low-rank update to the current estimate of the Hessian.

The first quasi-Newton algorithm was proposed by William C. Davidon, a physicist working at Argonne National Laboratory. He developed the first quasi-Newton algorithm in 1959: the DFP updating formula, which was later popularized by Fletcher and Powell in 1963, but is rarely used today. The most common quasi-Newton algorithms are currently the SR1 formula (for "symmetric rank-one"), the BHHH method, the widespread BFGS method (suggested independently by Broyden, Fletcher, Goldfarb, and Shanno, in 1970), and its low-memory extension L-BFGS. The Broyden's class is a linear combination of the DFP and BFGS methods.

The SR1 formula does not guarantee the update matrix to maintain positive-definiteness and can be used for indefinite problems. The Broyden's method does not require the update matrix to be symmetric and is used to find the root of a general system of equations (rather than the gradient) by updating the Jacobian (rather than the Hessian).

One of the chief advantages of quasi-Newton methods over Newton's method is that the Hessian matrix (or, in the case of quasi-Newton methods, its approximation) [math]\displaystyle{ B }[/math] does not need to be inverted. Newton's method, and its derivatives such as interior point methods, require the Hessian to be inverted, which is typically implemented by solving a system of linear equations and is often quite costly. In contrast, quasi-Newton methods usually generate an estimate of [math]\displaystyle{ B^{-1} }[/math] directly.

As in Newton's method, one uses a second-order approximation to find the minimum of a function [math]\displaystyle{ f(x) }[/math]. The Taylor series of [math]\displaystyle{ f(x) }[/math] around an iterate is

[math]\displaystyle{ f(x_k + \Delta x) \approx f(x_k) + \nabla f(x_k)^{\mathrm T} \,\Delta x + \frac{1}{2} \Delta x^{\mathrm T} B \,\Delta x, }[/math]

where ([math]\displaystyle{ \nabla f }[/math]) is the gradient, and [math]\displaystyle{ B }[/math] an approximation to the Hessian matrix.[4] The gradient of this approximation (with respect to [math]\displaystyle{ \Delta x }[/math]) is

[math]\displaystyle{ \nabla f(x_k + \Delta x) \approx \nabla f(x_k) + B \,\Delta x, }[/math]

and setting this gradient to zero (which is the goal of optimization) provides the Newton step:

[math]\displaystyle{ \Delta x = -B^{-1} \nabla f(x_k). }[/math]

The Hessian approximation [math]\displaystyle{ B }[/math] is chosen to satisfy

[math]\displaystyle{ \nabla f(x_k + \Delta x) = \nabla f(x_k) + B \,\Delta x, }[/math]

which is called the secant equation (the Taylor series of the gradient itself). In more than one dimension [math]\displaystyle{ B }[/math] is underdetermined. In one dimension, solving for [math]\displaystyle{ B }[/math] and applying the Newton's step with the updated value is equivalent to the secant method. The various quasi-Newton methods differ in their choice of the solution to the secant equation (in one dimension, all the variants are equivalent). Most methods (but with exceptions, such as Broyden's method) seek a symmetric solution ([math]\displaystyle{ B^T = B }[/math]); furthermore, the variants listed below can be motivated by finding an update [math]\displaystyle{ B_{k+1} }[/math] that is as close as possible to [math]\displaystyle{ B_{k} }[/math] in some norm; that is, [math]\displaystyle{ B_{k+1} = \operatorname{argmin}_B \|B - B_k\|_V }[/math], where [math]\displaystyle{ V }[/math] is some positive-definite matrix that defines the norm. An approximate initial value [math]\displaystyle{ B_0 = \beta I }[/math] is often sufficient to achieve rapid convergence, although there is no general strategy to choose [math]\displaystyle{ \beta }[/math].[5] Note that [math]\displaystyle{ B_0 }[/math] should be positive-definite. The unknown [math]\displaystyle{ x_k }[/math] is updated applying the Newton's step calculated using the current approximate Hessian matrix [math]\displaystyle{ B_{k} }[/math]:

  • [math]\displaystyle{ \Delta x_k = -\alpha_k B_k^{-1} \nabla f(x_k) }[/math], with [math]\displaystyle{ \alpha }[/math] chosen to satisfy the Wolfe conditions;
  • [math]\displaystyle{ x_{k+1} = x_k + \Delta x_k }[/math];
  • The gradient computed at the new point [math]\displaystyle{ \nabla f(x_{k+1}) }[/math], and
[math]\displaystyle{ y_k = \nabla f(x_{k+1}) - \nabla f(x_k) }[/math]

is used to update the approximate Hessian [math]\displaystyle{ B_{k+1} }[/math], or directly its inverse [math]\displaystyle{ H_{k+1} = B_{k+1}^{-1} }[/math] using the Sherman–Morrison formula.

  • A key property of the BFGS and DFP updates is that if [math]\displaystyle{ B_k }[/math] is positive-definite, and [math]\displaystyle{ \alpha_k }[/math] is chosen to satisfy the Wolfe conditions, then [math]\displaystyle{ B_{k+1} }[/math] is also positive-definite.

The most popular update formulas are:

Method [math]\displaystyle{ \displaystyle B_{k+1}= }[/math] [math]\displaystyle{ H_{k+1}=B_{k+1}^{-1}= }[/math]
BFGS [math]\displaystyle{ B_k + \frac{y_k y_k^{\mathrm T}}{y_k^{\mathrm T} \Delta x_k} - \frac{B_k \Delta x_k (B_k \Delta x_k)^{\mathrm T}}{\Delta x_k^{\mathrm T} B_k \, \Delta x_k} }[/math] [math]\displaystyle{ \left(I - \frac{\Delta x_k y_k^{\mathrm T}}{y_k^{\mathrm T} \Delta x_k}\right) H_k \left(I - \frac{y_k \Delta x_k^{\mathrm T}}{y_k^{\mathrm T} \Delta x_k}\right) + \frac{\Delta x_k \Delta x_k^{\mathrm T}}{y_k^{\mathrm T} \, \Delta x_k} }[/math]
Broyden [math]\displaystyle{ B_k + \frac{y_k - B_k \Delta x_k}{\Delta x_k^{\mathrm T} \, \Delta x_k} \, \Delta x_k^{\mathrm T} }[/math] [math]\displaystyle{ H_k + \frac{(\Delta x_k - H_k y_k) \Delta x_k^{\mathrm T} H_k}{\Delta x_k^{\mathrm T} H_k \, y_k} }[/math]
Broyden family [math]\displaystyle{ (1 - \varphi_k) B_{k+1}^\text{BFGS} + \varphi_k B_{k+1}^\text{DFP}, \quad \varphi \in [0, 1] }[/math]
DFP [math]\displaystyle{ \left(I - \frac{y_k \, \Delta x_k^{\mathrm T}}{y_k^{\mathrm T} \, \Delta x_k}\right) B_k \left(I - \frac{\Delta x_k y_k^{\mathrm T}}{y_k^{\mathrm T} \, \Delta x_k}\right) + \frac{y_k y_k^{\mathrm T}}{y_k^{\mathrm T} \, \Delta x_k} }[/math] [math]\displaystyle{ H_k + \frac{\Delta x_k \Delta x_k^{\mathrm T}}{\Delta x_k^{\mathrm T} \, y_k} - \frac{H_k y_k y_k^{\mathrm T} H_k}{y_k^{\mathrm T} H_k y_k} }[/math]
SR1 [math]\displaystyle{ B_k + \frac{(y_k - B_k \, \Delta x_k) (y_k - B_k \, \Delta x_k)^{\mathrm T}}{(y_k - B_k \, \Delta x_k)^{\mathrm T} \, \Delta x_k} }[/math] [math]\displaystyle{ H_k + \frac{(\Delta x_k - H_k y_k) (\Delta x_k - H_k y_k)^{\mathrm T}}{(\Delta x_k - H_k y_k)^{\mathrm T} y_k} }[/math]

Other methods are Pearson's method, McCormick's method, the Powell symmetric Broyden (PSB) method and Greenstadt's method.[2]

Relationship to matrix inversion

When [math]\displaystyle{ f }[/math] is a convex quadratic function with positive-definite Hessian [math]\displaystyle{ B }[/math], one would expect the matrices [math]\displaystyle{ H_k }[/math] generated by a quasi-Newton method to converge to the inverse Hessian [math]\displaystyle{ H = B^{-1} }[/math]. This is indeed the case for the class of quasi-Newton methods based on least-change updates.[6]

Notable implementations

Implementations of quasi-Newton methods are available in many programming languages.

Notable open source implementations include:

  • GNU Octave uses a form of BFGS in its fsolve function, with trust region extensions.
  • GNU Scientific Library implements the Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithm.
  • ALGLIB implements (L)BFGS in C++ and C#
  • R's optim general-purpose optimizer routine uses the BFGS method by using method="BFGS".[7]
  • Scipy.optimize has fmin_bfgs. In the SciPy extension to Python, the scipy.optimize.minimize function includes, among other methods, a BFGS implementation.[8]

Notable proprietary implementations include:

  • Mathematica includes quasi-Newton solvers.[9]
  • The NAG Library contains several routines[10] for minimizing or maximizing a function[11] which use quasi-Newton algorithms.
  • In MATLAB's Optimization Toolbox, the fminunc function uses (among other methods) the BFGS quasi-Newton method.[12] Many of the constrained methods of the Optimization toolbox use BFGS and the variant L-BFGS.[13]<

See also

References

  1. Broyden, C. G. (1972). "Quasi-Newton Methods". in Murray, W.. Numerical Methods for Unconstrained Optimization. London: Academic Press. pp. 87–106. ISBN 0-12-512250-0. 
  2. 2.0 2.1 2.2 Haelterman, Rob (2009). "Analytical study of the Least Squares Quasi-Newton method for interaction problems". PhD Thesis, Ghent University. https://lib.ugent.be/catalog/rug01:001333190. 
  3. Rob Haelterman, Dirk Van Eester, Daan Verleyen (2015). "Accelerating the solution of a physics model inside a tokamak using the (Inverse) Column Updating Method". Journal of Computational and Applied Mathematics 279: 133–144. doi:10.1016/j.cam.2014.11.005. 
  4. "Introduction to Taylor's theorem for multivariable functions - Math Insight". https://mathinsight.org/taylors_theorem_multivariable_introduction. Retrieved November 11, 2021. 
  5. Nocedal, Jorge; Wright, Stephen J. (2006). Numerical Optimization. New York: Springer. pp. 142. ISBN 0-387-98793-2. https://archive.org/details/numericaloptimiz00noce_990. 
  6. Robert Mansel Gower; Peter Richtarik (2015). "Randomized Quasi-Newton Updates are Linearly Convergent Matrix Inversion Algorithms". arXiv:1602.01768 [math.NA].
  7. "optim function - RDocumentation" (in en). https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/optim. 
  8. "Scipy.optimize.minimize — SciPy v1.7.1 Manual". http://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html. 
  9. "Unconstrained Optimization: Methods for Local Minimization—Wolfram Language Documentation". https://reference.wolfram.com/language/tutorial/UnconstrainedOptimizationMethodsForLocalMinimization.html.en. 
  10. The Numerical Algorithms Group. "Keyword Index: Quasi-Newton". NAG Library Manual, Mark 23. http://www.nag.co.uk/numeric/fl/nagdoc_fl23/html/INDEXES/KWIC/quasi-newton.html. 
  11. The Numerical Algorithms Group. "E04 – Minimizing or Maximizing a Function". NAG Library Manual, Mark 23. http://www.nag.co.uk/numeric/fl/nagdoc_fl23/pdf/E04/e04intro.pdf. 
  12. "Find minimum of unconstrained multivariable function - MATLAB fminunc". http://www.mathworks.com/help/toolbox/optim/ug/fminunc.html. 
  13. "Constrained Nonlinear Optimization Algorithms - MATLAB & Simulink". https://www.mathworks.com/help/optim/ug/constrained-nonlinear-optimization-algorithms.html. 

Further reading