@@ -75,15 +75,49 @@ pub trait PhysicalExpr: Send + Sync + Display + Debug + PartialEq<dyn Any> {
75
75
children : Vec < Arc < dyn PhysicalExpr > > ,
76
76
) -> Result < Arc < dyn PhysicalExpr > > ;
77
77
78
- /// Computes bounds for the expression using interval arithmetic.
78
+ /// Computes the output interval for the expression, given the input
79
+ /// intervals.
80
+ ///
81
+ /// # Arguments
82
+ ///
83
+ /// * `children` are the intervals for the children (inputs) of this
84
+ /// expression.
85
+ ///
86
+ /// # Example
87
+ ///
88
+ /// If the expression is `a + b`, and the input intervals are `a: [1, 2]`
89
+ /// and `b: [3, 4]`, then the output interval would be `[4, 6]`.
79
90
fn evaluate_bounds ( & self , _children : & [ & Interval ] ) -> Result < Interval > {
80
91
not_impl_err ! ( "Not implemented for {self}" )
81
92
}
82
93
83
- /// Updates/shrinks bounds for the expression using interval arithmetic.
94
+ /// Updates bounds for child expressions, given a known interval for this
95
+ /// expression.
96
+ ///
97
+ /// This is used to propagate constraints down through an
98
+ /// expression tree.
99
+ ///
100
+ /// # Arguments
101
+ ///
102
+ /// * `interval` is the currently known interval for this expression.
103
+ /// * `children` are the current intervals for the children of this expression
104
+ ///
105
+ /// # Returns
106
+ ///
107
+ /// A Vec of new intervals for the children, in order.
108
+ ///
84
109
/// If constraint propagation reveals an infeasibility, returns [None] for
85
- /// the child causing infeasibility. If none of the children intervals
86
- /// change, may return an empty vector instead of cloning `children`.
110
+ /// the child causing infeasibility.
111
+ ///
112
+ /// If none of the child intervals change as a result of propagation, may
113
+ /// return an empty vector instead of cloning `children`.
114
+ ///
115
+ /// # Example
116
+ ///
117
+ /// If the expression is `a + b`, the current `interval` is `[4, 5] and the
118
+ /// inputs are given [`a: [0, 2], `b: [-∞, 4]]`, then propagation would
119
+ /// would return `[a: [0, 2], b: [2, 4]]` as `b` must be at least 2 to
120
+ /// make the output at least `4`.
87
121
fn propagate_constraints (
88
122
& self ,
89
123
_interval : & Interval ,
0 commit comments