(n: usize, bounds: &WeightBounds)
| 441 | } |
| 442 | |
| 443 | fn build_bounds(n: usize, bounds: &WeightBounds) -> Result<Vec<(f64, f64)>, ClaError> { |
| 444 | match bounds { |
| 445 | WeightBounds::Tuple(lo, hi) => Ok(vec![(*lo, *hi); n]), |
| 446 | WeightBounds::Lists(low, high) => { |
| 447 | if low.len() != n || high.len() != n { |
| 448 | return Err(ClaError::DimensionMismatch); |
| 449 | } |
| 450 | Ok(low.iter().copied().zip(high.iter().copied()).collect()) |
| 451 | } |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | fn check_bounds_feasible(bounds: &[(f64, f64)]) -> Result<(), ClaError> { |
| 456 | let lower: f64 = bounds.iter().map(|b| b.0).sum(); |
no test coverage detected