(self)
| 72 | } |
| 73 | |
| 74 | fn values(self) -> Result<Vec<i64>, CombinatorialOptimizationError> { |
| 75 | self.validate()?; |
| 76 | let mut out = Vec::with_capacity(self.cardinality()?); |
| 77 | let mut current = self.lower; |
| 78 | while current <= self.upper { |
| 79 | out.push(current); |
| 80 | current = match current.checked_add(self.step) { |
| 81 | Some(next) => next, |
| 82 | None => break, |
| 83 | }; |
| 84 | } |
| 85 | if out.is_empty() { |
| 86 | return Err(CombinatorialOptimizationError::EmptyDomain); |
| 87 | } |
| 88 | Ok(out) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | #[derive(Debug, Clone, PartialEq, Eq)] |