#[non_exhaustive]pub enum Termination<F: Scalar = f64> {
Converged(Convergence<F>),
Limit(Vec<ExecutionLimit>),
Target {
cost: F,
target: F,
},
Stalled(Stall<F>),
Failed(NumericalFailure<F>),
Cancelled,
Application(ApplicationStop),
}Expand description
A stopping decision returned with its explanation at the point of detection.
Numerical failure publishes a coherent state through Ok; typed problem
callback errors remain Result::Err. Convergence describes the tested
predicates and does not certify a global optimum or parameter accuracy.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Converged(Convergence<F>)
One or more numerical convergence predicates passed.
Limit(Vec<ExecutionLimit>)
All execution budgets exhausted at the observed boundary.
Target
The eligible objective incumbent reached the requested target.
Fields
cost: FEligible incumbent objective at the stopping boundary.
target: FRequested objective threshold.
Stalled(Stall<F>)
A numerical safeguard or configured progress rule stopped the run.
Failed(NumericalFailure<F>)
The solver could not continue numerically.
Cancelled
The executor cancellation token requested a stop.
Application(ApplicationStop)
An application hook requested a stop.
Implementations§
Source§impl<F: Scalar> Termination<F>
impl<F: Scalar> Termination<F>
Sourcepub fn native_convergence_tests(&self) -> Vec<NativeConvergenceTest>
pub fn native_convergence_tests(&self) -> Vec<NativeConvergenceTest>
Native identities retained for diagnostic consumers migrating from 1.x. The returned list is derived from this event, never from solver history.
Sourcepub fn converged(criterion: ConvergenceCriterion<F>) -> Self
pub fn converged(criterion: ConvergenceCriterion<F>) -> Self
Stop because the supplied numerical predicate passed.
Sourcepub fn is_converged(&self) -> bool
pub fn is_converged(&self) -> bool
Whether this decision establishes its reported convergence predicates.
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Whether this decision reports a numerical failure.
Sourcepub fn can_continue_as_inner(&self, policy: PartialResultPolicy) -> bool
pub fn can_continue_as_inner(&self, policy: PartialResultPolicy) -> bool
Whether an outer algorithm may consume this result under its explicit partial-result policy. Cancellation, application stops, and failures require routing rather than silently continuing.
Sourcepub fn numerical_failure(message: impl Into<String>) -> Self
pub fn numerical_failure(message: impl Into<String>) -> Self
Stop with a numerical failure and a published state.
Sourcepub fn numerical_stall(message: impl Into<String>) -> Self
pub fn numerical_stall(message: impl Into<String>) -> Self
Stop on a numerical safeguard without claiming convergence.
Source§impl<F: Scalar> Termination<F>
impl<F: Scalar> Termination<F>
Sourcepub fn upper_bound(
test: ConvergenceTest,
value: F,
bound: F,
tolerance: F,
reference: Option<F>,
) -> Self
pub fn upper_bound( test: ConvergenceTest, value: F, bound: F, tolerance: F, reference: Option<F>, ) -> Self
Construct a predicate report with its measured value and bound.
Sourcepub fn custom(
key: impl Into<String>,
definition: impl Into<String>,
measurements: Vec<Measurement<F>>,
) -> Self
pub fn custom( key: impl Into<String>, definition: impl Into<String>, measurements: Vec<Measurement<F>>, ) -> Self
Construct a namespaced predicate with its definition and measurements.
Sourcepub fn code(&self) -> TerminationCode
pub fn code(&self) -> TerminationCode
A compact compatibility identifier. With simultaneous predicates, this
identifies the first reported predicate; use the full report to inspect
every condition. Its numeric value is explicitly mapped by as_u8().
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for Termination<F>where
F: Deserialize<'de> + Scalar,
Available on crate feature serde only.
impl<'de, F> Deserialize<'de> for Termination<F>where
F: Deserialize<'de> + Scalar,
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<F> Serialize for Termination<F>
Available on crate feature serde only.
impl<F> Serialize for Termination<F>
serde only.impl<F: PartialEq + Scalar> StructuralPartialEq for Termination<F>
Auto Trait Implementations§
impl<F> Freeze for Termination<F>
impl<F> RefUnwindSafe for Termination<F>where
Convergence<F>: RefUnwindSafe,
F: RefUnwindSafe,
Stall<F>: RefUnwindSafe,
NumericalFailure<F>: RefUnwindSafe,
impl<F> Send for Termination<F>
impl<F> Sync for Termination<F>
impl<F> Unpin for Termination<F>
impl<F> UnsafeUnpin for Termination<F>where
Convergence<F>: UnsafeUnpin,
F: UnsafeUnpin,
Stall<F>: UnsafeUnpin,
NumericalFailure<F>: UnsafeUnpin,
impl<F> UnwindSafe for Termination<F>where
Convergence<F>: UnwindSafe,
F: UnwindSafe,
Stall<F>: UnwindSafe,
NumericalFailure<F>: UnwindSafe,
Blanket Implementations§
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.