Enum argmin::core::TerminationReason
source · pub enum TerminationReason {
MaxItersReached,
TargetCostReached,
Interrupt,
SolverConverged,
Timeout,
SolverExit(String),
}
Expand description
Reasons for optimization algorithms to stop
Variants§
MaxItersReached
Reached maximum number of iterations
TargetCostReached
Reached target cost function value
Interrupt
Algorithm manually interrupted with SIGINT (Ctrl+C), SIGTERM or SIGHUP
SolverConverged
Converged
Timeout
Timeout reached
SolverExit(String)
Solver exit with given reason
Implementations§
source§impl TerminationReason
impl TerminationReason
sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Returns a textual representation of what happened.
§Example
use argmin::core::TerminationReason;
assert_eq!(
TerminationReason::MaxItersReached.text(),
"Maximum number of iterations reached"
);
assert_eq!(
TerminationReason::TargetCostReached.text(),
"Target cost value reached"
);
assert_eq!(
TerminationReason::Interrupt.text(),
"Interrupt"
);
assert_eq!(
TerminationReason::SolverConverged.text(),
"Solver converged"
);
assert_eq!(
TerminationReason::Timeout.text(),
"Timeout reached"
);
assert_eq!(
TerminationReason::SolverExit("Aborted".to_string()).text(),
"Aborted"
);
Trait Implementations§
source§impl Clone for TerminationReason
impl Clone for TerminationReason
source§fn clone(&self) -> TerminationReason
fn clone(&self) -> TerminationReason
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TerminationReason
impl Debug for TerminationReason
source§impl Default for TerminationReason
impl Default for TerminationReason
source§impl<'de> Deserialize<'de> for TerminationReason
impl<'de> Deserialize<'de> for TerminationReason
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for TerminationReason
impl Display for TerminationReason
source§impl Hash for TerminationReason
impl Hash for TerminationReason
source§impl PartialEq for TerminationReason
impl PartialEq for TerminationReason
source§fn eq(&self, other: &TerminationReason) -> bool
fn eq(&self, other: &TerminationReason) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for TerminationReason
impl Serialize for TerminationReason
impl Eq for TerminationReason
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 UnwindSafe for TerminationReason
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
Mutably borrows from an owned value. Read more
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.