pub struct Linear<const N: usize> { /* private fields */ }Expand description
A linear restart strategy.
The interval between restarts increases by a fixed amount N after each restart.
The sequence of intervals is initial_N, initial_N + N, initial_N + 2N, ....
The generic constant N is the fixed amount by which the interval increases.
Trait Implementations§
Source§impl<const N: usize> Restarter for Linear<N>
impl<const N: usize> Restarter for Linear<N>
Source§fn new() -> Self
fn new() -> Self
Creates a new Linear restarter.
restarts_in is initialised to 0, meaning it will restart on the first call to should_restart().
The first interval after the initial restart will be N, the next 2N, then 3N, and so on.
Source§fn restart(&mut self)
fn restart(&mut self)
Performs a restart:
- Increments the restart count.
- Sets
restarts_into the currentrestarts_interval. - Increases
restarts_intervalbyNfor the next cycle.
Source§fn restarts_in(&self) -> usize
fn restarts_in(&self) -> usize
Returns the number of conflicts (or other units) remaining until the next restart.
When this count reaches zero, a restart should occur.
Source§fn increment_restarts_in(&mut self)
fn increment_restarts_in(&mut self)
Decrements the count of conflicts (or units) remaining until the next restart.
This is called after each conflict in the solver.
Source§fn num_restarts(&self) -> usize
fn num_restarts(&self) -> usize
Returns the total number of restarts performed by this strategy so far.
Source§fn should_restart(&mut self) -> bool
fn should_restart(&mut self) -> bool
Checks if a restart should occur based on the current state. Read more
impl<const N: usize> Eq for Linear<N>
impl<const N: usize> StructuralPartialEq for Linear<N>
Auto Trait Implementations§
impl<const N: usize> Freeze for Linear<N>
impl<const N: usize> RefUnwindSafe for Linear<N>
impl<const N: usize> Send for Linear<N>
impl<const N: usize> Sync for Linear<N>
impl<const N: usize> Unpin for Linear<N>
impl<const N: usize> UnwindSafe for Linear<N>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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