pub struct Predicate { /* private fields */ }Expand description
Representation of a domain operation, also known as an atomic constraint. It is a triple
(DomainId, PredicateType, value).
To create a Predicate, use Predicate::new or the more concise predicate! macro.
§Order
Predicates have a well-defined order. They are first ordered by the domain, and then by
predicate type, and finally by the value. The order is chosen such that for a fixed domain x,
predicates are ordered as follows:
[>= 5], [>= 7], [!= 2], [!= 3], [== 5], [!= 7], [<= 6], [<= 10]
From the order, we get the lower-bound predicates first, ordered by non-decreasing bound, then the (not-)equal predicates, ordered by non-decreasing bound, then the upper-bound predicates, ordered by non-increasing bounds.
Implementations§
Source§impl Predicate
impl Predicate
Sourcepub fn new(id: DomainId, predicate_type: PredicateType, value: i32) -> Predicate
pub fn new(id: DomainId, predicate_type: PredicateType, value: i32) -> Predicate
Creates a new Predicate (also known as atomic constraint) which represents a domain
operation.
Sourcepub fn implies(&self, other: Predicate) -> bool
pub fn implies(&self, other: Predicate) -> bool
Returns true if self implies other.
§Example
let x = DomainId::new(0);
assert!(predicate![x >= 5].implies(predicate![x >= 3]));
assert!(predicate![x >= 5].implies(predicate![x != 1]));
assert!(predicate![x == 5].implies(predicate![x <= 5]));pub fn get_predicate_type(&self) -> PredicateType
Source§impl Predicate
impl Predicate
pub fn is_equality_predicate(&self) -> bool
pub fn is_lower_bound_predicate(&self) -> bool
pub fn is_upper_bound_predicate(&self) -> bool
pub fn is_not_equal_predicate(&self) -> bool
Sourcepub fn get_domain(&self) -> DomainId
pub fn get_domain(&self) -> DomainId
pub fn get_right_hand_side(&self) -> i32
pub fn trivially_true() -> Predicate
pub fn trivially_false() -> Predicate
Trait Implementations§
Source§impl AtomicConstraint for Predicate
impl AtomicConstraint for Predicate
Source§type Identifier = DomainId
type Identifier = DomainId
Source§fn identifier(&self) -> <Predicate as AtomicConstraint>::Identifier
fn identifier(&self) -> <Predicate as AtomicConstraint>::Identifier
Source§fn comparison(&self) -> Comparison
fn comparison(&self) -> Comparison
Comparison used for this atomic constraint.Source§impl<Var> CheckerVariable<Predicate> for AffineView<Var>where
Var: IntegerVariable,
impl<Var> CheckerVariable<Predicate> for AffineView<Var>where
Var: IntegerVariable,
Source§fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
self.Source§fn atomic_less_than(&self, value: i32) -> Predicate
fn atomic_less_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_greater_than(&self, value: i32) -> Predicate
fn atomic_greater_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_equal(&self, value: i32) -> Predicate
fn atomic_equal(&self, value: i32) -> Predicate
[self == value].Source§fn atomic_not_equal(&self, value: i32) -> Predicate
fn atomic_not_equal(&self, value: i32) -> Predicate
[self != value].Source§fn induced_lower_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_upper_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_fixed_value(
&self,
variable_state: &VariableState<Predicate>,
) -> Option<i32>
fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>
Source§fn induced_domain_contains(
&self,
variable_state: &VariableState<Predicate>,
value: i32,
) -> bool
fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool
Source§fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
Source§fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
Source§impl CheckerVariable<Predicate> for DomainId
impl CheckerVariable<Predicate> for DomainId
Source§fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
self.Source§fn atomic_less_than(&self, value: i32) -> Predicate
fn atomic_less_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_greater_than(&self, value: i32) -> Predicate
fn atomic_greater_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_equal(&self, value: i32) -> Predicate
fn atomic_equal(&self, value: i32) -> Predicate
[self == value].Source§fn atomic_not_equal(&self, value: i32) -> Predicate
fn atomic_not_equal(&self, value: i32) -> Predicate
[self != value].Source§fn induced_lower_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_upper_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_fixed_value(
&self,
variable_state: &VariableState<Predicate>,
) -> Option<i32>
fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>
Source§fn induced_domain_contains(
&self,
variable_state: &VariableState<Predicate>,
value: i32,
) -> bool
fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool
Source§fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
Source§fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
Source§impl CheckerVariable<Predicate> for Literal
impl CheckerVariable<Predicate> for Literal
Source§fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool
self.Source§fn atomic_less_than(&self, value: i32) -> Predicate
fn atomic_less_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_greater_than(&self, value: i32) -> Predicate
fn atomic_greater_than(&self, value: i32) -> Predicate
[self <= value].Source§fn atomic_not_equal(&self, value: i32) -> Predicate
fn atomic_not_equal(&self, value: i32) -> Predicate
[self != value].Source§fn atomic_equal(&self, value: i32) -> Predicate
fn atomic_equal(&self, value: i32) -> Predicate
[self == value].Source§fn induced_lower_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_upper_bound(
&self,
variable_state: &VariableState<Predicate>,
) -> IntExt
fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt
Source§fn induced_fixed_value(
&self,
variable_state: &VariableState<Predicate>,
) -> Option<i32>
fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>
Source§fn induced_domain_contains(
&self,
variable_state: &VariableState<Predicate>,
value: i32,
) -> bool
fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool
Source§fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
fn induced_holes<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> impl Iterator<Item = i32> + 'statewhere
'this: 'state,
Source§fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
fn iter_induced_domain<'this, 'state>(
&'this self,
variable_state: &'state VariableState<Predicate>,
) -> Option<impl Iterator<Item = i32> + 'state>where
'this: 'state,
impl Copy for Predicate
impl Eq for Predicate
Source§impl Extend<Predicate> for PropositionalConjunction
impl Extend<Predicate> for PropositionalConjunction
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Predicate>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = Predicate>,
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl From<Predicate> for PropositionalConjunction
impl From<Predicate> for PropositionalConjunction
Source§fn from(predicate: Predicate) -> PropositionalConjunction
fn from(predicate: Predicate) -> PropositionalConjunction
Source§impl From<Predicate> for PredicateType
impl From<Predicate> for PredicateType
Source§fn from(value: Predicate) -> PredicateType
fn from(value: Predicate) -> PredicateType
Source§impl FromIterator<Predicate> for PropositionalConjunction
impl FromIterator<Predicate> for PropositionalConjunction
Source§fn from_iter<T>(iter: T) -> PropositionalConjunctionwhere
T: IntoIterator<Item = Predicate>,
fn from_iter<T>(iter: T) -> PropositionalConjunctionwhere
T: IntoIterator<Item = Predicate>,
Source§impl Ord for Predicate
impl Ord for Predicate
Source§impl PartialOrd for Predicate
impl PartialOrd for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnsafeUnpin for Predicate
impl UnwindSafe for Predicate
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
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§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 moreSource§impl<Value> Statistic for Valuewhere
Value: Display,
impl<Value> Statistic for Valuewhere
Value: Display,
Source§fn log(&self, statistic_logger: StatisticLogger)
fn log(&self, statistic_logger: StatisticLogger)
Statistic using the provided StatisticLogger.