Quasi-Newton methods
Author: Jianmin Su (ChemE 6800 Fall 2020)
Steward: Allen Yang, Fengqi You
Quasi-Newton Methods are a kind of methods used to solve nonlinear optimization problems. They are based on Newton's method yet can be an alternative to Newton's method when the objective function is not twice-differentiable, which means the Hessian matrix is unavailable, or it is too expensive to calculate the Hessian matrix and its inverse.
Introduction
The first quasi-Newton algorithm was developed by W.C. Davidon in the mid1950s and it turned out to be a milestone in nonlinear optimization problems. He was trying to solve a long optimization calculation but he failed to get the result with the original method due to the low performances of computers at that time, thus he managed to build the quasi-Newton method to solve it. Later then, Fletcher and Powell proved that the new algorithm was more efficient and more reliable than the other existing methods.
During the following years, numerous variants were proposed, include Broyden's method (1965), the SR1 formula (Davidon 1959, Broyden 1967), the DFP method (Davidon, 1959; Fletcher and Powell, 1963), and the BFGS method (Broyden, 1969; Fletcher, 1970; Goldfarb, 1970; Shanno, 1970).
In optimization problems, Newton's method uses first and second derivatives, gradient and the Hessian in multivariate scenarios, to find the optimal point, it is applied to a twice-differentiable function $ f $ to find the roots of the first derivative (solutions to $ f'(x)=0 $), also known as the stationary points of $ f $.
The iteration of Newton's method is usually written as: $ x_{k+1}=x_k-H^{-1}\cdot\bigtriangledown f(x_k) $, where $ k $ is the iteration number, $ H $ is the Hessian matrix and $ H=[\bigtriangledown ^2 f(x_k)] $
Iteraton would stop when it satisfies the convergence criteria like $ {df \over dx}=0, ||\bigtriangledown f(x)||<\epsilon \text{ or } |f(x_{k+1})-f(x_k)|<\epsilon $
Though we can solve an optimization problem quickly with Newton's method, it has two obvious disadvantages:
- The objective function must be twice-differentiable and the Hessian matrix must be positive definite.
- The calculation is costly because it requires to compute the Jacobian matrix, Hessian matrix, and its inverse, which is time-consuming when dealing with a large-scale optimization problem.
However, we can use Quasi-Newton methods to avoid these two disadvantages.·
Quasi-Newton methods are similar to Newton's method but with one key idea that is different, they don't calculate the Hessian matrix, they introduce a matrix $ B $ to estimate the Hessian matrix instead so that they can avoid the time-consuming calculations of Hessian matrix and its inverse. And there are many variants of quasi-Newton methods that simply depend on the exact methods they use in the estimation of the Hessian matrix.
Theory and Algorithm
To illustrate the basic idea behind quasi-Newton methods, we start with building a quadratic model of the objective function at the current iterate $ x_k $:
$ m_k(p)=f_k+\bigtriangledown f_k^Tp+\frac{1}{2}p^TB_kp $ (1.1),
where $ B_k $ is an $ n\times n $ symmetric positive definite matrix that will be updated at every iteration.
The minimizer of this convex quadratic model is:
$ p_k=-B_k^{-1}\bigtriangledown f_k $ (1.2),
which is also used as the search direction.
Then the new iterate could be written as: $ x_{k+1}=x_{k}+\alpha _kp_k $ (1.3),
where $ \alpha _k $ is the step length that should satisfy the Wolfe conditions. The iteration is similar to Newton's method, but we use the approximate Hessian $ B_{k} $ instead of the true Hessian.
To maintain the curve information we got from the previous iteration in $ B_{k+1} $, we generate a new iterate $ x_{k+1} $ and new quadratic modelto in the form of:
$ m_{k+1}(p)=f_{k+1}+\bigtriangledown f_{k+1}^Tp+\frac{1}{2}p^TB_{k+1}p $ (1.4).
To construct the relationship between 1.1 and 1.4, we require that in 1.1 at $ p=0 $ the function value and gradient match $ f_k $ and $ \bigtriangledown f_k $, and the gradient of $ m_{k+1} $should match the gradient of the objective function at the latest two iterates $ x_k $and $ x_{k+1} $, then we can get:
$ \bigtriangledown m_{k+1}(-\alpha _kp_k)=\bigtriangledown f_{k+1}-\alpha _kB_{k+1}p_k=\bigtriangledown f_k $ (1.5)
and with some arrangements:
$ B_{k+1}\alpha _k p_k=\bigtriangledown f_{k+1}-\bigtriangledown f_k $ (1.6)
Define:
$ s_k=x_{k+1}-x_k $, $ y_k=\bigtriangledown f_{k+1}-\bigtriangledown f_k $ (1.7)
So that (1.6) becomes: $ B_{k+1}s_k=y_k $ (1.8), which is the secant equation.
To make sure $ B_{k+1} $ is still a symmetric positive definite matrix, we need $ s_k^Ts_k>0 $ (1.9).
To further preserve properties of $ B_{k+1} $ and determine $ B_{k+1} $ uniquely, we assume that among all symmetric matrices satisfying secant equation, $ B_{k+1} $ is closest to the current matrix $ B_k $, which leads to a minimization problem:
$ B_{k+1}=\underset{B}{min}||B-B_k|| $ (1.10) s.t. $ B=B^T $, $ Bs_k=y_k $,
where $ s_k $ and $ y_k $ satisfy (1.9) and $ B_k $ is symmetric and positive definite.
Different matrix norms applied in (1.10) results in different quasi-Newton methods. The weighted Frobenius norm can help us get an easy solution to the minimization problem: $ ||A||_W=||W^\frac{1}{2}AW^\frac{1}{2}|| _F $ (1.11).
The weighted matrix $ W $ can be any matrix that satisfies the relation $ Wy_k=s_k $., where $ W $ can be assumed as $ W=G_k^{-1} $ , $ G_k $ is the mean Hessian defined by: $ G_k=[calculus] $
We skip procedures of solving the minimization problem (1.10) and here is the unique solution of (1.10):
$ B_{k+1}=(I-\rho y_ks_k^T)B_k(I-\rho s_ky_k^T)+\rho y_ky_k^T $ (1.12)
where $ \rho=\frac{1}{y_k^Ts_k} $ (1.13)
Finally, we get the updated $ B_{k+1} $. However, according to (1.2) and (1.3), we also need the inverse of $ B_{k+1} $ in next iterate.
To get the inverse of $ B_{k+1} $, we can apply the Sherman-Morrison formula to avoid complicated calculation of inverse.
Set $ H_k=B_k^{-1} $, with Sherman-Morrison formula we can get:
$ H_{k+1}=H_k+\frac{s_k s_k^T}{s_k^T y_k}-\frac{H_k y_k y_k^T H_k}{y_k^T H_k y_k} $ (1.14)
With the derivation above, we can now understand how do quasi-Newton methods get rid of calculating the Hessian matrix and its inverse. We can directly estimate the inverse of Hessian and we can use (1.14) to update the approximation of the inverse of Hessian, which leads to the DFP method, or we can directly estimate the Hessian matrix and this is the main idea in the BFGS method.
$ B_k H_k $
$ $
DFP method
The DFP method, which is also known as the Davidon–Fletcher–Powell formula, is named after W.C. Davidon, Roger Fletcher, and Michael J.D. Powell. It was proposed by Davidon in 1959 first and then improved by Fletched and Powell. DFP method uses an $ n\times n $ symmetric positive definite matrix $ B_k $ to estimate the inverse of Hessian matrix and its algorithm is shown below.
DFP Algorithm
To avoid confusion, we use $ D $ to represent the approximation of the inverse of the Hessian matrix.
- Given the starting point $ x_0 $; convergence tolerance $ \epsilon, \epsilon>0 $; the initial estimation of inverse Hessian matrix $ D_0=I $; $ k=0 $.
- Compute the search direction $ d_k=-D_k\cdot g_k $.
- Compute the step length $ \lambda_k $ with a line search procedure that satisfies Wolfe conditions. And then set$ s_k={\lambda}_k d_k $, $ x_{k+1}=x_k+s_k $
- If $ ||g_{k+1}||<\epsilon $, then end of the iteration, otherwise continue step5.
- Computing $ y_k=g_{k+1}-g_k $.
- Update the $ D_{k+1} $ with$ D_{k+1}=D_k+\frac{s_k s_k^T}{s_k^T y_k}-\frac{D_k y_k y_k^T D_k}{y_k^T D_k y_k} $
- Update $ k $ with $ k=k+1 $ and go back to step2.
BFGS method
BFGS method is named for its four discoverers Broyden, Fletcher, Goldfarb, and Shanno, it is considered as the most effective quasi-Newton algorithm. Unlike the DFP method, the BFGS method uses an $ n\times n $ symmetric positive definite matrix $ B_k $ to estimate the Hessian matrix.
BFGS Algorithm
- Given the starting point $ x_0 $; convergence tolerance $ \epsilon, \epsilon>0 $; the initial estimation of Hessian matrix $ B_0=I $; $ k=0 $.
- Compute the search direction $ d_k=-B_k^{-1}\cdot g_k $.
- Compute the step length $ \lambda_k $ with a line search procedure that satisfies Wolfe conditions. And then set $ s_k={\lambda}_k d_k $, $ x_{k+1}=x_k+s_k $
- If $ ||g_{k+1}||<\epsilon $, then end of the iteration, otherwise continue step5.
- Computing $ y_k=g_{k+1}-g_k $.
- According to (1.12), (1.13) and (1.14), we can update the $ B_{k+1}^{-1} $ with $ B_{k+1}^{-1}=(I-\rho y_ks_k^T)B_k^{-1}(I-\rho s_ky_k^T)+\rho y_ky_k^T $
- Update $ k $ with $ k=k+1 $ and go back to step2.
Numerical Example
$ \begin{align} f(x_1, x_2) & = x_1^2 +\frac{1}{2}x_2^2+3\end{align} $