Re: [rules-users] Understanding Rules Firing Sequence
The learning is : for your case, where all your row in your table have an implicit priority and business logic, yes, don't hope that drools engine will guess that by itself. As far i understand, you expect the rules to trigger from top to bottom (or most specific to less), and stop when a rule has fired. Your problem is that you have a lot of rules with shared conditions which have different (and conflicting) actions. Using "specificity" strategy is a good idea (never tried, but it looks great), but that won't prevent other (less "specific") rules to fired after the first specific rules has fired. In addition to "specific" strategy, you have to add a condition to test if your "fees" field is set or not. If you add a common column (you can hide it under guvnor) that test "fees == null", then the first rule exec (so the most specific one) will set this field and prevent other rules to fire. So, please let drools manage the rules firing, but tune your rules/facts to fit your specific business logic, under drools (or any other expert-system) constraints. - Mail original - De: "tanug" À: rules-users@lists.jboss.org Envoyé: Mardi 28 Août 2012 13:44:25 Objet: Re: [rules-users] Understanding Rules Firing Sequence Thanks everyone for your suggestions. so, basically, the learning is : I should not leave rule firing to Drools, and have a proper priority and exit condition. And, I cannot rely on "specificity" for rule selection (i was so hoping it would work) Thanks again, best regards Tanu -- View this message in context: http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019416.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Rules Firing Sequence
Thanks everyone for your suggestions. so, basically, the learning is : I should not leave rule firing to Drools, and have a proper priority and exit condition. And, I cannot rely on "specificity" for rule selection (i was so hoping it would work) Thanks again, best regards Tanu -- View this message in context: http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019416.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Rules Firing Sequence
Assuming the row number indicates the sequence of your rules add the salience attribute and have it "use reverse row numbers". Then add an additional constraint that checks that "fee" has not been set; e.g. "navclass( fees > -1 )" or "navclass( hasFeeBeenSet == false )" As you have it now, all rules that match the given data will execute, so in your example "txntype==buy" matches rule 6 too. You cannot control the order rules' RHS execute with the same salience value (default is 0). If you only add salience but not the additional check that "fee" has not been set you will be able to control the order the rules' RHS execute but not prevent later rules from firing after the earlier ones. With kind regards, Mike On 28 August 2012 10:38, tanug wrote: > Hello, > > Attached here is the complete screenshot of the decision table. > > i am not using salience, so all rules should have same salience of 0 > > I understand that in such cases, the conflict resolution strategy is > 'specificity'. > > But for the following case, when i run test scenario with following values: > family == mehta > clientid == shailesh > portfolio == exe > txntype == buy > scrip == acc > i get the rule firing sequence as 7-9-8 and 6 and I get 10 in my fees > variable. > > but if I remove rule 6, the rules get fired in the following order - 7-9-8 > and I get 100 in my fees variable. > This second case shows that it is indeed following the specificity rule. > > Is it possible to know what conflict resolution strategy is being used in > guvnor? in eclipse? > > http://drools.46999.n3.nabble.com/file/n4019414/Capture4.png > > Many thanks in advance > > Tanu > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019414.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Rules Firing Sequence
Hello, Attached here is the complete screenshot of the decision table. i am not using salience, so all rules should have same salience of 0 I understand that in such cases, the conflict resolution strategy is 'specificity'. But for the following case, when i run test scenario with following values: family == mehta clientid == shailesh portfolio == exe txntype == buy scrip == acc i get the rule firing sequence as 7-9-8 and 6 and I get 10 in my fees variable. but if I remove rule 6, the rules get fired in the following order - 7-9-8 and I get 100 in my fees variable. This second case shows that it is indeed following the specificity rule. Is it possible to know what conflict resolution strategy is being used in guvnor? in eclipse? http://drools.46999.n3.nabble.com/file/n4019414/Capture4.png Many thanks in advance Tanu -- View this message in context: http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019414.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Rules Firing Sequence
The image is not complete, so I can not see the conditions and actions you are using. If you insert a fact that matches all the rules, then all of them are going to be executed in certain order determined by the resolution strategy algorithm you mentioned. Changing the resolution strategy algorithm is no a so common task. It is preferable to write the rules in a way they don't have inconsistencies. Best Regards, Esteban Aliverti - Blog @ http://ilesteban.wordpress.com On Tue, Aug 28, 2012 at 8:17 AM, tanug wrote: > The conflict resolution strategy has 'specificity' one of the rules. > According to which I should have got a 100 or 120. > > Please help me understand this. > If there is some recommended reading for the same, that would also be > helpful. > > Another question is - how can I view/change the conflict resolution > strategy > in Guvnor? > > > > > > -- > View this message in context: > http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019410.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > ___ > rules-users mailing list > rules-users@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
Re: [rules-users] Understanding Rules Firing Sequence
The conflict resolution strategy has 'specificity' one of the rules. According to which I should have got a 100 or 120. Please help me understand this. If there is some recommended reading for the same, that would also be helpful. Another question is - how can I view/change the conflict resolution strategy in Guvnor? -- View this message in context: http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409p4019410.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
[rules-users] Understanding Rules Firing Sequence
Hello, I am trying to understand the logic of firing of rules. I have the given rules without any salience, so all rules are at the same priority. http://drools.46999.n3.nabble.com/file/n4019409/Capture3.png When I fire a rule with values of shailesh, exe, mehta and buy I get the fees as 10. I was expecting a value of either 100 or 120, as maximum conditions match with these two rules. please explain why would this happen. Also, is there a way to determine out of 100 or 120, which value should have come? -- View this message in context: http://drools.46999.n3.nabble.com/Understanding-Rules-Firing-Sequence-tp4019409.html Sent from the Drools: User forum mailing list archive at Nabble.com. ___ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users