Conjugate gradient methods: Difference between revisions

From Cornell University Computational Optimization Open Textbook - Optimization Wiki
Jump to navigation Jump to search
Line 58: Line 58:
The conjugate gradient method is a conjugate direction method in which selected successive direction vectors are treated as a conjugate version of the successive gradients obtained while the method progresses. The conjugate directions are not specified beforehand but rather are determined sequentially at each step of the iteration<ref>A. Singh and P. Ravikumar, “Conjugate Gradient Descent.” 2012. [Online]. Available: http://www.cs.cmu.edu/~pradeepr/convexopt/Lecture_Slides/conjugate_direction_methods.pdf</ref>. If the conjugate vectors are carefully chosen, then not all the conjugate vectors may be needed to obtain the solution. Therefore, the conjugate gradient method is regarded as an iterative method. This also allows approximate solutions to systems where n is so large that the direct method requires too much time.<br>
The conjugate gradient method is a conjugate direction method in which selected successive direction vectors are treated as a conjugate version of the successive gradients obtained while the method progresses. The conjugate directions are not specified beforehand but rather are determined sequentially at each step of the iteration<ref>A. Singh and P. Ravikumar, “Conjugate Gradient Descent.” 2012. [Online]. Available: http://www.cs.cmu.edu/~pradeepr/convexopt/Lecture_Slides/conjugate_direction_methods.pdf</ref>. If the conjugate vectors are carefully chosen, then not all the conjugate vectors may be needed to obtain the solution. Therefore, the conjugate gradient method is regarded as an iterative method. This also allows approximate solutions to systems where n is so large that the direct method requires too much time.<br>
===Algorithm===
===Algorithm===
Given <math>D=\left\{ \textbf{d}_{0},\textbf{d}_{1},..., \textbf{d}_{n-1}\right\}</math>  be a set of ''n'' '''A'''-conjugate vectors, then <math>F(\textbf{x}_0 +\alpha_1\textbf{d}_1 + \alpha_2\textbf{d}_2+...+\alpha_{n}\textbf{d}_{n})</math> can be minimized by stepping from <math>/textbf{x}_0</math> along <math>/textbf{d}_1</math> to the minimum <math>/textbf{x}_1</math>, stepping from <math>/textbf{x}_1</math> along <math>/textbf{d}_2</math> to the minimum <math>/textbf{x}_2</math>, etc. And let <math>/textbf{x}_0 \in \textbf{R}_n</math> be randomly chosen, then the algorithm is the following:
Given <math>D=\left\{ \textbf{d}_{0},\textbf{d}_{1},..., \textbf{d}_{n-1}\right\}</math>  be a set of ''n'' '''A'''-conjugate vectors, then <math>F(\textbf{x}_0 +\alpha_1\textbf{d}_1 + \alpha_2\textbf{d}_2+...+\alpha_{n}\textbf{d}_{n})</math> can be minimized by stepping from <math>\textbf{x}_0</math> along <math>\textbf{d}_1</math> to the minimum <math>\textbf{x}_1</math>, stepping from <math>\textbf{x}_1</math> along <math>\textbf{d}_2</math> to the minimum <math>\textbf{x}_2</math>, etc. And let <math>\textbf{x}_0 \in \textbf{R}_n</math> be randomly chosen, then the algorithm is the following:


'''Alg 1''': Pick <math>\left\{ \textbf{d}_{0},\textbf{d}_{1},..., \textbf{d}_{n-1}\right\}</math>  mutually '''A'''-conjugate, and from a random <math>\textbf{x}_0</math>,<br>
'''Alg 1''': Pick <math>\left\{ \textbf{d}_{0},\textbf{d}_{1},..., \textbf{d}_{n-1}\right\}</math>  mutually '''A'''-conjugate, and from a random <math>\textbf{x}_0</math>,<br>

Revision as of 02:20, 28 November 2021

Author: Alexandra Roberts, Anye Shi, Yue Sun (SYSEN6800 Fall 2021)

Introduction

The conjugate gradient method (CG) was originally invented to minimize a quadratic function:

where A is an n × n symmetric positive definite matrix, x and b are n × 1 vectors.
The solution to the minimization problem is equivalent to solving the linear system, i.e. determining x when , i.e.

The conjugate gradient method is often implemented as an iterative algorithm and can be considered as being between Newton’s method, a second-order method that incorporates Hessian and gradient, and the method of steepest descent, a first-order method that uses gradient [1]. Newton’s Method usually reduces the number of iterations needed, but the calculation of the Hessian matrix and its inverse increases the computation required for each iteration. Steepest descent takes repeated steps in the opposite direction of the gradient of the function at the current point. It often takes steps in the same direction as earlier ones, resulting in slow convergence (Figure 1). To avoid the high computational cost of Newton’s method and to accelerate the convergence rate of steepest descent, the conjugate gradient method was developed.

The idea of the CG method is to pick n orthogonal search directions first and, in each search direction, take exactly one step such that the step size is to the proposed solution x at that direction. The solution is reached after n steps as, theoretically, the number of iterations needed by the CG method is equal to the number of different eigenvalues of A, i.e. at most n. This makes it attractive for large and sparse problems. The method can be used to solve least-squares problems and can also be generalized to a minimization method for general smooth functions[2].

Theory

The definition of A-conjugate direction

Let A be a symmetric positive definite matrix. are the vectors that orthogonal (conjugate) to each other with respect to A if
.

Note that if A = 0, any two vectors will be conjugated to each other. If A = I, conjugacy is equivalent to the conventional notion of orthogonality. If are A-conjugated to each other, then the set of vectors are linearly independent.

The motivation of A-conjugacy

As is a set of n A-conjugate vectors, then can be used as a basis and express the solution x* to is:


Then multiplying dKT on both sides

Because and the A-conjugacy of , i.e. , the multiplication will cancel out all the terms except for term k


Then the solution x* will be

Because A is a symmetric and positive-definite matrix, so the term defines an inner product and, therefore, no need to calculate the inversion of matrix A.

Conjugate Direction Theorem

Let be a set of n A-conjugate vectors, be a random starting point. Then



After n steps, xn = x*.

Proof:
Given



Therefore






The conjugate gradient method

The conjugate gradient method is a conjugate direction method in which selected successive direction vectors are treated as a conjugate version of the successive gradients obtained while the method progresses. The conjugate directions are not specified beforehand but rather are determined sequentially at each step of the iteration[3]. If the conjugate vectors are carefully chosen, then not all the conjugate vectors may be needed to obtain the solution. Therefore, the conjugate gradient method is regarded as an iterative method. This also allows approximate solutions to systems where n is so large that the direct method requires too much time.

Algorithm

Given be a set of n A-conjugate vectors, then can be minimized by stepping from along to the minimum , stepping from along to the minimum , etc. And let be randomly chosen, then the algorithm is the following:

Alg 1: Pick mutually A-conjugate, and from a random ,
For k = 1 to n
{

  1. ;
  2. ;

}
Return

numerical example

Application

Conclusion

Reference

Jonathan Shewchuk, “An Introduction to the Conjugate Gradient Method Without the Agonizing Pain,” 1994.

  1. “Conjugate gradient method,” Wikipedia. Nov. 25, 2021. Accessed: Nov. 26, 2021. [Online]. Available: https://en.wikipedia.org/w/index.php?title=Conjugate_gradient_method&oldid=1057033318
  2. W. Stuetzle, “The Conjugate Gradient Method.” 2001. [Online]. Available: https://sites.stat.washington.edu/wxs/Stat538-w03/conjugate-gradients.pdf
  3. A. Singh and P. Ravikumar, “Conjugate Gradient Descent.” 2012. [Online]. Available: http://www.cs.cmu.edu/~pradeepr/convexopt/Lecture_Slides/conjugate_direction_methods.pdf