<div><br></div>Thanks&nbsp;Edson &nbsp;for a quick response.<div><br></div><div>Actually our requirement is to have our own custom rule builder which will use drools as a rule engine behind. So we are using Drools API to create the drl. since the end-user who models a rule is a business guy it is difficult to ask him to manage the dependencies. In this case it may not be possible for us to know when to update a fact. Initially we were by default adding modify() block to update the facts for every rule. In this case if more than one rule is eligible to fire then its going into a loop firing all the rules again and again in a loop. Is there a way we can handle this requirement.<br>
<div>Below is the sample rule that we created which ran into loop through drools API&nbsp;</div><div><div>rule &quot;PolicyTierClassification&quot;</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 &gt;= 285 , weight &lt; 327 , height == &quot;6ft 6in&quot; , gender == &quot;Male&quot; )</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>modify(healthInsuredbindings){setPolicyTier(&quot;Standard II&quot;)};</div>
<div>list.add(&quot;To determine tier based on insured gender, height and weight(weight&gt;=285 , weight&lt;327 , height==6ft 6in , gender==Male ) -&gt; (PolicyTier = Standard II)&quot;); end</div><div><br></div></div><div>
<br><br><div class="gmail_quote">On Fri, Jan 9, 2009 at 8:27 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>&nbsp;&nbsp; Sudhir:<br><br>&nbsp;&nbsp; In Rete, you must tell the engine a fact has changed, either by using a modify() block (recommended), or update() or property listeners.<br><br>&nbsp;&nbsp; LEAPS is a different algorithm that was originally maintained by a community user that long ago abandoned it. It is no longer included in the drools distribution.<br>

<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2009/1/9 Sudhir M <span dir="ltr">&lt;<a href="mailto:sudhir.cse@gmail.com" target="_blank">sudhir.cse@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">
<div><div></div><div class="Wj3C7c">
Hi All,<div><br></div><div>I don&#39;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 &nbsp;one rule makes the other rule eligible to fire but I don&#39;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 style="font-weight:bold"><span style="color:rgb(255, 0, 0)">rule &quot;PolicyTierClassification&quot;</span></span></div>


<div><span style="white-space:pre">        </span> no-loop true</div><div><span style="white-space:pre">        </span> when</div><div><span style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( weight &gt;= 134 , weight &lt; 157 , height == &quot;4ft 10in&quot; , gender == &quot;Male&quot; )</div>


<div><br></div><div><span style="white-space:pre">        </span> then</div><div><span style="white-space:pre">                </span>healthInsuredbindings.setPolicyTier(&quot;Standard I&quot;);</div>
<div><br></div><div><span style="white-space:pre">                </span>System.out.println(&quot;PolicyTierClassification&quot;);</div><div>list.add(&quot;To determine tier based on insured gender, height and weight(weight&gt;=134 , weight&lt;157 , height==4ft 10in , gender==Male ) -&gt; (PolicyTier = Standard I)&quot;); ;end</div>


<div><br></div><div><span style="font-weight:bold"><span style="color:rgb(255, 0, 0)">rule &quot;AlcoholConsumptionClassRule&quot;</span></span></div><div><span style="white-space:pre">        </span> no-loop true</div>
<div><span style="white-space:pre">        </span> when</div><div><span style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( alcoholConsumptionFrequencyPerWeek == &quot;2-3&quot; )</div>
<div><br></div><div><span style="white-space:pre">        </span> then</div><div>healthInsuredbindings.setAlcoholConsumptionClass(&quot;B&quot;);</div><div>&nbsp;System.out.println(&quot;AlcoholConsumptionClassRule&quot;);<br>
</div><div>list.add(&quot;To derive the alcohol consumption class based on consumption frequencyalcoholConsumptionFrequencyPerWeek==2-3 -&gt; (AlcoholConsumptionClass = B)&quot;); end</div><div><br></div><div><br></div><div>


<span style="color:rgb(255, 0, 0)"><span style="font-weight:bold">rule &quot;UnderwritingFactorRule&quot;</span></span></div><div><span style="white-space:pre">        </span> no-loop true</div>
<div><span style="white-space:pre">        </span> when</div><div><span style="white-space:pre">                </span>healthInsuredbindings : HealthInsured( alcoholConsumptionClass ==&quot;B&quot; )</div>
<div><br></div><div><span style="white-space:pre">        </span> then</div><div><span style="white-space:pre">        </span> healthInsuredbindings.setUnderwritingFactor(1);</div><div><span style="white-space:pre">        </span> System.out.println(&quot;UnderwritingFactorRule&quot;);</div>


<div>&nbsp;&nbsp; &nbsp; list.add(&quot;To derive UnderwritingFactor from &nbsp;alcoholConsumptionClass==B -&gt; (UnderwritingFactor = 1)&quot;);end</div><div><br></div><div>this my initial fact&nbsp;HealthInsured healthInsured = new HealthInsured();</div>


<div><span style="white-space:pre">                        </span>healthInsured.setAge(25);<br></div><div><span style="white-space:pre">                        </span>healthInsured.setGender(&quot;Male&quot;);</div><div>
<span style="white-space:pre">                        </span>healthInsured.setWeight(140);</div><div><span style="white-space:pre">                        </span>healthInsured.setHeight(&quot;4ft 10in&quot;);</div><div>
<span style="white-space:pre">                        </span>healthInsured.setTobaccoUser(&quot;No&quot;);</div><div><span style="white-space:pre">                        </span>healthInsured.setMotorcycleRider(&quot;No&quot;);</div>
<div><span style="white-space:pre">                        </span>healthInsured.setRelationToInsured(&quot;Insured&quot;);</div><div><span style="white-space:pre">                        </span>healthInsured.setUnderwritingFactor(0);</div>
<div><span style="white-space:pre">                        </span>healthInsured.setPolicyTier(&quot;Preferred&quot;);</div><div><span style="white-space:pre">                        </span>healthInsured.setAlcoholConsumptionFrequencyPerWeek(&quot;2-3&quot;);</div>


<div><span style="white-space:pre">                        </span>healthInsured.setAlcoholConsumptionClass(&quot;A&quot;);</div><div>Based on the above fact <span style="color:rgb(255, 0, 0);font-weight:bold">PolicyTierClassification,&nbsp;AlcoholConsumptionClassRule </span>are eligible &nbsp;to fire.&nbsp;<span style="font-weight:bold"><span style="color:rgb(255, 0, 0)">AlcoholConsumptionClassRule</span></span> &nbsp;is setting a property alcoholConsumptionClass to B based on which<span style="font-weight:bold">&nbsp;</span><span style="font-weight:bold"><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 style="font-weight:bold"><span style="color:rgb(204, 0, 0)">update </span></span>in&nbsp;&nbsp;<span style="color:rgb(255, 0, 0);font-weight:bold">AlcoholConsumptionClassRule &nbsp;</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.&nbsp;</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&nbsp;<span style="color:rgb(255, 0, 0);font-weight:bold">UnderwritingFactorRule </span><span style="color:rgb(255, 0, 0)">&nbsp;</span>rule &nbsp;also fired<span style="font-weight:bold">.</span></div>


<div><span style="font-weight:bold"><br></span></div><div><span style="font-weight:bold">Thanks in Advance,</span></div><div><span style="font-weight:bold"><br>
</span></div><div><span style="font-weight:bold">sudhir.</span></div><div><br></div></div>
<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>

</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br></div></div>