pub struct Literal { /* private fields */ }Implementations§
Source§impl Literal
impl Literal
Sourcepub fn new(domain_id: DomainId) -> Literal
pub fn new(domain_id: DomainId) -> Literal
Creates a new literal wrapping the provided DomainId.
Note: the provided domain_id should have a domain between 0 and 1.
pub fn get_integer_variable(&self) -> AffineView<DomainId>
pub fn get_true_predicate(&self) -> Predicate
pub fn get_false_predicate(&self) -> Predicate
Trait Implementations§
Source§impl IntegerVariable for Literal
impl IntegerVariable for Literal
Source§fn lower_bound(&self, assignment: &Assignments) -> i32
fn lower_bound(&self, assignment: &Assignments) -> i32
Returns the lower bound represented as a 0-1 value. Literals that evaluate to true have a lower bound of 1. Literal that evaluate to false have a lower bound of 0. Unassigned literals have a lower bound of 0.
Source§fn upper_bound(&self, assignment: &Assignments) -> i32
fn upper_bound(&self, assignment: &Assignments) -> i32
Returns the upper bound represented as a 0-1 value. Literals that evaluate to true have an upper bound of 1. Literal that evaluate to false have a upper bound of 0. Unassigned literals have a upper bound of 1.
Source§fn contains(&self, assignment: &Assignments, value: i32) -> bool
fn contains(&self, assignment: &Assignments, value: i32) -> bool
Returns whether the input value, when interpreted as a bool, can be considered for the literal. Literals that evaluate to true only contain value 1. Literals that evaluate to false only contain value 0. Unassigned literals contain both values 0 and 1.
type AffineView = AffineView<Literal>
Source§fn lower_bound_at_trail_position(
&self,
assignment: &Assignments,
trail_position: usize,
) -> i32
fn lower_bound_at_trail_position( &self, assignment: &Assignments, trail_position: usize, ) -> i32
Source§fn upper_bound_at_trail_position(
&self,
assignment: &Assignments,
trail_position: usize,
) -> i32
fn upper_bound_at_trail_position( &self, assignment: &Assignments, trail_position: usize, ) -> i32
Source§fn contains_at_trail_position(
&self,
assignment: &Assignments,
value: i32,
trail_position: usize,
) -> bool
fn contains_at_trail_position( &self, assignment: &Assignments, value: i32, trail_position: usize, ) -> bool
Source§fn iterate_domain(&self, assignment: &Assignments) -> impl Iterator<Item = i32>
fn iterate_domain(&self, assignment: &Assignments) -> impl Iterator<Item = i32>
Source§fn watch_all(&self, watchers: &mut Watchers<'_>, events: EnumSet<DomainEvent>)
fn watch_all(&self, watchers: &mut Watchers<'_>, events: EnumSet<DomainEvent>)
Source§fn unpack_event(&self, event: OpaqueDomainEvent) -> DomainEvent
fn unpack_event(&self, event: OpaqueDomainEvent) -> DomainEvent
fn watch_all_backtrack( &self, watchers: &mut Watchers<'_>, events: EnumSet<DomainEvent>, )
Source§fn get_holes_on_current_decision_level(
&self,
assignments: &Assignments,
) -> impl Iterator<Item = i32>
fn get_holes_on_current_decision_level( &self, assignments: &Assignments, ) -> impl Iterator<Item = i32>
Source§impl PredicateConstructor for Literal
impl PredicateConstructor for Literal
Source§fn lower_bound_predicate(&self, bound: Self::Value) -> Predicate
fn lower_bound_predicate(&self, bound: Self::Value) -> Predicate
[x >= v]).Source§fn upper_bound_predicate(&self, bound: Self::Value) -> Predicate
fn upper_bound_predicate(&self, bound: Self::Value) -> Predicate
[x <= v]).Source§fn equality_predicate(&self, bound: Self::Value) -> Predicate
fn equality_predicate(&self, bound: Self::Value) -> Predicate
[x == v]).Source§fn disequality_predicate(&self, bound: Self::Value) -> Predicate
fn disequality_predicate(&self, bound: Self::Value) -> Predicate
[x != v]).Source§impl TransformableVariable<AffineView<Literal>> for Literal
impl TransformableVariable<AffineView<Literal>> for Literal
Source§impl ValueSelector<Literal> for InDomainRandom
impl ValueSelector<Literal> for InDomainRandom
Source§fn select_value(
&mut self,
context: &mut SelectionContext<'_>,
decision_variable: Literal,
) -> Predicate
fn select_value( &mut self, context: &mut SelectionContext<'_>, decision_variable: Literal, ) -> Predicate
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 is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
ValueSelector. Read moreSource§fn subscribe_to_events(&self) -> Vec<BrancherEvent>
fn subscribe_to_events(&self) -> Vec<BrancherEvent>
Source§fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
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. Read moreSource§fn on_solution(&mut self, _solution: SolutionReference<'_>)
fn on_solution(&mut self, _solution: SolutionReference<'_>)
Source§impl VariableSelector<Literal> for InputOrder<Literal>
impl VariableSelector<Literal> for InputOrder<Literal>
Source§fn select_variable(
&mut self,
context: &mut SelectionContext<'_>,
) -> Option<Literal>
fn select_variable( &mut self, context: &mut SelectionContext<'_>, ) -> Option<Literal>
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 subscribe_to_events(&self) -> Vec<BrancherEvent>
fn subscribe_to_events(&self) -> Vec<BrancherEvent>
Source§fn on_conflict(&mut self)
fn on_conflict(&mut self)
Source§fn on_backtrack(&mut self)
fn on_backtrack(&mut self)
Source§fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
fn on_unassign_integer(&mut self, _variable: DomainId, _value: i32)
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. Read moreSource§fn on_appearance_in_conflict_predicate(&mut self, _predicate: Predicate)
fn on_appearance_in_conflict_predicate(&mut self, _predicate: Predicate)
Source§fn is_restart_pointless(&mut self) -> bool
fn is_restart_pointless(&mut self) -> bool
VariableSelector. Read moreimpl Copy for Literal
impl Eq for Literal
impl StructuralPartialEq for Literal
Auto Trait Implementations§
impl Freeze for Literal
impl RefUnwindSafe for Literal
impl Send for Literal
impl Sync for Literal
impl Unpin for Literal
impl UnwindSafe for Literal
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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