6. Large-Scale Local Methods
This chapter describes three smooth unconstrained methods for large problems: limited-memory BFGS (local::lbfgs), truncated Newton-CG (local::newton_cg) and matrix-free trust regions (local::trust_region_cg). All three read gradients; the latter two read Hessian-vector products.
6.1 Limited-memory BFGS
For steps \(s_i=x_{i+1}-x_i\) and gradient differences \(y_i=g_{i+1}-g_i\), L-BFGS stores the most recent \(m\) correction pairs and computes the inverse-Hessian product with two loops:
q = g
newest to oldest: a[i] = rho[i] * s[i]'q; q -= a[i] * y[i]
r = gamma * q
oldest to newest: b = rho[i] * y[i]'r; r += (a[i] - b) * s[i]
d = -r, rho[i] = 1 / (s[i]'y[i])
with the initial scaling
A correction pair is admitted when
default \(\tau_c=10^{-10}\); the reciprocal and initial scaling must be finite and positive. An admitted pair is stored, and the oldest pair is dropped once the history exceeds \(m\). A failing pair is skipped while the existing history remains.
Direction check: a computed direction \(d\) is used when \(g^\top d<0\) with finite entries; otherwise the history clears and \(d=-g\).
Storage is \(O(mn)\) and each step costs \(O(mn)\). The default is \(m=10\).
6.2 Truncated Newton-CG
local::newton_cg approximately solves the Newton equation in each outer iteration:
The inner conjugate-gradient loop:
- targets a residual \(|r_j|\le\tau_{\text{cg}}|g_k|\), default \(\tau_{\text{cg}}=0.1\);
- caps inner iterations at \(\min(\text{max_cg_iterations}, n)\), default 100;
- on nonpositive curvature \(d^\top H d\le 0\), returns the accumulated direction \(p\); a first-iteration occurrence returns \(-g_k\);
- after inner convergence, checks the outer direction for descent and runs a strong-Wolfe line search.
Storage is \(O(n)\), and EvaluationCounts::hessian records Hessian products. The outer search uses StrongWolfeOptions.
6.3 Matrix-free trust region
local::trust_region_cg embeds the Steihaug truncated-CG solver in a trust-region outer loop:
- subproblem options
SteihaugOptions { max_iterations, relative_tolerance }with defaults 100 and 0.1; - radius updates as in section 5.5;
- each outer iteration requests one value/gradient evaluation and several Hessian products;
- rejected trials consume objective budget.
6.4 Hessian-vector operator
Alongside the three matrix-free entry points, the local::HessianVector trait defines the operator interface:
fn hessian_vector(&self, x: &[f64], v: &[f64], product: &mut [f64]) -> Result<(), Error>;
Conventions:
- at a fixed \(x\), the product is linear in \(v\) and the operator is symmetric;
- the callback writes every buffer entry; the buffer starts as NaN, and the solver detects and reports missing entries;
- each product, including a failed callback, counts in
EvaluationCounts::hessian; - product calls are independent of the objective budget.
6.5 Counts and stopping
All three entry points return Solution and use StopOptions:
max_evaluationscovers objective calls, including the start evaluation, rejected trials and failed callbacks;gradient_tolerancetests \(|g|\);- optional
value_toleranceandstep_tolerancereport stagnation; evaluations.subproblemrecords inner CG solves.
Software interface
local::{lbfgs, newton_cg, trust_region_cg}and their option types: see chapter 16.- A complete
HessianVectorexample: see chapter 16. - Counts and error recovery: see chapter 20.
- API reference (docs.rs):
local.
References
- J. Nocedal, “Updating quasi-Newton matrices with limited storage,” Math. Comp. 35 (1980), 773–782.
- J. Nocedal, S. J. Wright, Numerical Optimization, 2nd ed., 2006, Algorithms 7.1–7.2.
- T. Steihaug, “The conjugate gradient method and trust regions in large scale optimization,” SIAM J. Numer. Anal. 20 (1983), 626–637.