tag:blogger.com,1999:blog-5869426.post2063282721065172788..comments2024-01-16T10:48:25.428+00:00Comments on Drools & jBPM: Sequential ReteMark Proctorhttp://www.blogger.com/profile/03304277188725220501noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-5869426.post-78583496781018334712021-04-01T09:05:43.720+01:002021-04-01T09:05:43.720+01:00If there is a huge number of rules a indexed paged...If there is a huge number of rules a indexed paged direct address table can be used in place of the array that holds the resulting Activations. Here we create pages of arrays, we create further index points to pages at regular points in the range. The page can indicate if any of its elements are populated or not, allow us to skip iterations of those elements. <a href="http://www.faisalabadfabricstore.com/suiting-collection/" rel="nofollow">stitched designer lawn suits</a> , <a href="http://www.faisalabadfabricstore.com/suiting-collection/" rel="nofollow">lawn frock design 2016</a> Darren Demershttps://www.blogger.com/profile/08050776248828465230noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-81958965183277921762007-08-09T12:22:00.000+01:002007-08-09T12:22:00.000+01:00Please use the mailing list for these types of que...Please use the mailing list for these types of questions, especially when they are not related to the blog article in question. the answer to your Q is one happens before the join data and one after, thus the inline-eval is slightly more efficient, also data must be time constant in inline-eval but not for eval.Mark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-32620201574598604772007-08-09T08:54:00.000+01:002007-08-09T08:54:00.000+01:00As in Drools version 4.0, we could use eval in Pat...As in Drools version 4.0, we could use eval in Pattern Descriptor itself.<BR/>Here is the sample drl.<BR/><BR/><BR/>package discounts<BR/>import com.test.Customer<BR/>import com.test.Employee<BR/><BR/>rule "NestedEval"<BR/> when<BR/> Employee:Employee()<BR/> Customer:Customer(eval(Employee.getName().equals(name + Employee.getCompanyName())))<BR/> then<BR/> Customer.setDiscountAvail(10);<BR/>end<BR/><BR/>rule "Eval"<BR/> when<BR/> Customer:Customer()<BR/> Employee:Employee()<BR/> eval(!Employee.getName().equals(Customer.getName() + Employee.getCompanyName()))<BR/> then<BR/> Customer.setDiscountAvail(5);<BR/>end<BR/><BR/>Would you please put your thoughts on the difference of these two rules?<BR/>And what is best way if we want to do calculation in WHEN part of RULE.<BR/><BR/>-Regards<BR/>Tarun Kumar SinghTarun Kumar Singhhttps://www.blogger.com/profile/02708817867820263691noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-78261932961147489402007-07-26T20:29:00.000+01:002007-07-26T20:29:00.000+01:00If you use eval your rules are neither declarative...If you use eval your rules are neither declarative or able to execute in a performant manner. The Pattern field constraint I showed you is orders of magnitudes faster than what you are trying. With the correct approach there should be no reason why you have to resort to evals.Mark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-54930750560911685502007-07-26T16:35:00.000+01:002007-07-26T16:35:00.000+01:00This comment has been removed by the author.Gaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-86195946210136894532007-07-26T16:33:00.000+01:002007-07-26T16:33:00.000+01:00This comment has been removed by the author.Gaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-88867695391452966062007-07-26T16:29:00.000+01:002007-07-26T16:29:00.000+01:00hi mark, thanks for you help. I have been research...hi mark,<BR/> thanks for you help. I have been researching on your work for the last year.<BR/>The reason I am using eval is, I am working on rule generation, and evaivalent ui to support it. UI is designed in way, a guy who is non technical i.e. business analyst can work on it with ease. I do have an idea to avoid, but i enter in trouble water when list comes into picture (while generation of rule automatically)<BR/><BR/>I have not used BRXML approach as you have used in the BRMS<BR/><BR/>Your thoughts will be source of inspiration for me.<BR/><BR/>Regards,<BR/>Gaurav MalhotraGaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-33028984485486049162007-07-26T12:22:00.000+01:002007-07-26T12:22:00.000+01:00StatelessSessions are not sequential as default, y...StatelessSessions are not sequential as default, you must turn them on. Either by the use of a property or a setter.<BR/><BR/>RuleBaseConfiguration conf = new RuleBaseConfiguration();<BR/>conf.setSequential(true);<BR/><BR/>RuleBase ruleBase = RuleBaseFactory.newRuleBase( conf );<BR/><BR/>Or in a rulebase.conf properties file in a META-INF directory somewhere, or a System property, you can add the property:<BR/>drools.sequential = true.<BR/><BR/>In sequential mode all rules are first evaluated, it does not evaluate each rule in turn. So it doesn't evaluate the first rule, modify the data and then evaluate the second rule. If you modify some data the next rule in the sequence will execute with that modified data, even if it's LHS is no longer true.<BR/><BR/>Why are you writing rules like this:<BR/>QuoteType:QuoteType()<BR/>eval(((QuoteType.getQuoteNumber().equals("abc"))))<BR/><BR/>this is much better, eval should be avoided, unless it's really needed:<BR/>when<BR/> $quoteType : QuoteType( quoteNumber == "abc" )<BR/>then<BR/>...<BR/><BR/>For further help please use the mailing lists:<BR/>http://labs.jboss.com/drools/lists.htmlMark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-73153070281107991622007-07-26T06:53:00.000+01:002007-07-26T06:53:00.000+01:00Hi Mark, Just a last thought. My last requirement ...Hi Mark,<BR/><BR/> Just a last thought. My last requirement is i want modified object to be propagated to the next rule but do not re firing of the rules.<BR/><BR/>Your thoughts!!<BR/><BR/>cheers,<BR/>GauravGaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-44982686981265177382007-07-26T06:51:00.000+01:002007-07-26T06:51:00.000+01:00Hi Mark,I also tried drl in the following waypacka...Hi Mark,<BR/><BR/>I also tried drl in the following way<BR/><BR/>package a<BR/><BR/>import test.QuoteType;<BR/><BR/>rule "a1"<BR/>no-loop true<BR/>salience 999999<BR/>when<BR/>QuoteType:QuoteType()<BR/>eval(<BR/>(<BR/>(QuoteType.getQuoteNumber().equals("abc"))<BR/>)<BR/>)<BR/>then<BR/>QuoteType.setVendorName(String.valueOf("vendor1"));<BR/>System.out.println("a1");<BR/><BR/>update(QuoteType);<BR/>end<BR/>rule "a2"<BR/>no-loop true<BR/>salience 999998<BR/>when<BR/>QuoteType:QuoteType()<BR/>eval (<BR/>(<BR/>(QuoteType.getVendorName().equals("vendor1"))<BR/>)<BR/>)<BR/>then<BR/>QuoteType.setDealerName(String.valueOf("dealer1"));<BR/>System.out.println("a2");<BR/>#update(QuoteType);<BR/>end<BR/><BR/>It worked this way<BR/><BR/>Thoughts!!!Gaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-727736887217671482007-07-26T06:45:00.000+01:002007-07-26T06:45:00.000+01:00Hi Mark, I am using a stateless session and using ...Hi Mark,<BR/><BR/> I am using a stateless session and using the following drl<BR/><BR/>package a<BR/><BR/>import test.QuoteType;<BR/><BR/>rule "a1"<BR/> no-loop true<BR/> salience 999999<BR/> when<BR/> QuoteType:QuoteType()<BR/> eval(<BR/> (<BR/> (QuoteType.getQuoteNumber().equals("abc"))<BR/> )<BR/> )<BR/> then<BR/> QuoteType.setVendorName(String.valueOf("vendor1"));<BR/> System.out.println("a1");<BR/> <BR/> update(QuoteType);<BR/>end<BR/>rule "a2"<BR/> no-loop true<BR/> salience 999998<BR/> when<BR/> QuoteType:QuoteType()<BR/> eval (<BR/> (<BR/> (QuoteType.getVendorName().equals("vendor1"))<BR/> )<BR/> )<BR/> then<BR/> QuoteType.setDealerName(String.valueOf("dealer1"));<BR/> System.out.println("a2");<BR/> update(QuoteType);<BR/>end<BR/><BR/><BR/>I am still facing the recursion problem, its not executing in a sequential manner.<BR/><BR/>Thoughts!!!Gaurav & Shikhahttps://www.blogger.com/profile/12627953743842016701noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-40206095330018000482007-07-06T17:17:00.000+01:002007-07-06T17:17:00.000+01:00At the moment we are finding the best scenarios a...At the moment we are finding the best scenarios are those involving large numbers of facts - say 50K - which gave us 350% increase over our standard Rete. As I understand it sequential only scales well for large numbers of rules, not facts? Small number of facts and large rules for our sequential has less dramatic increases, but it is still better than our standard Rete 30%+, suspect that's where node collapsing and more code generation will help.Mark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-30515533918068089512007-07-06T16:55:00.000+01:002007-07-06T16:55:00.000+01:00good work. now if only I had enough time to write ...good work. now if only I had enough time to write all the rules in the benchmark suite. if only I could go without sleep, it would get done sooner than later :)woolfelhttps://www.blogger.com/profile/13814445471254728002noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-67975567818332130712007-07-06T14:46:00.000+01:002007-07-06T14:46:00.000+01:00Oh and ofcourse the best thing is it still obeys a...Oh and ofcourse the best thing is it still obeys all the complex Conditional Elements, like 'not', 'exists', 'accumulate', 'collect' etc.Mark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.comtag:blogger.com,1999:blog-5869426.post-41786412361119739912007-07-06T14:42:00.000+01:002007-07-06T14:42:00.000+01:00So far performance increases, compared to our stan...So far performance increases, compared to our standard Rete, is 30% to 350%, depending on the complexity and quantity of rules and data. Node collapsing should really help give that another boost too. In a point release we will be adding a fire Limit to the engine, an integer saying the number of allowed rule executions, we can use this to exit network evaluation early - so users can say if the current ruleset results in 1, 3 or 10 firing rules.Mark Proctorhttps://www.blogger.com/profile/03304277188725220501noreply@blogger.com