pub struct PhaseScope<'t, 'a, S: PlanningSolution, D: ScoreDirector<S>> { /* private fields */ }Expand description
Scope for a single phase of solving.
§Type Parameters
't- Lifetime of the termination flag'a- Lifetime of the solver scope referenceS- The planning solution typeD- The score director type
Implementations§
Source§impl<'t, 'a, S: PlanningSolution, D: ScoreDirector<S>> PhaseScope<'t, 'a, S, D>
impl<'t, 'a, S: PlanningSolution, D: ScoreDirector<S>> PhaseScope<'t, 'a, S, D>
Sourcepub fn new(
solver_scope: &'a mut SolverScope<'t, S, D>,
phase_index: usize,
) -> Self
pub fn new( solver_scope: &'a mut SolverScope<'t, S, D>, phase_index: usize, ) -> Self
Creates a new phase scope.
Sourcepub fn with_phase_type(
solver_scope: &'a mut SolverScope<'t, S, D>,
phase_index: usize,
phase_type: &'static str,
) -> Self
pub fn with_phase_type( solver_scope: &'a mut SolverScope<'t, S, D>, phase_index: usize, phase_type: &'static str, ) -> Self
Creates a new phase scope with a specific phase type name.
Sourcepub fn phase_index(&self) -> usize
pub fn phase_index(&self) -> usize
Returns the phase index.
Sourcepub fn starting_score(&self) -> Option<&S::Score>
pub fn starting_score(&self) -> Option<&S::Score>
Returns the starting score for this phase.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Returns the step count for this phase.
Sourcepub fn increment_step_count(&mut self) -> u64
pub fn increment_step_count(&mut self) -> u64
Increments the phase step count.
Sourcepub fn solver_scope(&self) -> &SolverScope<'t, S, D>
pub fn solver_scope(&self) -> &SolverScope<'t, S, D>
Returns a reference to the solver scope.
Sourcepub fn solver_scope_mut(&mut self) -> &mut SolverScope<'t, S, D>
pub fn solver_scope_mut(&mut self) -> &mut SolverScope<'t, S, D>
Returns a mutable reference to the solver scope.
Sourcepub fn score_director(&self) -> &D
pub fn score_director(&self) -> &D
Returns a reference to the score director.
Sourcepub fn score_director_mut(&mut self) -> &mut D
pub fn score_director_mut(&mut self) -> &mut D
Returns a mutable reference to the score director.
Sourcepub fn calculate_score(&mut self) -> S::Score
pub fn calculate_score(&mut self) -> S::Score
Calculates the current score.
Sourcepub fn update_best_solution(&mut self)
pub fn update_best_solution(&mut self)
Updates best solution.
Sourcepub fn stats(&self) -> &PhaseStats
pub fn stats(&self) -> &PhaseStats
Returns a reference to the phase statistics.
Sourcepub fn stats_mut(&mut self) -> &mut PhaseStats
pub fn stats_mut(&mut self) -> &mut PhaseStats
Returns a mutable reference to the phase statistics.
Auto Trait Implementations§
impl<'t, 'a, S, D> Freeze for PhaseScope<'t, 'a, S, D>
impl<'t, 'a, S, D> RefUnwindSafe for PhaseScope<'t, 'a, S, D>
impl<'t, 'a, S, D> Send for PhaseScope<'t, 'a, S, D>
impl<'t, 'a, S, D> Sync for PhaseScope<'t, 'a, S, D>where
D: Sync,
impl<'t, 'a, S, D> Unpin for PhaseScope<'t, 'a, S, D>
impl<'t, 'a, S, D> !UnwindSafe for PhaseScope<'t, 'a, S, D>
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