#[non_exhaustive]pub enum ObserverMode {
Never,
Always,
Every(u64),
NewBest,
}Expand description
Per-registration policy for observe_iter.
Every variant gates the iteration callback only: observe_init and
observe_final always fire. A user who wants to fully disable an observer
should simply not register it. The same policy applies to ObserveSolver
and ObservationEvent::Iter callbacks.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Never
Skip observe_iter entirely. The observer
still sees observe_init/observe_final.
Always
Fire observe_iter on every iteration.
Every(u64)
Fire observe_iter on iterations whose
(post-increment) counter is a multiple of n. Every(1) is
equivalent to Always; Every(0) is rejected as
nonsensical and panics on construction via
every, but raw construction is permitted and
treated as Never (no iter is a multiple of zero under the
iter % n == 0 rule because n == 0 would divide-by-zero; the
executor checks for n != 0 before the modulus).
NewBest
Fire observe_iter only on iterations that
strictly improved the best cost so far, i.e. where
State::best_iter equals
State::iter. Ties (a new iterate
merely equal to the incumbent) do not fire, matching the strict
< test in State::update_best.
Pairs naturally with observers that only care about progress, such as logging or checkpointing the incumbent whenever it moves.
Implementations§
Trait Implementations§
Source§impl Clone for ObserverMode
impl Clone for ObserverMode
impl Copy for ObserverMode
Source§impl Debug for ObserverMode
impl Debug for ObserverMode
impl Eq for ObserverMode
Source§impl PartialEq for ObserverMode
impl PartialEq for ObserverMode
impl StructuralPartialEq for ObserverMode
Auto Trait Implementations§
impl Freeze for ObserverMode
impl RefUnwindSafe for ObserverMode
impl Send for ObserverMode
impl Sync for ObserverMode
impl Unpin for ObserverMode
impl UnsafeUnpin for ObserverMode
impl UnwindSafe for ObserverMode
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.