% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/line_search.R
\name{wolfe_line_search}
\alias{wolfe_line_search}
\title{Wolfe Line Search}
\usage{
wolfe_line_search(
  fn,
  gr,
  x,
  d,
  f_x,
  g_x,
  c1 = 1e-04,
  c2 = 0.9,
  alpha_max = 1,
  max_iter = 20,
  ...
)
}
\arguments{
\item{fn}{Objective function. Called as \code{fn(x_new, ...)}.}

\item{gr}{Gradient function. Called as \code{gr(x_new, ...)}.}

\item{x}{Numeric vector; current iterate.}

\item{d}{Numeric vector; search direction (must be a descent direction,
i.e., \code{sum(g_x * d) < 0}).}

\item{f_x}{Current objective value \code{fn(x)}.}

\item{g_x}{Current gradient \code{gr(x)}.}

\item{c1}{Armijo (sufficient decrease) constant; default \code{1e-4}.}

\item{c2}{Curvature constant (strong Wolfe); default \code{0.9} (standard for
quasi-Newton). Smaller values give stricter curvature conditions; for
linear-CG use \code{0.1}.}

\item{alpha_max}{Maximum step length; default \code{1.0}. Line search will
try \code{alpha_curr = alpha_max} first (appropriate for Newton-like
directions).}

\item{max_iter}{Maximum total evaluations (bracketing + zoom); default
\code{20}.}

\item{...}{Extra arguments forwarded to \code{fn} and \code{gr}.}
}
\value{
A list with components:
\item{success}{TRUE if strong Wolfe was satisfied; FALSE otherwise.}
\item{alpha}{Final step length (best available even on failure).}
\item{x_new}{\code{x + alpha * d}.}
\item{f_new}{\code{fn(x_new)}.}
\item{g_new}{\code{gr(x_new)}.}
\item{evals_f}{Number of objective evaluations performed.}
\item{evals_g}{Number of gradient evaluations performed.}
\item{reason}{String describing success or failure mode.}
}
\description{
Performs a line search along a descent direction \code{d} from point \code{x},
finding a step length \code{alpha} that satisfies the strong Wolfe conditions.
Implements the bracketing + zoom scheme from Nocedal & Wright (2006),
Algorithms 3.5 (bracketing) and 3.6 (zoom).
}
\details{
Strong Wolfe conditions:
\itemize{
\item Armijo (sufficient decrease):
\eqn{f(x + \alpha d) \le f(x) + c_1 \alpha g_x^\top d}
\item Curvature:
\eqn{|g(x + \alpha d)^\top d| \le c_2 |g_x^\top d|}
}
The algorithm first brackets an interval containing a Wolfe point, then
bisects within the bracket to locate one. Bisection is used for
simplicity; quadratic or cubic interpolation as in Nocedal & Wright Sec. 3.5
can be added as a future refinement.

Returns \code{success = FALSE} when no strong Wolfe alpha is found within
\code{max_iter} evaluations. The caller can still consult \code{alpha} (and the
associated trial point) to decide whether to take the best-known step
or reject the iteration.
}
\keyword{internal}
