pub struct JeroslowWangTwoSided { /* private fields */ }Expand description
Implements a two-sided version of the Jeroslow-Wang heuristic.
This heuristic first selects a variable based on the sum of JW scores for its
positive and negative literals (score(v) = JW(v) + JW(-v)).
Once a variable is chosen, it picks the polarity (positive or negative)
that has the higher individual JW score. If scores are equal, polarity is chosen randomly.
Similar to the one-sided version, there’s a small chance (10%) that the final chosen literal’s polarity will be flipped.
Trait Implementations§
Source§impl Clone for JeroslowWangTwoSided
impl Clone for JeroslowWangTwoSided
Source§fn clone(&self) -> JeroslowWangTwoSided
fn clone(&self) -> JeroslowWangTwoSided
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JeroslowWangTwoSided
impl Debug for JeroslowWangTwoSided
Source§impl Default for JeroslowWangTwoSided
impl Default for JeroslowWangTwoSided
Source§fn default() -> JeroslowWangTwoSided
fn default() -> JeroslowWangTwoSided
Source§impl<L: Literal> VariableSelection<L> for JeroslowWangTwoSided
impl<L: Literal> VariableSelection<L> for JeroslowWangTwoSided
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 JeroslowWangTwoSided strategy.
Initialises scores using init_jw_scores.
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 a variable and its polarity using the two-sided Jeroslow-Wang heuristic.
- Finds the unassigned variable
vmaximisingJW(v_pos) + JW(v_neg). - For the chosen
v, selects the literal (positive or negative) with the higher JW score. Ties are broken randomly. - There is a 10% chance the polarity of this final literal is flipped.
Source§fn bumps<T: IntoIterator<Item = L>>(&mut self, _: T)
fn bumps<T: IntoIterator<Item = L>>(&mut self, _: T)
Bumps scores. NO-OP for JeroslowWangTwoSided.
JW scores are static.
Auto Trait Implementations§
impl Freeze for JeroslowWangTwoSided
impl RefUnwindSafe for JeroslowWangTwoSided
impl Send for JeroslowWangTwoSided
impl Sync for JeroslowWangTwoSided
impl Unpin for JeroslowWangTwoSided
impl UnwindSafe for JeroslowWangTwoSided
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