pumpkin_solver::branching::variable_selection

Struct MostConstrained

source
pub struct MostConstrained<Var, TieBreaking> { /* private fields */ }
Expand description

A VariableSelector which selects the variable with the smallest domain (similar to FirstFail).

Ties are broken according to the number of attached constraints (giving priority to variable with more attached constraints).

Implementations§

source§

impl<Var: Copy + 'static> MostConstrained<Var, InOrderTieBreaker<Var, MostConstrainedValue>>

source

pub fn new(variables: &[Var], num_occurrences: &[u32]) -> Self

Trait Implementations§

source§

impl<Var, TieBreaking> Debug for MostConstrained<Var, TieBreaking>

source§

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

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

impl<TieBreaking> VariableSelector<DomainId> for MostConstrained<DomainId, TieBreaking>
where TieBreaking: TieBreaker<DomainId, MostConstrainedValue>,

source§

fn select_variable( &mut self, context: &SelectionContext<'_>, ) -> Option<DomainId>

Determines which variable to select next if there are any left to branch on. Should only return 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)

A function which is called after a conflict has been found and processed but (currently) does not provide any additional information.
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 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. This method could thus be called multiple times in a single backtracking operation by the solver.
source§

fn on_appearance_in_conflict_literal(&mut self, _literal: Literal)

A function which is called when a Literal appears in a conflict during conflict analysis.
source§

fn on_appearance_in_conflict_integer(&mut self, _variable: DomainId)

A function which is called when a variable appears in a conflict during conflict analysis.
source§

fn is_restart_pointless(&mut self) -> bool

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

Auto Trait Implementations§

§

impl<Var, TieBreaking> Freeze for MostConstrained<Var, TieBreaking>
where TieBreaking: Freeze,

§

impl<Var, TieBreaking> RefUnwindSafe for MostConstrained<Var, TieBreaking>
where TieBreaking: RefUnwindSafe, Var: RefUnwindSafe,

§

impl<Var, TieBreaking> Send for MostConstrained<Var, TieBreaking>
where TieBreaking: Send, Var: Send,

§

impl<Var, TieBreaking> Sync for MostConstrained<Var, TieBreaking>
where TieBreaking: Sync, Var: Sync,

§

impl<Var, TieBreaking> Unpin for MostConstrained<Var, TieBreaking>
where TieBreaking: Unpin, Var: Unpin,

§

impl<Var, TieBreaking> UnwindSafe for MostConstrained<Var, TieBreaking>
where TieBreaking: UnwindSafe, Var: UnwindSafe,

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