pub fn propagate_arithmetic(
op: &Operator,
parent: &Interval,
left_child: &Interval,
right_child: &Interval,
) -> Result<Option<(Interval, Interval)>>
Expand description
This function refines intervals left_child
and right_child
by applying
constraint propagation through parent
via operation. The main idea is
that we can shrink ranges of variables x and y using parent interval p.
Assuming that x,y and p has ranges [xL, xU]
, [yL, yU]
, and [pL, pU]
, we
apply the following operations:
- For plus operation, specifically, we would first do
[xL, xU]
<- ([pL, pU]
-[yL, yU]
) ∩[xL, xU]
, and then[yL, yU]
<- ([pL, pU]
-[xL, xU]
) ∩[yL, yU]
.
- For minus operation, specifically, we would first do
[xL, xU]
<- ([yL, yU]
+[pL, pU]
) ∩[xL, xU]
, and then[yL, yU]
<- ([xL, xU]
-[pL, pU]
) ∩[yL, yU]
.
- For multiplication operation, specifically, we would first do
[xL, xU]
<- ([pL, pU]
/[yL, yU]
) ∩[xL, xU]
, and then[yL, yU]
<- ([pL, pU]
/[xL, xU]
) ∩[yL, yU]
.
- For division operation, specifically, we would first do
[xL, xU]
<- ([yL, yU]
*[pL, pU]
) ∩[xL, xU]
, and then[yL, yU]
<- ([xL, xU]
/[pL, pU]
) ∩[yL, yU]
.