pumpkin_solver::branching::value_selection

Struct DynamicValueSelector

source
pub struct DynamicValueSelector<Var> { /* private fields */ }
Expand description

Similar to DynamicBrancher, this is a pass-along structure which should be used when a Sized object is required.

Implementations§

source§

impl<Var> DynamicValueSelector<Var>

source

pub fn new(selector: Box<dyn ValueSelector<Var>>) -> Self

Trait Implementations§

source§

impl<Var> Debug for DynamicValueSelector<Var>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Var> ValueSelector<Var> for DynamicValueSelector<Var>

source§

fn select_value( &mut self, context: &mut SelectionContext<'_>, decision_variable: Var, ) -> 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<'_>)

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 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.
source§

fn on_unassign_literal(&mut self, literal: Literal)

A function which is called after a Literal is unassigned during backtracking (i.e. when it was fixed but is no longer), specifically, it provides literal which is the Literal which has been reset. This method could thus be called multiple times in a single backtracking operation by the solver.
source§

fn is_restart_pointless(&mut self) -> bool

This method returns whether a restart is currently pointless for the ValueSelector. Read more

Auto Trait Implementations§

§

impl<Var> Freeze for DynamicValueSelector<Var>

§

impl<Var> !RefUnwindSafe for DynamicValueSelector<Var>

§

impl<Var> !Send for DynamicValueSelector<Var>

§

impl<Var> !Sync for DynamicValueSelector<Var>

§

impl<Var> Unpin for DynamicValueSelector<Var>

§

impl<Var> !UnwindSafe for DynamicValueSelector<Var>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V