Updates intervals for all expressions in the DAEG by successive bottom-up and top-down traversals.
(
&mut self,
leaf_bounds: &mut [(usize, Interval)],
given_range: Interval,
)
| 508 | /// Updates intervals for all expressions in the DAEG by successive |
| 509 | /// bottom-up and top-down traversals. |
| 510 | pub fn update_ranges( |
| 511 | &mut self, |
| 512 | leaf_bounds: &mut [(usize, Interval)], |
| 513 | given_range: Interval, |
| 514 | ) -> Result<PropagationResult> { |
| 515 | self.assign_intervals(leaf_bounds); |
| 516 | let bounds = self.evaluate_bounds()?; |
| 517 | // There are three possible cases to consider: |
| 518 | // (1) given_range ⊇ bounds => Nothing to propagate |
| 519 | // (2) ∅ ⊂ (given_range ∩ bounds) ⊂ bounds => Can propagate |
| 520 | // (3) Disjoint sets => Infeasible |
| 521 | if given_range.contains(bounds)? == Interval::TRUE { |
| 522 | // First case: |
| 523 | Ok(PropagationResult::CannotPropagate) |
| 524 | } else if bounds.contains(&given_range)? != Interval::FALSE { |
| 525 | // Second case: |
| 526 | let result = self.propagate_constraints(given_range); |
| 527 | self.update_intervals(leaf_bounds); |
| 528 | result |
| 529 | } else { |
| 530 | // Third case: |
| 531 | Ok(PropagationResult::Infeasible) |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | /// This function assigns given ranges to expressions in the DAEG. |
| 536 | /// The argument `assignments` associates indices of sought expressions |
no test coverage detected