pumpkin_solver::branching

Struct SelectionContext

Source
pub struct SelectionContext<'a> { /* private fields */ }
Expand description

The context provided to the Brancher, it allows the retrieval of domain values of variables and access to methods from a Random generator.

Implementations§

Source§

impl<'a> SelectionContext<'a>

Source

pub fn new( assignments_integer: &'a AssignmentsInteger, assignments_propositional: &'a AssignmentsPropositional, rng: &'a mut dyn Random, ) -> Self

Source

pub fn random(&mut self) -> &mut dyn Random

Returns a random generator which can be used to generate random values (see Random for more information).

Source

pub fn get_size_of_domain<Var: IntegerVariable>(&self, var: Var) -> i32

Returns the difference between the upper-bound and the lower-bound of the provided IntegerVariable. Note that this is different from the number of values which are in the domain of var since this calculation does not take into account holes in the domain.

Source

pub fn lower_bound<Var: IntegerVariable>(&self, var: Var) -> i32

Returns the lower bound of the provided IntegerVariable

Source

pub fn upper_bound<Var: IntegerVariable>(&self, var: Var) -> i32

Returns the upper bound of the provided IntegerVariable

Source

pub fn contains<Var: IntegerVariable>(&self, var: Var, value: i32) -> bool

Determines whether the provided value is in the domain of the provided IntegerVariable

Source

pub fn is_integer_fixed<Var: IntegerVariable>(&self, var: Var) -> bool

Determines whether the provided IntegerVariable has a unit domain (i.e. a domain of size 1)

Source

pub fn is_propositional_variable_fixed( &self, var: PropositionalVariable, ) -> bool

Determines whether the provided PropositionalVariable is assigned.

Source

pub fn is_propositional_variable_true(&self, var: PropositionalVariable) -> bool

Returns whether the provided PropositionalVariable is assigned to true.

Source

pub fn get_domains(&self) -> DomainGeneratorIterator

Returns all currently defined DomainIds.

Source

pub fn get_propositional_variables( &self, ) -> PropositionalVariableGeneratorIterator

Returns all currently defined PropositionalVariables.

Trait Implementations§

Source§

impl<'a> Debug for SelectionContext<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for SelectionContext<'a>

§

impl<'a> !RefUnwindSafe for SelectionContext<'a>

§

impl<'a> !Send for SelectionContext<'a>

§

impl<'a> !Sync for SelectionContext<'a>

§

impl<'a> Unpin for SelectionContext<'a>

§

impl<'a> !UnwindSafe for SelectionContext<'a>

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