Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

2. Line Search and Scalar Search

Line search chooses a step length for a one-dimensional subproblem. nlopt4r provides two searches: Armijo backtracking along a supplied descent direction (line_search::armijo) and a strong-Wolfe search (local::wolfe::strong_wolfe). Scalar search minimizes a univariate function on a finite closed interval. This chapter lists the conditions, implementation parameters and report fields.

2.1 Descent directions and the Armijo condition

For a smooth objective \(f\), a direction \(d\) is a descent direction when

$$ g^\top d\lt 0. $$

Armijo backtracking starts at \(\alpha_0=1\) and tries \(\alpha_k=\alpha_0\kappa^k\), accepting a step that satisfies

$$ \phi(\alpha)\le \phi(0)+c_1\,\alpha\,\phi'(0),\qquad \phi(\alpha)=f(x+\alpha d). $$

The defaults are \(c_1=0.2\), contraction \(\kappa=0.5\) and 60 trials.

Backtracking returns explicit errors in these cases:

  • the direction satisfies \(g^\top d\ge 0\): Error::InvalidInput;
  • the trial allowance runs out: Error::LineSearchFailed { evaluations, last_step }, with evaluations the number of trials and last_step the final step length;
  • a trial produces a non-finite value or the callback returns an error: that error propagates unchanged.

An accepted step returns Step { alpha, value, evaluations }, where value is the objective at the accepted point. armijo computes the origin gradient on entry; the caller supplies the direction and options.

Figure 2-1 Accepted interval of Armijo backtracking: \(\phi(\alpha)=1-3\alpha+3\alpha^2\), \(c_1=0.2\). The dashed line is the linear upper bound \(\phi(0)+c_1\alpha\phi^\prime(0)\) and the shaded band covers \(\alpha\in[0,0.8]\); the trial \(\alpha=0.5\) lies on the curve and the trial \(\alpha=1\) lies above the tangent. Section 2.2 of the textbook organizes inexact line search with the same inequality.

2.2 Strong Wolfe conditions

The strong-Wolfe search requires sufficient decrease and a curvature condition:

$$ \phi(\alpha)\le \phi(0)+c_1\alpha\phi'(0),\qquad |\phi'(\alpha)|\le c_2\,|\phi'(0)|, $$

with \(0<c_1<c_2<1\); the defaults are \(c_1=10^{-4}\) and \(c_2=0.9\).

The implementation has two stages:

  1. from the initial step 1, trial steps expand by doubling until a bracket holds an acceptable point;
  2. within a bracket, midpoints are strictly interior to the interval.

Both stages share the trial allowance (default 80, with the origin evaluation counted separately). Each trial computes the value and gradient together; the accepted pair is stored in StrongWolfeStep { alpha, value, gradient, evaluations } for reuse by the outer solver. A bracket that reaches midpoint precision returns LineSearchFailed.

The strong-Wolfe search supplies the outer step for L-BFGS and Newton-CG; the curvature condition supports positive-definite BFGS updates.

Scalar search minimizes a continuous unimodal function on a finite closed interval \([a,b]\) with two methods:

  • golden section (ScalarMethod::GoldenSection), contracting the interval by \(\rho=(3-\sqrt5)/2\approx0.382\);
  • parabolic/Brent interpolation (ScalarMethod::Parabolic), with safeguarded interpolation combined with golden-section protection.

Figure 2-2 Golden-section interval contraction: trial points sit at \(a+0.382(b-a)\) and \(a+0.618(b-a)\). Case (1) keeps \([a,q]\) and case (2) keeps \([p,b]\); both keep one trial point for the next round and multiply the interval length by \(t\approx0.618\). Section 2.1.1 of the textbook derives \(t\) from \(t^2=1-t\) (equation (2.6)) and gives the complete algorithm.

The stopping test uses the mixed interval tolerance

$$ b-a\le \tau_{\text{abs}}+\tau_{\text{rel}}\max(|x|,1), $$

with defaults \(\tau_{\text{abs}}=10^{-8}\) and \(\tau_{\text{rel}}=\sqrt{\varepsilon_{\text{machine}}}\). ScalarOptions::interval_tolerance stores both parameters, and StopOptions provides iteration and objective-evaluation allowances.

minimize_scalar is the convenience entry with an absolute tolerance, an iteration cap and a method; minimize_scalar_with_options takes full ScalarOptions and supports a strict objective budget.

The mathematical assumption is continuity and unimodality on the interval. The interval test and global multimodal optimality are distinct conclusions.

2.4 Report fields

TypeFieldMeaning
StepalphaAccepted step length
StepvalueObjective at the accepted point
StepevaluationsNumber of trials
StrongWolfeStepalpha, value, gradientAccepted step, objective, analytic gradient
StrongWolfeStepevaluationsCombined value/gradient callbacks (origin counted separately)
ScalarSolutionx, value, bracketBest point, objective, remaining interval
ScalarSolutionstatus, termination_reasonInterval convergence or a budget/iteration stop
ScalarSolutionevaluationsObjective calls, including endpoint evaluations

2.5 Parameter defaults

Option typeFieldDefaultValid range
ArmijoOptionsinitial_step1Positive finite
ArmijoOptionscontraction0.5\((0,1)\)
ArmijoOptionssufficient_decrease0.2\((0,1)\)
ArmijoOptionsmax_iterations60Positive integer
StrongWolfeOptionssufficient_decrease\(10^{-4}\)\(0<c_1<c_2\)
StrongWolfeOptionscurvature0.9\(c_1<c_2<1\)
StrongWolfeOptionsinitial_step / maximum_step1 / \(10^{20}\)Positive finite, initial at most maximum
StrongWolfeOptionsmax_evaluations80Positive integer
ScalarOptionsinterval_tolerance\(10^{-8}+\sqrt{\varepsilon},\vert x\vert\)Nonnegative, at least one term positive

Software interface

  • line_search::{armijo, minimize_scalar, minimize_scalar_with_options}: see chapter 16.
  • Step, StrongWolfeStep and recovery from failures: see chapter 20.
  • API reference (docs.rs): line_search.

References

  • 马昌凤, 最优化方法及其 Matlab 程序设计 (in Chinese), 2010, chapter 2.
  • J. Nocedal, S. J. Wright, Numerical Optimization, 2nd ed., 2006, Chapter 3.
  • R. P. Brent, Algorithms for Minimization without Derivatives, Prentice-Hall, 1973.