pub enum Domain {
FiniteDomain {
values: HashSet<i64>,
},
Interval {
lower: f64,
upper: f64,
},
Boolean,
Enumeration {
values: HashSet<String>,
},
}Expand description
A constraint domain specifies the set of possible values for variables.
Variants§
FiniteDomain
Finite domain: discrete set of integers
Interval
Interval domain: continuous range [lower, upper]
Boolean
Boolean domain: {true, false}
Enumeration
Enumeration: finite set of symbolic values
Implementations§
Source§impl Domain
impl Domain
Sourcepub fn finite_domain(values: Vec<i64>) -> Self
pub fn finite_domain(values: Vec<i64>) -> Self
Create a finite domain from a vector of integers.
Sourcepub fn range(range: RangeInclusive<i64>) -> Self
pub fn range(range: RangeInclusive<i64>) -> Self
Create a finite domain from a range.
Sourcepub fn enumeration(values: Vec<String>) -> Self
pub fn enumeration(values: Vec<String>) -> Self
Create an enumeration domain.
Sourcepub fn contains_int(&self, value: i64) -> bool
pub fn contains_int(&self, value: i64) -> bool
Check if a value is in the domain.
Sourcepub fn remove_value(&mut self, value: i64) -> bool
pub fn remove_value(&mut self, value: i64) -> bool
Remove a value from the domain.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Domain
impl<'de> Deserialize<'de> for Domain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Domain
Auto Trait Implementations§
impl Freeze for Domain
impl RefUnwindSafe for Domain
impl Send for Domain
impl Sync for Domain
impl Unpin for Domain
impl UnwindSafe for Domain
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
Mutably borrows from an owned value. Read more