pub struct VariableState<Atomic: AtomicConstraint> { /* private fields */ }Expand description
The domains of all variables in the problem.
Domains are initially unbounded. This is why bounds are represented as IntExt.
Domains can be reduced through VariableState::apply. By default, the domain of every
variable is infinite.
Implementations§
Source§impl<Atomic> VariableState<Atomic>where
Atomic: AtomicConstraint,
impl<Atomic> VariableState<Atomic>where
Atomic: AtomicConstraint,
Sourcepub fn prepare_for_conflict_check(
premises: impl IntoIterator<Item = Atomic>,
consequent: Option<Atomic>,
) -> Result<Self, Atomic::Identifier>
pub fn prepare_for_conflict_check( premises: impl IntoIterator<Item = Atomic>, consequent: Option<Atomic>, ) -> Result<Self, Atomic::Identifier>
Create a variable state that applies all the premises and, if present, the negation of the consequent.
If premises /\ !consequent contain mutually exclusive atomic constraints (e.g., [x >= 5] and [x <= 2]) then None is returned.
An InferenceChecker will receive a VariableState that conforms to this description.
Sourcepub fn domains<'this>(
&'this self,
) -> impl Iterator<Item = &'this Atomic::Identifier> + 'thiswhere
Atomic::Identifier: 'this,
pub fn domains<'this>(
&'this self,
) -> impl Iterator<Item = &'this Atomic::Identifier> + 'thiswhere
Atomic::Identifier: 'this,
The domains for which at least one atomic is applied.
Sourcepub fn lower_bound(&self, identifier: &Atomic::Identifier) -> IntExt
pub fn lower_bound(&self, identifier: &Atomic::Identifier) -> IntExt
Get the lower bound of a variable.
Sourcepub fn upper_bound(&self, identifier: &Atomic::Identifier) -> IntExt
pub fn upper_bound(&self, identifier: &Atomic::Identifier) -> IntExt
Get the upper bound of a variable.
Sourcepub fn contains(&self, identifier: &Atomic::Identifier, value: i32) -> bool
pub fn contains(&self, identifier: &Atomic::Identifier, value: i32) -> bool
Tests whether the given value is in the domain of the variable.
Sourcepub fn holes<'a>(
&'a self,
identifier: &Atomic::Identifier,
) -> impl Iterator<Item = i32> + 'awhere
Atomic::Identifier: 'a,
pub fn holes<'a>(
&'a self,
identifier: &Atomic::Identifier,
) -> impl Iterator<Item = i32> + 'awhere
Atomic::Identifier: 'a,
Get the holes within the lower and upper bound of the variable expression.
Sourcepub fn fixed_value(&self, identifier: &Atomic::Identifier) -> Option<i32>
pub fn fixed_value(&self, identifier: &Atomic::Identifier) -> Option<i32>
Get the fixed value of this variable, if it is fixed.
Sourcepub fn iter_domain<'a>(
&'a self,
identifier: &Atomic::Identifier,
) -> Option<DomainIterator<'a>>where
Atomic::Identifier: 'a,
pub fn iter_domain<'a>(
&'a self,
identifier: &Atomic::Identifier,
) -> Option<DomainIterator<'a>>where
Atomic::Identifier: 'a,
Obtain an iterator over the domain of the variable.
If the domain is unbounded, then None is returned.
Trait Implementations§
Source§impl<Atomic: Clone + AtomicConstraint> Clone for VariableState<Atomic>where
Atomic::Identifier: Clone,
impl<Atomic: Clone + AtomicConstraint> Clone for VariableState<Atomic>where
Atomic::Identifier: Clone,
Source§fn clone(&self) -> VariableState<Atomic>
fn clone(&self) -> VariableState<Atomic>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more