  Let $X$ be a complex affine variety in $\mathbb{C}^N$, and let
$f:\mathbb{C}^N\to \mathbb{C}$ be a polynomial function whose restriction to
$X$ is nonconstant. For $g:\mathbb{C}^N \to \mathbb{C}$ a general linear
function, we study the limiting behavior of the critical points of the
one-parameter family of $f_t: =f-tg$ as $t\to 0$. Our main result gives an
expression of this limit in terms of critical sets of the restrictions of $g$
to the singular strata of $(X,f)$. We apply this result in the context of
optimization problems. For example, we consider nearest point problems (e.g.,
Euclidean distance degrees) for affine varieties and a possibly nongeneric data
point.
