pub struct SolutionGuidedValueSelector<Var, Value, BackUpSelector> { /* private fields */ }Expand description
The solution-guided [1] ValueSelector, this method searches around the provided solution.
It does this by saving the values found in the solution and assigning to those values
whenever possible, if it is not possible then it will fall back on the provided
backup_selector.
§Bibliography
[1] E. Demirović, G. Chu, and P. J. Stuckey, ‘Solution-based phase saving for CP: A value-selection heuristic to simulate local search behavior in complete solvers’, in Principles and Practice of Constraint Programming: 24th International Conference, CP 2018, Lille, France, August 27-31, 2018, Proceedings 24, 2018, pp. 99–108.
Implementations§
source§impl<BackupSelector> SolutionGuidedValueSelector<PropositionalVariable, bool, BackupSelector>where
BackupSelector: ValueSelector<PropositionalVariable>,
impl<BackupSelector> SolutionGuidedValueSelector<PropositionalVariable, bool, BackupSelector>where
BackupSelector: ValueSelector<PropositionalVariable>,
pub fn new( variables: &[PropositionalVariable], variables_with_initial_value: Vec<(PropositionalVariable, bool)>, backup_selector: BackupSelector, ) -> Self
Trait Implementations§
source§impl<Var: Debug, Value: Debug, BackUpSelector: Debug> Debug for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
impl<Var: Debug, Value: Debug, BackUpSelector: Debug> Debug for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
source§impl<BackupSelector> ValueSelector<PropositionalVariable> for SolutionGuidedValueSelector<PropositionalVariable, bool, BackupSelector>where
BackupSelector: ValueSelector<PropositionalVariable>,
impl<BackupSelector> ValueSelector<PropositionalVariable> for SolutionGuidedValueSelector<PropositionalVariable, bool, BackupSelector>where
BackupSelector: ValueSelector<PropositionalVariable>,
source§fn select_value(
&mut self,
context: &mut SelectionContext<'_>,
decision_variable: PropositionalVariable,
) -> Predicate
fn select_value( &mut self, context: &mut SelectionContext<'_>, decision_variable: PropositionalVariable, ) -> Predicate
Determines which value in the domain of
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_solution(&mut self, solution: SolutionReference<'_>)
fn on_solution(&mut self, solution: SolutionReference<'_>)
This method is called when a solution is found; either when iterating over all solutions in
the case of a satisfiable problem or on solutions of increasing quality when solving an
optimisation problem.
source§fn is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
This method returns whether a restart is currently pointless for the
ValueSelector. Read moresource§fn on_unassign_literal(&mut self, _literal: Literal)
fn on_unassign_literal(&mut self, _literal: Literal)
source§fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
A function which is called after a
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.Auto Trait Implementations§
impl<Var, Value, BackUpSelector> Freeze for SolutionGuidedValueSelector<Var, Value, BackUpSelector>where
BackUpSelector: Freeze,
impl<Var, Value, BackUpSelector> RefUnwindSafe for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
impl<Var, Value, BackUpSelector> Send for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
impl<Var, Value, BackUpSelector> Sync for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
impl<Var, Value, BackUpSelector> Unpin for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
impl<Var, Value, BackUpSelector> UnwindSafe for SolutionGuidedValueSelector<Var, Value, BackUpSelector>
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> 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