oximo_core/domain.rs
1/// The domain of a variable, which determines the type of values it can take.
2///
3/// Real: any real number.
4/// Integer: any integer.
5/// Binary: 0 or 1.
6/// SemiContinuous: either 0 or any value >= threshold.
7/// SemiInteger: either 0 or any integer >= threshold.
8#[derive(Copy, Clone, Debug, Default, PartialEq)]
9pub enum Domain {
10 #[default]
11 Real,
12 Integer,
13 Binary,
14 SemiContinuous {
15 threshold: f64,
16 },
17 SemiInteger {
18 threshold: f64,
19 },
20}
21
22impl Domain {
23 /// Whether this domain is integer-valued (Integer, Binary, SemiInteger)
24 pub fn is_integer(self) -> bool {
25 matches!(self, Self::Integer | Self::Binary | Self::SemiInteger { .. })
26 }
27}