3. Gradient Methods and Conjugate Gradients
This chapter describes the three first-order unconstrained methods in nlopt4r: steepest descent, normalized gradient and Fletcher–Reeves nonlinear conjugate gradients. All three use vector-sized workspace with \(O(n)\) resident storage.
3.1 Steepest descent and normalized gradient
Steepest descent takes
Normalized gradient takes the unit-length direction
Both directions satisfy the descent condition \(g_k^\top d_k<0\). Armijo backtracking supplies the step. Under the book-wide assumptions of smoothness and a bounded sublevel set, backtracked steepest descent produces iterates whose gradients converge to a stationary point.
Figure 3-1 Exact line-search steepest descent on \(f(x)=\tfrac12(x_1^2+10x_2^2)\): consecutive search directions satisfy \(g_{k+1}^\top g_k=0\), and the polyline alternates near the two coordinate axes; the dashed line is the Newton step from \(x_0\), which reaches \(x^*\) in one step on a quadratic. Table 3.1 in section 3.1 of the textbook records iteration counts for the same quadratic from several starting points.
3.2 Fletcher–Reeves conjugate gradients
The Fletcher–Reeves direction is
Implementation details:
- a restart occurs every \(n+1\) iterations with restart direction \(-g_k\);
- a shared descent safeguard tests \(g_k^\top d_k\ge -10^{-12}|g_k||d_k|\) and replaces the direction by \(-g_k\).
The restart period \(n+1\) gives finite termination on quadratic objectives; on general smooth objectives the restart controls the drift of accumulated conjugacy.
3.3 Convergence rate and problem size
| Method | Main work per step | Storage | Typical rate |
|---|---|---|---|
| Steepest descent | 1 gradient + line search | \(O(n)\) | Linear; slow on ill-conditioned problems |
| Normalized gradient | 1 gradient + line search | \(O(n)\) | Linear |
| Fletcher–Reeves | 1 gradient + line search | \(O(n)\) | Linear in general; finite on quadratics |
All three read analytic gradients. Method::{SteepestDescent, NormalizedGradient, FletcherReeves} in minimize selects them; the gradient-tolerance test appears in chapter 1.
3.4 Callbacks and counts
Each outer iteration requests one combined value/gradient evaluation, and each line-search trial requests one objective value. EvaluationCounts::objective records all objective calls, while gradient records combined calls. The budget StopOptions::max_evaluations limits objective calls only and charges rejected trials.
Software interface
minimizeand theMethodenum: see chapter 16.- Callback interfaces: see chapter 15.
- API pages (docs.rs):
minimize,Method.
References
- 马昌凤, 最优化方法及其 Matlab 程序设计 (in Chinese), 2010, chapter 3.
- R. Fletcher, C. M. Reeves, “Function minimization by conjugate gradients,” Computer Journal 7 (1964), 149–154.
- J. Nocedal, S. J. Wright, Numerical Optimization, 2nd ed., 2006, Chapter 5.