Hi All,<div><br></div><div>I don't know whether I have encountered a strange problem or my understanding of drools is wrong.</div><div><br></div><div>I have 3 rules out of which two are dependent. Between the dependent ones one rule makes the other rule eligible to fire but I don't know why the dependent rule is not firing. Below are the rules I have written.</div>
<div><div>package com.valueMomentum;</div><div>import com.valuemomentum.eligibilitymodel.oo.*;</div><div>import java.util.ArrayList;</div><div>global java.util.ArrayList list;</div><div><br></div><div><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">rule "PolicyTierClassification"</span></span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> no-loop true</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( weight >= 134 , weight < 157 , height == "4ft 10in" , gender == "Male" )</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>healthInsuredbindings.setPolicyTier("Standard I");</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println("PolicyTierClassification");</div><div>list.add("To determine tier based on insured gender, height and weight(weight>=134 , weight<157 , height==4ft 10in , gender==Male ) -> (PolicyTier = Standard I)"); ;end</div>
<div><br></div><div><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">rule "AlcoholConsumptionClassRule"</span></span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> no-loop true</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( alcoholConsumptionFrequencyPerWeek == "2-3" )</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div><div>healthInsuredbindings.setAlcoholConsumptionClass("B");</div><div> System.out.println("AlcoholConsumptionClassRule");<br>
</div><div>list.add("To derive the alcohol consumption class based on consumption frequencyalcoholConsumptionFrequencyPerWeek==2-3 -> (AlcoholConsumptionClass = B)"); end</div><div><br></div><div><br></div><div>
<span class="Apple-style-span" style="color: rgb(255, 0, 0);"><span class="Apple-style-span" style="font-weight: bold;">rule "UnderwritingFactorRule"</span></span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> no-loop true</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( alcoholConsumptionClass =="B" )</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> healthInsuredbindings.setUnderwritingFactor(1);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> System.out.println("UnderwritingFactorRule");</div>
<div> list.add("To derive UnderwritingFactor from alcoholConsumptionClass==B -> (UnderwritingFactor = 1)");end</div><div><br></div><div>this my initial fact HealthInsured healthInsured = new HealthInsured();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setAge(25);<br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setGender("Male");</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setWeight(140);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setHeight("4ft 10in");</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setTobaccoUser("No");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setMotorcycleRider("No");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setRelationToInsured("Insured");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setUnderwritingFactor(0);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setPolicyTier("Preferred");</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setAlcoholConsumptionFrequencyPerWeek("2-3");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>healthInsured.setAlcoholConsumptionClass("A");</div><div>Based on the above fact <span class="Apple-style-span" style="color: rgb(255, 0, 0); font-weight: bold; ">PolicyTierClassification, AlcoholConsumptionClassRule </span>are eligible to fire. <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">AlcoholConsumptionClassRule</span></span> is setting a property alcoholConsumptionClass to B based on which<span class="Apple-style-span" style="font-weight: bold;"> </span><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="color: rgb(255, 0, 0);">UnderwritingFactorRule </span></span>rule becomes eligible fire but in this case the dependent rule is not firing. I think we can use <span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="color: rgb(204, 0, 0);">update </span></span>in <span class="Apple-style-span" style="color: rgb(255, 0, 0); font-weight: bold; ">AlcoholConsumptionClassRule </span>but I think if we have to manage those dependencies it will be more error prone and the results are might be more inconsistent. </div>
<div><br></div><div>I have tested it Using RETEOO in drools 3.x and 4.x which yields me the same results. But when I used LEAPS algorithm then i even got the dependent rule i.e <span class="Apple-style-span" style="color: rgb(255, 0, 0); font-weight: bold; ">UnderwritingFactorRule </span><span class="Apple-style-span" style="color: rgb(255, 0, 0); "> </span>rule also fired<span class="Apple-style-span" style="font-weight: bold; ">.</span></div>
<div><span class="Apple-style-span" style="font-weight: bold;"><br></span></div><div><span class="Apple-style-span" style="font-weight: bold;">Thanks in Advance,</span></div><div><span class="Apple-style-span" style="font-weight: bold;"><br>
</span></div><div><span class="Apple-style-span" style="font-weight: bold;">sudhir.</span></div><div><br></div></div>