pub struct JeroslowWangOneSided { /* private fields */ }Expand description
Implements the Jeroslow-Wang heuristic (one-sided version).
This heuristic scores literals based on their occurrences in clauses,
giving higher weight to literals in shorter clauses (specifically, 2^(-clause_length)).
When picking a variable, it chooses the literal (variable and polarity) with the
highest score among unassigned literals.
There’s a small chance (10%) that the chosen literal’s polarity will be flipped, adding an element of randomness.
Trait Implementations§
Source§impl Clone for JeroslowWangOneSided
impl Clone for JeroslowWangOneSided
Source§fn clone(&self) -> JeroslowWangOneSided
fn clone(&self) -> JeroslowWangOneSided
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JeroslowWangOneSided
impl Debug for JeroslowWangOneSided
Source§impl Default for JeroslowWangOneSided
impl Default for JeroslowWangOneSided
Source§fn default() -> JeroslowWangOneSided
fn default() -> JeroslowWangOneSided
Source§impl<L: Literal> VariableSelection<L> for JeroslowWangOneSided
impl<L: Literal> VariableSelection<L> for JeroslowWangOneSided
Source§fn new<C: AsRef<[L]>>(num_vars: usize, _: &[L], clauses: &[C]) -> Self
fn new<C: AsRef<[L]>>(num_vars: usize, _: &[L], clauses: &[C]) -> Self
Creates a new JeroslowWangOneSided strategy.
Initialises scores using init_jw_scores based on the provided clauses.
The random number generator is seeded with 0.
Source§fn pick<A: Assignment>(&mut self, assignment: &A) -> Option<L>
fn pick<A: Assignment>(&mut self, assignment: &A) -> Option<L>
Picks an unassigned literal with the highest Jeroslow-Wang score. It iterates through all literals, finds the unassigned one with the maximum score. There is a 10% chance the polarity of this chosen literal will be flipped.
Source§fn bumps<T: IntoIterator<Item = L>>(&mut self, _: T)
fn bumps<T: IntoIterator<Item = L>>(&mut self, _: T)
JW scores are static, based on initial clause structure.
Auto Trait Implementations§
impl Freeze for JeroslowWangOneSided
impl RefUnwindSafe for JeroslowWangOneSided
impl Send for JeroslowWangOneSided
impl Sync for JeroslowWangOneSided
impl Unpin for JeroslowWangOneSided
impl UnwindSafe for JeroslowWangOneSided
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
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>
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 more