#[non_exhaustive]pub enum TerminationReason {
Show 19 variants
MaxIter,
MaxCostEvals,
MaxGradientEvals,
GradientTolerance,
RelativeGradientTolerance,
ProjectedGradientTolerance,
ParamTolerance,
RelativeParamTolerance,
CostTolerance,
RelativeCostTolerance,
TargetCost,
NoImprovement,
SimplexTolerance,
CmaEsTolerance,
RhoTolerance,
MeshTolerance,
MaxTime,
SolverConverged,
SolverFailed,
}Expand description
Why the executor stopped. Returned on
OptimizationResult::reason
and the various step/run hooks.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MaxIter
state.iter() >= max_iter.
MaxCostEvals
Cost-evaluation budget exhausted.
MaxGradientEvals
Gradient-evaluation budget exhausted.
GradientTolerance
‖∇f(x)‖ ≤ tol.
RelativeGradientTolerance
‖∇f(x_k)‖ ≤ tol · ‖∇f(x_0)‖: gradient norm relative to the
initial gradient (scale-invariant first-order stationarity).
ProjectedGradientTolerance
‖x − π_C(x − ∇f(x))‖_∞ ≤ tol: projected-gradient stationarity
for box-constrained problems. Collapses to the unconstrained
gradient norm when no constraint is active.
ParamTolerance
‖x_k − x_{k−1}‖ ≤ tol.
RelativeParamTolerance
‖x_k − x_{k−1}‖ ≤ tol · ‖x_k‖: scale-invariant step test
(MINPACK xtol).
CostTolerance
|f_k − f_{k−1}| ≤ tol.
RelativeCostTolerance
|f_k − f_{k−1}| ≤ tol · |f_{k−1}|: scale-invariant cost
reduction test (MINPACK ftol).
TargetCost
f(x_k) ≤ target: user-supplied target cost reached
(NLopt’s stopval/SciPy’s f_min).
NoImprovement
Best-so-far cost has not improved by more than tol in
patience consecutive iterations: the early-stopping pattern.
SimplexTolerance
Simplex collapsed below the configured tolerance.
CmaEsTolerance
CMA-ES search distribution collapsed below TolX:
σ · maxᵢ dᵢ < tol_x (Hansen 2016 Appendix B.3).
RhoTolerance
NEWUOA trust-region radius reached the configured floor: ρ ≤ rho_end.
MeshTolerance
MADS poll size reached the configured floor: Δᵖ ≤ poll_size_min.
MaxTime
Wall-clock time limit reached.
SolverConverged
Solver determined it has converged (e.g. fixed point reached).
SolverFailed
Solver cannot make further progress (e.g. line search failure).
Implementations§
Source§impl TerminationReason
impl TerminationReason
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Whether this reason represents an unrecoverable failure that an outer solver should bubble (rather than consume and continue).
Currently only SolverFailed qualifies:
MaxIter, the *Tolerance reasons, and
SolverConverged are all “clean stops”
that an outer solver running an inner per outer iter should treat
as “result is fine, move on”. See CONTRIBUTING.md “Solver
composition” for the failure-routing contract.
Trait Implementations§
Source§impl Clone for TerminationReason
impl Clone for TerminationReason
Source§fn clone(&self) -> TerminationReason
fn clone(&self) -> TerminationReason
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for TerminationReason
Source§impl Debug for TerminationReason
impl Debug for TerminationReason
impl Eq for TerminationReason
Source§impl PartialEq for TerminationReason
impl PartialEq for TerminationReason
Source§fn eq(&self, other: &TerminationReason) -> bool
fn eq(&self, other: &TerminationReason) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TerminationReason
Auto Trait Implementations§
impl Freeze for TerminationReason
impl RefUnwindSafe for TerminationReason
impl Send for TerminationReason
impl Sync for TerminationReason
impl Unpin for TerminationReason
impl UnsafeUnpin for TerminationReason
impl UnwindSafe for TerminationReason
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.