pub struct PhaseStats {
pub phase_index: usize,
pub phase_type: &'static str,
pub step_count: u64,
pub moves_evaluated: u64,
pub moves_accepted: u64,
/* private fields */
}Expand description
Phase-level statistics.
Tracks metrics for a single solver phase.
§Example
use solverforge_solver::stats::PhaseStats;
let mut stats = PhaseStats::new(0, "LocalSearch");
stats.record_step();
stats.record_move(true);
assert_eq!(stats.phase_index, 0);
assert_eq!(stats.phase_type, "LocalSearch");
assert_eq!(stats.step_count, 1);
assert_eq!(stats.moves_accepted, 1);Fields§
§phase_index: usizeIndex of this phase (0-based).
phase_type: &'static strType name of the phase.
step_count: u64Number of steps taken in this phase.
moves_evaluated: u64Number of moves evaluated in this phase.
moves_accepted: u64Number of moves accepted in this phase.
Implementations§
Source§impl PhaseStats
impl PhaseStats
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Returns the elapsed time in milliseconds.
Sourcepub fn record_step(&mut self)
pub fn record_step(&mut self)
Records a step completion.
Sourcepub fn record_move(&mut self, accepted: bool)
pub fn record_move(&mut self, accepted: bool)
Records a move evaluation and whether it was accepted.
Sourcepub fn moves_per_second(&self) -> u64
pub fn moves_per_second(&self) -> u64
Returns the moves per second rate.
Sourcepub fn acceptance_rate(&self) -> f64
pub fn acceptance_rate(&self) -> f64
Returns the acceptance rate (accepted / evaluated).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PhaseStats
impl RefUnwindSafe for PhaseStats
impl Send for PhaseStats
impl Sync for PhaseStats
impl Unpin for PhaseStats
impl UnwindSafe for PhaseStats
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 more