33 * Copyright (c) "2025" . The DeepCausality Authors and Contributors. All Rights Reserved.
44 */
55
6- use crate :: { Causable , CausalityError , Evidence , NumericalValue , PropagatingEffect } ;
6+ use crate :: { Causable , CausalityError , NumericalValue , PropagatingEffect } ;
77
88/// Provides default implementations for reasoning over collections of `Causable` items.
99///
@@ -42,16 +42,16 @@ where
4242 /// to `Deterministic(false)`, the chain evaluation stops and returns that effect.
4343 ///
4444 /// # Arguments
45- /// * `evidence ` - A single `Evidence ` object (e.g., a Map or Graph) that all causes will use.
45+ /// * `effect ` - A single `PropagatingEffect ` object (e.g., a Map or Graph) that all causes will use.
4646 ///
4747 /// # Errors
4848 /// Returns a `CausalityError` if any cause in the chain produces a non-deterministic effect.
4949 fn evaluate_deterministic_propagation (
5050 & self ,
51- evidence : & Evidence ,
51+ effect : & PropagatingEffect ,
5252 ) -> Result < PropagatingEffect , CausalityError > {
5353 for cause in self . get_all_items ( ) {
54- let effect = cause. evaluate ( evidence ) ?;
54+ let effect = cause. evaluate ( effect ) ?;
5555
5656 // This function enforces a strict deterministic contract.
5757 match effect {
@@ -83,18 +83,18 @@ where
8383 /// of 1.0 and `false` as 0.0.
8484 ///
8585 /// # Arguments
86- /// * `evidence ` - A single `Evidence ` object that all causes will use.
86+ /// * `effect ` - A single `PropagatingEffect ` object that all causes will use.
8787 ///
8888 /// # Errors
8989 /// Returns a `CausalityError` if a `ContextualLink` is encountered.
9090 fn evaluate_probabilistic_propagation (
9191 & self ,
92- evidence : & Evidence ,
92+ effect : & PropagatingEffect ,
9393 ) -> Result < PropagatingEffect , CausalityError > {
9494 let mut cumulative_prob: NumericalValue = 1.0 ;
9595
9696 for cause in self . get_all_items ( ) {
97- let effect = cause. evaluate ( evidence ) ?;
97+ let effect = cause. evaluate ( effect ) ?;
9898
9999 match effect {
100100 PropagatingEffect :: Probabilistic ( p) => {
@@ -117,6 +117,12 @@ where
117117 "Encountered a ContextualLink in a probabilistic chain evaluation." . into ( ) ,
118118 ) ) ;
119119 }
120+ _ => {
121+ // Other variants are not handled in this mode.
122+ return Err ( CausalityError ( format ! (
123+ "evaluate_probabilistic_propagation encountered an unhandled effect: {effect:?}"
124+ ) ) ) ;
125+ }
120126 }
121127 }
122128
@@ -127,19 +133,19 @@ where
127133 /// probabilistic effects, aggregating them into a final effect.
128134 ///
129135 /// # Arguments
130- /// * `evidence ` - A single `Evidence ` object that all causes will use.
136+ /// * `effect ` - A single `PropagatingEffect ` object that all causes will use.
131137 ///
132138 /// # Errors
133139 /// Returns a `CausalityError` if a `ContextualLink` is encountered.
134140 fn evaluate_mixed_propagation (
135141 & self ,
136- evidence : & Evidence ,
142+ effect : & PropagatingEffect ,
137143 ) -> Result < PropagatingEffect , CausalityError > {
138144 // The chain starts as deterministically true. It can transition to probabilistic.
139145 let mut aggregated_effect = PropagatingEffect :: Deterministic ( true ) ;
140146
141147 for cause in self . get_all_items ( ) {
142- let current_effect = cause. evaluate ( evidence ) ?;
148+ let current_effect = cause. evaluate ( effect ) ?;
143149
144150 // Update the aggregated effect based on the current effect.
145151 aggregated_effect = match ( aggregated_effect, current_effect) {
0 commit comments