pub enum Domain {
Range {
min: i64,
max: i64,
},
Explicit(BTreeSet<i64>),
}Expand description
Representation of possible integer values for a decision variable.
Variants§
Range
Range-bounded domain [min, max].
Space complexity: O(1).
Explicit(BTreeSet<i64>)
Explicit set of discrete values stored as a sorted BTreeSet or Sparse Set representation. Space complexity: O(D) where D is domain size.
Implementations§
Source§impl Domain
impl Domain
Sourcepub fn from_values<I: IntoIterator<Item = i64>>(values: I) -> Self
pub fn from_values<I: IntoIterator<Item = i64>>(values: I) -> Self
Creates an explicit domain from an iterator of integer values.
§Complexity
Time: O(N log N) where N is number of elements. Space: O(N).
Sourcepub fn contains(&self, val: i64) -> bool
pub fn contains(&self, val: i64) -> bool
Checks if a value is contained in the domain.
§Complexity
Time: O(1) for Range, O(log N) for Explicit.
Sourcepub fn min(&self) -> Option<i64>
pub fn min(&self) -> Option<i64>
Returns the minimum value in the domain, or None if empty.
§Complexity
Time: O(1) for Range, O(log N) for Explicit.
Sourcepub fn max(&self) -> Option<i64>
pub fn max(&self) -> Option<i64>
Returns the maximum value in the domain, or None if empty.
§Complexity
Time: O(1) for Range, O(log N) for Explicit.
Sourcepub fn remove(&mut self, val: i64) -> bool
pub fn remove(&mut self, val: i64) -> bool
Removes a value from the domain. Returns true if the domain was modified.
§Complexity
Time: O(1) / O(N) depending on representation conversion.
Sourcepub fn remove_below(&mut self, min_val: i64) -> bool
pub fn remove_below(&mut self, min_val: i64) -> bool
Prunes values below min_val. Returns true if modified.
§Complexity
Time: O(1) for Range, O(K log N) for Explicit where K is number of removed elements.
Sourcepub fn remove_above(&mut self, max_val: i64) -> bool
pub fn remove_above(&mut self, max_val: i64) -> bool
Prunes values above max_val. Returns true if modified.
§Complexity
Time: O(1) for Range, O(K log N) for Explicit where K is number of removed elements.