Skip to main content

Predicate

Struct Predicate 

Source
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

Source

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.

Source

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]));
Source

pub fn get_predicate_type(&self) -> PredicateType

Source§

impl Predicate

Trait Implementations§

Source§

impl AtomicConstraint for Predicate

Source§

type Identifier = DomainId

The type of identifier used for variables.
Source§

fn identifier(&self) -> <Predicate as AtomicConstraint>::Identifier

The identifier of this atomic constraint.
Source§

fn comparison(&self) -> Comparison

The Comparison used for this atomic constraint.
Source§

fn value(&self) -> i32

The value on the right-hand side of this atomic constraint.
Source§

fn negate(&self) -> Predicate

The strongest atomic constraint that is mutually exclusive with self.
Source§

impl<Var> CheckerVariable<Predicate> for AffineView<Var>
where Var: IntegerVariable,

Source§

fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool

Tests whether the given atomic is a statement over the variable self.
Source§

fn atomic_less_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_greater_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self == value].
Source§

fn atomic_not_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self != value].
Source§

fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the lower bound of the domain.
Source§

fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the upper bound of the domain.
Source§

fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>

Get the value the variable is fixed to, if the variable is fixed.
Source§

fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool

Returns whether the value is in the domain.
Source§

fn induced_holes<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> impl Iterator<Item = i32> + 'state
where 'this: 'state,

Get the holes in the domain.
Source§

fn iter_induced_domain<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> Option<impl Iterator<Item = i32> + 'state>
where 'this: 'state,

Iterate the domain of the variable. Read more
Source§

impl CheckerVariable<Predicate> for DomainId

Source§

fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool

Tests whether the given atomic is a statement over the variable self.
Source§

fn atomic_less_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_greater_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self == value].
Source§

fn atomic_not_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self != value].
Source§

fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the lower bound of the domain.
Source§

fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the upper bound of the domain.
Source§

fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>

Get the value the variable is fixed to, if the variable is fixed.
Source§

fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool

Returns whether the value is in the domain.
Source§

fn induced_holes<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> impl Iterator<Item = i32> + 'state
where 'this: 'state,

Get the holes in the domain.
Source§

fn iter_induced_domain<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> Option<impl Iterator<Item = i32> + 'state>
where 'this: 'state,

Iterate the domain of the variable. Read more
Source§

impl CheckerVariable<Predicate> for Literal

Source§

fn does_atomic_constrain_self(&self, atomic: &Predicate) -> bool

Tests whether the given atomic is a statement over the variable self.
Source§

fn atomic_less_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_greater_than(&self, value: i32) -> Predicate

Get the atomic constraint [self <= value].
Source§

fn atomic_not_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self != value].
Source§

fn atomic_equal(&self, value: i32) -> Predicate

Get the atomic constraint [self == value].
Source§

fn induced_lower_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the lower bound of the domain.
Source§

fn induced_upper_bound( &self, variable_state: &VariableState<Predicate>, ) -> IntExt

Get the upper bound of the domain.
Source§

fn induced_fixed_value( &self, variable_state: &VariableState<Predicate>, ) -> Option<i32>

Get the value the variable is fixed to, if the variable is fixed.
Source§

fn induced_domain_contains( &self, variable_state: &VariableState<Predicate>, value: i32, ) -> bool

Returns whether the value is in the domain.
Source§

fn induced_holes<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> impl Iterator<Item = i32> + 'state
where 'this: 'state,

Get the holes in the domain.
Source§

fn iter_induced_domain<'this, 'state>( &'this self, variable_state: &'state VariableState<Predicate>, ) -> Option<impl Iterator<Item = i32> + 'state>
where 'this: 'state,

Iterate the domain of the variable. Read more
Source§

impl Clone for Predicate

Source§

fn clone(&self) -> Predicate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Predicate

Source§

impl Debug for Predicate

Source§

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

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

impl Display for Predicate

Source§

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

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

impl Eq for Predicate

Source§

impl Extend<Predicate> for PropositionalConjunction

Source§

fn extend<T>(&mut self, iter: T)
where T: IntoIterator<Item = Predicate>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl From<Predicate> for PropositionalConjunction

Source§

fn from(predicate: Predicate) -> PropositionalConjunction

Converts to this type from the input type.
Source§

impl From<Predicate> for PredicateType

Source§

fn from(value: Predicate) -> PredicateType

Converts to this type from the input type.
Source§

impl FromIterator<Predicate> for PropositionalConjunction

Source§

fn from_iter<T>(iter: T) -> PropositionalConjunction
where T: IntoIterator<Item = Predicate>,

Creates a value from an iterator. Read more
Source§

impl Hash for Predicate

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Not for Predicate

Source§

type Output = Predicate

The resulting type after applying the ! operator.
Source§

fn not(self) -> <Predicate as Not>::Output

Performs the unary ! operation. Read more
Source§

impl Ord for Predicate

Source§

fn cmp(&self, other: &Predicate) -> Ordering

See Predicate for details on the order.

1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Predicate

Source§

fn eq(&self, other: &Predicate) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Predicate

Source§

fn partial_cmp(&self, other: &Predicate) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Predicate

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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<Value> Statistic for Value
where Value: Display,

Source§

fn log(&self, statistic_logger: StatisticLogger)

Logs the Statistic using the provided StatisticLogger.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.