pub struct PhaseSaving<Var, Value: PartialEq> { /* private fields */ }Expand description
A ValueSelector which implements phase-saving.
During the search process, values of variables are saved whenever they are assigned and the search process will attempt to assign to these values whenever possible. After a variable has been fixed, its value will be saved as the previous value and the search will continue. Values can be frozen meaning that they will not be updated with the previously assigned value during the search process, provided initial values will always be frozen.
§Bibliography
[1] K. Pipatsrisawat and A. Darwiche, ‘A lightweight component caching scheme for satisfiability solvers’, in Theory and Applications of Satisfiability Testing–SAT 2007: 10th International Conference, Lisbon, Portugal, May 28-31, 2007. Proceedings 10, 2007, pp. 294–299.
Implementations§
source§impl PhaseSaving<PropositionalVariable, bool>
impl PhaseSaving<PropositionalVariable, bool>
sourcepub fn new(variables: &[PropositionalVariable]) -> Self
pub fn new(variables: &[PropositionalVariable]) -> Self
Creates a new instance of PhaseSaving over PropositionalVariables with false as
its default value.
source§impl<Var: StorageKey + Copy + PartialEq, Value: Copy + PartialEq> PhaseSaving<Var, Value>
impl<Var: StorageKey + Copy + PartialEq, Value: Copy + PartialEq> PhaseSaving<Var, Value>
sourcepub fn with_default_value(variables: &[Var], default_value: Value) -> Self
pub fn with_default_value(variables: &[Var], default_value: Value) -> Self
Constructor for creating the PhaseSaving ValueSelector with a default value;
the default value will be the selected value if no value is saved for the provided variable
sourcepub fn with_initial_values(
variables: &[Var],
variables_with_initial_value: Vec<(Var, Value)>,
default_value: Value,
) -> Self
pub fn with_initial_values( variables: &[Var], variables_with_initial_value: Vec<(Var, Value)>, default_value: Value, ) -> Self
Constructor for creating the PhaseSaving ValueSelector with initial values (and a
default value); if no value is saved then the provided initial value is selected and
otherwise the default value is selected.
It is possible to provide fewer values than number of variables but it is required that
every variable present in variables_with_initial_value is also present in variables.
Trait Implementations§
source§impl ValueSelector<PropositionalVariable> for PhaseSaving<PropositionalVariable, bool>
impl ValueSelector<PropositionalVariable> for PhaseSaving<PropositionalVariable, bool>
source§fn select_value(
&mut self,
_: &mut SelectionContext<'_>,
decision_variable: PropositionalVariable,
) -> Predicate
fn select_value( &mut self, _: &mut SelectionContext<'_>, decision_variable: PropositionalVariable, ) -> Predicate
decision_variable to branch next on.
The domain of the decision_variable variable should have at least 2 values in it (as it
otherwise should not have been selected as decision_variable). Returns a Predicate
specifying the required change in the domain.source§fn on_unassign_literal(&mut self, lit: Literal)
fn on_unassign_literal(&mut self, lit: Literal)
source§fn is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
ValueSelector. Read moresource§fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
DomainId is unassigned during backtracking (i.e. when
it was fixed but is no longer), specifically, it provides variable which is the
DomainId which has been reset and value which is the value to which the variable was
previously fixed. This method could thus be called multiple times in a single
backtracking operation by the solver.source§fn on_solution(&mut self, _solution: SolutionReference<'_>)
fn on_solution(&mut self, _solution: SolutionReference<'_>)
Auto Trait Implementations§
impl<Var, Value> Freeze for PhaseSaving<Var, Value>where
Value: Freeze,
impl<Var, Value> RefUnwindSafe for PhaseSaving<Var, Value>where
Value: RefUnwindSafe,
Var: RefUnwindSafe,
impl<Var, Value> Send for PhaseSaving<Var, Value>
impl<Var, Value> Sync for PhaseSaving<Var, Value>
impl<Var, Value> Unpin for PhaseSaving<Var, Value>
impl<Var, Value> UnwindSafe for PhaseSaving<Var, Value>where
Value: UnwindSafe,
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