% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/healthy_basin.R
\name{healthy_basin}
\alias{healthy_basin}
\title{Healthy-Basin Detector for Cubic-to-QN-Polish Transition}
\description{
Detects when the iterate has entered the quadratic attraction basin of a
strict local minimum, at which point arcopt can switch from cubic
regularization to line-search BFGS (qn_polish mode) and skip further
Hessian evaluations for the remainder of the run.
}
\details{
The detector maintains a sliding window of runtime diagnostics and fires
when \strong{all five} of the following signals hold throughout the
window:
\enumerate{
\item \strong{Newton step accepted}: \code{step_type == "newton"} at
every iteration in the window. Indicates the cubic subproblem has
not been invoked (Cholesky succeeded and the Newton step passed the
ratio test).
\item \strong{High ratio}: \code{rho_k >= rho_polish} (default
\code{0.9}) throughout the window. The quadratic model is accurately
predicting actual reduction.
\item \strong{Hessian well-conditioned PD}: \code{lambda_min(H_k) >=
    lambda_min_polish} (default \code{1e-3}) throughout the window. Not
just "Cholesky succeeded" but strictly bounded away from zero.
\item \strong{Superlinear gradient decay}: \code{||g_k||_inf /
    ||g_{k-1}||_inf <= g_decay_polish} (default \code{0.5}) for every
consecutive pair in the window. This is the strongest signal of the
quadratic attraction basin.
\item \strong{Above convergence floor}: \code{||g_0||_inf >
    g_inf_floor_polish} at window start (default \code{1e-8}). Prevents
firing at convergence where Newton-accept and gradient-decay are
trivially satisfied.
}

Contrast with the flat-ridge detector (\code{\link{flat_ridge}}): that
detector fires on \emph{stagnation} (gradient not decreasing); this one
fires on \emph{healthy convergence} (gradient decreasing super-
linearly). Both are expected to be mutually exclusive in practice.
}
\keyword{internal}
