(self)
| 62 | } |
| 63 | |
| 64 | fn cardinality(self) -> Result<usize, CombinatorialOptimizationError> { |
| 65 | self.validate()?; |
| 66 | let span = i128::from(self.upper) - i128::from(self.lower); |
| 67 | let step = i128::from(self.step); |
| 68 | let count = span / step + 1; |
| 69 | usize::try_from(count).map_err(|_| { |
| 70 | CombinatorialOptimizationError::InvalidInput("variable cardinality does not fit usize") |
| 71 | }) |
| 72 | } |
| 73 | |
| 74 | fn values(self) -> Result<Vec<i64>, CombinatorialOptimizationError> { |
| 75 | self.validate()?; |
no test coverage detected