(self)
| 50 | |
| 51 | impl IntegerVariable { |
| 52 | fn validate(self) -> Result<(), CombinatorialOptimizationError> { |
| 53 | if self.step <= 0 { |
| 54 | return Err(CombinatorialOptimizationError::InvalidInput("step must be > 0")); |
| 55 | } |
| 56 | if self.lower > self.upper { |
| 57 | return Err(CombinatorialOptimizationError::InvalidInput( |
| 58 | "variable lower bound must be <= upper bound", |
| 59 | )); |
| 60 | } |
| 61 | Ok(()) |
| 62 | } |
| 63 | |
| 64 | fn cardinality(self) -> Result<usize, CombinatorialOptimizationError> { |
| 65 | self.validate()?; |
no test coverage detected