pub struct Vsids<Var: StorageKey> { /* private fields */ }Expand description
A VariableSelector which implements VSIDS [1].
This selctor determines which variables should be branched on based on how often it appears in conflicts.
Intuitively, the more often a variable appears in recent conflicts, the more “important” it is during the search process.
VSIDS is originally from the SAT field (see [1]) but we adapted it here to work on integer variables as well. There are some details which do not necessarily translate 1-to-1; for example, during conflict analysis the activity of an integer variable can be bumped multiple times if multiple literals related to it are encountered.
§Bibliography
[1] M. W. Moskewicz, C. F. Madigan, Y. Zhao, L. Zhang, and S. Malik, ‘Chaff: Engineering an efficient SAT solver’, in Proceedings of the 38th annual Design Automation Conference, 2001, pp. 530–535.
Implementations§
source§impl<Var: StorageKey + Clone + Copy> Vsids<Var>
impl<Var: StorageKey + Clone + Copy> Vsids<Var>
sourcepub fn new(variables: &[Var]) -> Self
pub fn new(variables: &[Var]) -> Self
Creates a new instance of the Vsids VariableSelector with certain default values for
the parameters (1.0 for the increment, 1e100 for the max threshold,
0.95 for the decay factor and 0.0 for the initial VSIDS value).
sourcepub fn with_initial_values(variables: &[Var], initial_values: &[f64]) -> Self
pub fn with_initial_values(variables: &[Var], initial_values: &[f64]) -> Self
Creates a new instance of the Vsids VariableSelector with certain default values for
the parameters (1.0 for the increment, 1e100 for the max threshold and
0.95 for the decay factor). It initialises the internal max-heap structure used for
finding the maximum Var with the provided initial_values; this parameter can thus be
used to guide the early search process of the selector.
It is required that the length of variables is equal to the length of initial_values.
Trait Implementations§
source§impl VariableSelector<DomainId> for Vsids<DomainId>
impl VariableSelector<DomainId> for Vsids<DomainId>
source§fn select_variable(
&mut self,
context: &SelectionContext<'_>,
) -> Option<DomainId>
fn select_variable( &mut self, context: &SelectionContext<'_>, ) -> Option<DomainId>
None when all variables which have been passed to the
VariableSelector have been assigned. Otherwise it should return the variable to
branch on next.source§fn on_conflict(&mut self)
fn on_conflict(&mut self)
source§fn on_unassign_integer(&mut self, variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, variable: DomainId, _value: i32)
source§fn on_appearance_in_conflict_integer(&mut self, variable: DomainId)
fn on_appearance_in_conflict_integer(&mut self, variable: DomainId)
source§fn is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
VariableSelector. Read moresource§fn on_unassign_literal(&mut self, _literal: Literal)
fn on_unassign_literal(&mut self, _literal: Literal)
source§fn on_appearance_in_conflict_literal(&mut self, _literal: Literal)
fn on_appearance_in_conflict_literal(&mut self, _literal: Literal)
Literal appears in a conflict during conflict
analysis.source§impl VariableSelector<PropositionalVariable> for Vsids<PropositionalVariable>
impl VariableSelector<PropositionalVariable> for Vsids<PropositionalVariable>
source§fn select_variable(
&mut self,
context: &SelectionContext<'_>,
) -> Option<PropositionalVariable>
fn select_variable( &mut self, context: &SelectionContext<'_>, ) -> Option<PropositionalVariable>
None when all variables which have been passed to the
VariableSelector have been assigned. Otherwise it should return the variable to
branch on next.source§fn on_conflict(&mut self)
fn on_conflict(&mut self)
source§fn on_unassign_literal(&mut self, literal: Literal)
fn on_unassign_literal(&mut self, literal: Literal)
source§fn on_appearance_in_conflict_literal(&mut self, literal: Literal)
fn on_appearance_in_conflict_literal(&mut self, literal: Literal)
Literal appears in a conflict during conflict
analysis.source§fn is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
VariableSelector. Read moresource§fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
source§fn on_appearance_in_conflict_integer(&mut self, _variable: DomainId)
fn on_appearance_in_conflict_integer(&mut self, _variable: DomainId)
Auto Trait Implementations§
impl<Var> Freeze for Vsids<Var>
impl<Var> RefUnwindSafe for Vsids<Var>where
Var: RefUnwindSafe,
impl<Var> Send for Vsids<Var>where
Var: Send,
impl<Var> Sync for Vsids<Var>where
Var: Sync,
impl<Var> Unpin for Vsids<Var>where
Var: Unpin,
impl<Var> UnwindSafe for Vsids<Var>where
Var: UnwindSafe,
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> 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