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>
impl<'a> SelectionContext<'a>
pub fn new( assignments: &'a Assignments, rng: &'a mut dyn Random, ) -> SelectionContext<'a>
pub fn are_all_variables_assigned(&self) -> bool
Sourcepub fn random(&mut self) -> &mut dyn Random
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).
Sourcepub fn get_size_of_domain<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
pub fn get_size_of_domain<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
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.
Sourcepub fn lower_bound<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
pub fn lower_bound<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
Returns the lower bound of the provided IntegerVariable
Sourcepub fn upper_bound<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
pub fn upper_bound<Var>(&self, var: Var) -> i32where
Var: IntegerVariable,
Returns the upper bound of the provided IntegerVariable
Sourcepub fn contains<Var>(&self, var: Var, value: i32) -> boolwhere
Var: IntegerVariable,
pub fn contains<Var>(&self, var: Var, value: i32) -> boolwhere
Var: IntegerVariable,
Determines whether the provided value is in the domain of the provided IntegerVariable
Sourcepub fn is_integer_fixed<Var>(&self, var: Var) -> boolwhere
Var: IntegerVariable,
pub fn is_integer_fixed<Var>(&self, var: Var) -> boolwhere
Var: IntegerVariable,
Determines whether the provided IntegerVariable has a unit domain (i.e. a domain of size
1)
pub fn is_predicate_assigned(&self, predicate: Predicate) -> bool
Sourcepub fn get_domains(&self) -> DomainGeneratorIterator
pub fn get_domains(&self) -> DomainGeneratorIterator
Returns all currently defined [DomainId]s.
Trait Implementations§
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> 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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