Re: [rules-users] optimization on a lot of simple rules
by Greg Barton
Now this finally rises to something that needs rules. :) In all of the previous examples you've given you could just have a Map<ProductKey,Handler> where the Handler looks like this:
interface Handler {
void handle(Product product, Decision decision);
}
...and the ProductKey consists of properties that uniquely identify how the Product is handled. So, on it's own, that functionality did not require rules.
However, now that you've introduced more complex decisions, with varying data, to affect the Decision for each Property type, rules are more appropriate.
Is there any reason why you only have one of each object type in memory at one time? Maybe if you state more of the problem requirements we can help you better.
--- On Mon, 7/20/09, nesta <nesta.fdb(a)163.com> wrote:
> From: nesta <nesta.fdb(a)163.com>
> Subject: Re: [rules-users] optimization on a lot of simple rules
> To: rules-users(a)lists.jboss.org
> Date: Monday, July 20, 2009, 4:14 AM
>
> Thanks very much.
> But if for every rule, there is one algorithm or discount
> which means that
> result has nothing related with Product's id and usage. I
> can't merge all
> rules in one rule. At the same time, besides Product and
> Decision fact type,
> there are more fact types.
> For example:
> rule 1
> when
> Decision()
> Subscriber(gender ==
> "male" or "female")
> Service(name ==
> "ftp" or "http")
> Product(id == 1)
> ......
> then
> ......
> end
> rule 2
> when
> Decision()
> Subscriber(gender ==
> "male" or "female")
> Service(name ==
> "ftp" or "http")
> Product(id == 2)
> ......
> then
> ......
> end
>
> .....
> .....
>
> In this scenario, if there are 1000 rules, there will
> be a lot of JoinNode.
> But in runtime, there is only one Decision instance, one
> Subscriber instance
> and Service instance.
>
> If I define all data in one fact type, I think that there
> are not a lot of
> JoinNodes.
>
> Is there any other method?
>
>
>
> Wolfgang Laun-2 wrote:
> >
> > Well, what is the realtion between id, usage and the
> result that's to be
> > stored in a Decision or a global?
> >
> > Typically, such rules could be written as
> >
> > rule x
> > no-loop true
> > when
> > $d : Decision()
> > $p :Product( id == 1, $usage :
> usage )
> > then
> > compute/store value, depending
> on the formula for id == 1 (using
> > usage)
> > end
> > // similar rule for id == 2,3,...
> >
> > If value is a straightforward function of id (and
> usage), then implement a
> > function compValue and use a single rule, e.g.:
> >
> > rule x
> > no-loop true
> > when
> > $d : Decision()
> > Product( $id : id, $usage :
> usage)
> > then
> > modify $d value to compValue( $id, $usage
> )
> >
> > Distinguishing all individual combinations of id and
> usage on the LHS
> > seems
> > excessive.
> >
> > The ordering of CEs also affects execution times.
> >
> > -W
> >
> > On 7/20/09, nesta <nesta.fdb(a)163.com>
> wrote:
> >>
> >>
> >> In this scenario, there are 1000 products,
> different product has
> >> different
> >> price, besides this, the price is affected by
> usage. I want to use
> >> Product.id to match the rules.
> >>
> >> As you mentioned "The crude duplication of rules
> where only the constant
> >> to
> >> be matched with
> >> Product.id varies can, most likely, be avoided."
> >>
> >> How to avoid it in this scenario?
> >>
> >>
> >> Wolfgang Laun-2 wrote:
> >> >
> >> > It's difficult to suggest an optimized form
> for your rules 1-infinity,
> >> > since
> >> > we do not know what you want to achieve.
> >> >
> >> > The crude duplication of rules where only the
> constant to be matched
> >> with
> >> > Product.id varies can, most likely, be
> avoided.
> >> >
> >> > -W
> >> >
> >> >
> >> >
> >> > On Sun, Jul 19, 2009 at 3:15 PM, nesta <nesta.fdb(a)163.com>
> wrote:
> >> >
> >> >>
> >> >> Hi,
> >> >>
> >> >> I am a newbie in drools. There are a lot
> of simple rules in a
> >> scenario.
> >> >> For example
> >> >> rule 1
> >> >> when
> >> >> Product( id
> ==1, usage == 1)
> >> >> $decision :
> Decision()
> >> >> then
> >> >>
> $decision.setValue(1);
> >> >> end
> >> >>
> >> >> rule 2
> >> >> when Product( id ==2, usage == 1)
> >> >> $decision : Decision()
> >> >> rule 3
> >> >> when Product( id ==3, usage == 1)
> >> >> $decision : Decision()
> >> >> rule 4
> >> >> when Product( id ==4, usage == 1)
> >> >> $decision : Decision()
> >> >> rule 5
> >> >> when Product( id ==5, usage == 1)
> >> >> $decision : Decision()
> >> >> ......
> >> >>
> >> >> I have a Product fact whose id = 5 and
> usage = 1, in my first
> >> thinking,
> >> >> only
> >> >> rule 5 is matched, there should be not
> much more different between 1
> >> rule
> >> >> and a lot of rules in runtime.
> >> >>
> >> >> But the result shows that they are
> different. More rules will cost
> >> more
> >> >> time. If there are 1 thousand rules, some
> Node and Sink will execute 1
> >> >> thousand times.
> >> >>
> >> >> My question is how to optimize this
> scenario?
> >> >> --
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24...
> >> >> Sent from the drools - user mailing list
> archive at Nabble.com.
> >> >>
> >> >>
> _______________________________________________
> >> >> rules-users mailing list
> >> >> rules-users(a)lists.jboss.org
> >> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >> >>
> >> >
> >> >
> _______________________________________________
> >> > rules-users mailing list
> >> > rules-users(a)lists.jboss.org
> >> > https://lists.jboss.org/mailman/listinfo/rules-users
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24...
> >> Sent from the drools - user mailing list archive
> at Nabble.com.
> >>
> >> _______________________________________________
> >> rules-users mailing list
> >> rules-users(a)lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/rules-users
> >>
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users(a)lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context: http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24...
> Sent from the drools - user mailing list archive at
> Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
15 years, 5 months
big thanks
by Bagwell, Allen F
To the Drools Team:
We've been successfully using Drools 4.0.7 core as a replacement rule engine for a system that was in bad need of an upgrade. When the time came to update this system, we were faced with a daunting task. Our original COTS software that had a rule engine built into it was old, hard to work with, and no longer supported. We quickly figured out that the only real options available to replace this crucial component given our budget and time constraints was Drools or Jess. Although Jess was developed in our own company, Drools fit our needs more closely and was similar in syntax to our defunct rule engine software making it a lot easier to translate our existing rules.
I'm happy to say Drools has been an elegant replacement solution for us and fun to learn.
I just wanted to say thanks for all the hard work you guys have done.
Allen F. Bagwell
15 years, 5 months
Re: [rules-users] rules-users Digest, Vol 32, Issue 57
by G Rajesh
Rafael,
Thank you very much for response.
Unfortunately I could not proceed with the solution as described in the
URL's provided.
Solution provided in the example was for ear files. I could not locate a
solution in case of war file deployment.
Also I would like to mention that if I remove Drools library from the class
path, I am able to run at least my current web application.
Otherwise, if the drools library is in the class path I am unable to run
even the exisiting web application.
Thanks
G. Rajesh
----- Original Message -----
From: <rules-users-request(a)lists.jboss.org>
To: <rules-users(a)lists.jboss.org>
Sent: Saturday, July 18, 2009 9:30 PM
Subject: rules-users Digest, Vol 32, Issue 57
> Send rules-users mailing list submissions to
> rules-users(a)lists.jboss.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.jboss.org/mailman/listinfo/rules-users
> or, via email, send a message with subject or body 'help' to
> rules-users-request(a)lists.jboss.org
>
> You can reach the person managing the list at
> rules-users-owner(a)lists.jboss.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of rules-users digest..."
>
>
> Today's Topics:
>
> 1. Re: drools integration problem (Rafael Ribeiro)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 18 Jul 2009 12:02:40 -0300
> From: Rafael Ribeiro <rafaelri(a)gmail.com>
> Subject: Re: [rules-users] drools integration problem
> To: Rules Users List <rules-users(a)lists.jboss.org>
> Message-ID:
> <f97c67390907180802ke312efcke5a3933c1c512521(a)mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Rajesh,
>
> you probably have differente JDT CompilationResult classes on your
> classpath and also on JBoss classpath (I'd guess JBoss Tomcat instance
> uses
> JDT for compilation) . You'll need to configure a separate classloader for
> your application. Here you have the documentation:
> http://www.jboss.org/community/wiki/ClassLoadingConfiguration (Isolation
> with Overriding Server Classes) and an example
> http://www.junlu.com/msg/78287.html
>
> regards,
> Rafael Ribeiro
>
>
> 2009/7/18 G Rajesh <rajesh.chowdary(a)eageyouth.com>
>
>> Hi,
>>
>> I am new to Drools and trying to use Drools 5.0 run time.
>> I am using JBoss 4.2.2 and am trying to integrate drools into existing
>> web
>> application already deployed on JBoss 4.2.2.
>> I've downloaded drools eclipse plugin, copied features, plugins and
>> dependency jars into eclipse respective folders.
>>
>> I am able to successfully run rules on a standalone application.
>> I can deploy the application successfully, but when I browse the home
>> page(or any other thing) of the application, following is the error
>> message
>> thrown by Jboss.
>> Seems it is compiler conflict.
>>
>> Thanks in advance
>> G Rajesh
>>
>>
>> =====================================================
>> Following is the error Msg:
>> ===========================================================================
>>
>> java.lang.NoSuchMethodError:
>> org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
>>
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
15 years, 5 months
optimization on a lot of simple rules
by nesta
Hi,
I am a newbie in drools. There are a lot of simple rules in a scenario.
For example
rule 1
when
Product( id ==1, usage == 1)
$decision : Decision()
then
$decision.setValue(1);
end
rule 2
when Product( id ==2, usage == 1)
$decision : Decision()
rule 3
when Product( id ==3, usage == 1)
$decision : Decision()
rule 4
when Product( id ==4, usage == 1)
$decision : Decision()
rule 5
when Product( id ==5, usage == 1)
$decision : Decision()
......
I have a Product fact whose id = 5 and usage = 1, in my first thinking, only
rule 5 is matched, there should be not much more different between 1 rule
and a lot of rules in runtime.
But the result shows that they are different. More rules will cost more
time. If there are 1 thousand rules, some Node and Sink will execute 1
thousand times.
My question is how to optimize this scenario?
--
View this message in context: http://www.nabble.com/optimization-on-a-lot-of-simple-rules-tp24556724p24...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months
Using drools with a monitoring application with time based data
by Margasahayam, Rengarajan
Hi,
We have a requirement to have rules like
If (cpuusage > 75% and vmsize > 1GB) for 4 minutes
In our application, We would like to create actions based on the firing
of the rule.
Can this be achieved with drools expert engine? If so how?
Thanks
Rengarajan
15 years, 5 months
drools5.0 xml format tutorial?
by Abarna Ramachandran
Hi,
Are there any tutorial available for conversion of .drl files to xml
files.?
Please help me with conversion from .drl to xml format.
For example conversion of helloworld.drl
package org.drools.examples
import org.drools.examples.HelloWorldExample.Message;
global java.util.List list
rule "Hello World"
dialect "mvel"
when
m : Message( status == Message.HELLO, message : message )
then
System.out.println( message );
modify ( m ) { message = "Goodbyte cruel world",
status = Message.GOODBYE };
end
rule "Good Bye"
dialect "java"
when
Message( status == Message.GOODBYE, message : message )
then
System.out.println( message );
end
thanks
ABRA
15 years, 5 months
drools 5.0 .drl as an xml file
by Abarna Ramachandran
Hi
I am a newbie to drools. I would like to convert an existing .drl file in
drools2.0 format to drools5.0 format.
The existing file name is exmpldrools2.0.drl but it is in xml format.
But when i just convert the contents of it to drools5.0 xml format and try
to save it as exmpldrools5.0.drl and try to load the .drl file using
knowledgebuilder i get the error,
"[ERR 101] Line 1:0 no viable alternative at input '<' " . It throws error
in the first line which is <?xml version="1.0" encoding="UTF-8"?>.
Please help me solve this problem.
How do i use xml files instead of .drl files and load the rules?
thanks
ABRA
15 years, 5 months
drools integration problem
by G Rajesh
Hi,
I am new to Drools and trying to use Drools 5.0 run time.
I am using JBoss 4.2.2 and am trying to integrate drools into existing web application already deployed on JBoss 4.2.2.
I've downloaded drools eclipse plugin, copied features, plugins and dependency jars into eclipse respective folders.
I am able to successfully run rules on a standalone application.
I can deploy the application successfully, but when I browse the home page(or any other thing) of the application, following is the error message thrown by Jboss.
Seems it is compiler conflict.
Thanks in advance
G Rajesh
=====================================================
Following is the error Msg:
===========================================================================
java.lang.NoSuchMethodError: org.eclipse.jdt.internal.compiler.CompilationResult.getProblems()[Lorg/eclipse/jdt/core/compiler/IProblem;
15 years, 5 months
3rd International Rules Challenge - Call for Submissions
by Wolfgang Laun
[Our apologies if you receive duplicates of this posting]
Call for Submissions
3rd International Rules Challenge
at
RuleML-2009
co-located with the Business Rules Forum
November 5-7 2009, Las Vegas, Nevada, USA
http://2009.ruleml.org/challenge
**********************************************************************
* Latest News *
* 3rd Int. Rules Challenge - Open Call for Submissions *
* ------------------ *
* *
* Keynotes and special talks by *
* Sandro Hawke (W3C Contact) about W3C RIF *
* Donald Chapin (OMG BMI Chair) about OMG SBVR *
* Paul Vincent (TIBCO CTO) about CEP and Rules *
* Jans Aasman (Franz Inc. CEO) *
* Tutorials by *
* Christian Saint Marie (ILog/IBM) - W3C RIF Tutorial *
* Larry Goldberg and Babara von Halle - Decision Management *
* Mark Proctor (Drools) - Drools Tutorial *
* Guido Governatori (NICTA) - Business Process Compliance *
* RuleML in the top venues for scientific impact factor in CiteSeerX *
* Forthcoming RuleML special journal issue *
* Additional CEUR Proceedings for Rules Challenge papers *
* New categories in the Challenge with prestigious prizes *
* W3C Rule Interchange Format workshop (more information below) *
* OMG and industrial standards sessions, lunch panel on Web Rules *
* Student grants of the value of up to $1000 plus free registration *
* 20% RuleML-2009 Partner discounts - see registration page *
* *
* Super Early Bird Registration Deadline ends soon! *
* *
**********************************************************************
Open Call for Submissions to the 2009 Rules Challenge
============================================================================
The Rules Challenge is one of the highlights at RuleML-2009 with prestigious
prizes. Submissions of benchmarks/evaluations, demos, case studies / use
cases, experience reports, best practice solutions (e.g. design patterns,
reference architectures, models), rule-based implementations/ tools/
applications, demonstrations engineering methods, implementations of rule
standards (e.g. RuleML, RIF, SBVR, PRR, rule-based Event Processing
languages, BPMN+rules, BPEL+rules, ...), rules + industrial standards (e.g.
XBRL, MISMO, Accord, ...), and industrial problem statements are
particularly encouraged.
The participants of the Challenge have the opportunity to understand the
most current trend of rule technology and standard development through
highly interactive with the experts in this field.
Submission
============================================================================
In addition to your demo/hands-on/report/.. it is possible to submit
Challenge demo papers describing research, implementation, and technical
details of your submission. The peer-reviewed and selected papers will be
published in additional special Challenge proceedings (CEURS proceedings are
requested) along with the online publication of your demo in the highly
visible growing Rules Challenge pool. A selection of revised papers from the
Challenge will be resubmitted to a special issue of a journal.
Authors are invited to submit original contributions of practical relevance
and technical rigor in the field, benchmarks, evaluations, experience
reports and show case/use case demonstrations of effective, practical,
deployable rule-based technologies or applications in distributed
environments. Papers must be in English.
Demo papers submission website: http://www.easychair.org
Demo systems submission website: http://ruleml-challenge.cs.nccu.edu.tw
Please upload all submissions as PDF files in LNCS format
(http://www.springer.de/comp/lncs/authors.html). To ensure high quality,
submitted papers will be carefully peer-reviewed by 3 PC members based on
originality, significance, technical soundness, and clarity of exposition.
Submissions to the Rules Challenge 2009 consist of a demo paper of 4-8
pages, describing the demo show case, and a link to more information about
the demo/show case, e.g. a project site, an online demonstration, a
presentation about the demonstration, or a download site for the
demonstration. In case of product demos, the link can be password-protected:
please submit a password for anonymous login from any Web browser, giving us
the permission to pass the password on to 3 PC members.
Important Date
------------------
September 4th - submission deadline for demo papers and demo systems
September 15th - notification of accepted demo papers and demo systems
October 29th - submission deadline for demo systems only
**** MAKE RULEML-2009 YOUR SHOWCASE! ****
2009 Rules Challenge Program Committee
----------------------------------------
see Challenge website http://2009.ruleml.org/challenge
W3C RIF Workshop at RuleML-2009
============================================================================
The W3C Rule Interchange Format (RIF) Working Group (www.w3.org/2005/rules/)
has recently published 6 specifications for the W3C Rule Interchange Format
standard which includes a W3C RIF Production Rules Dialect (RIF-PRD) and a
W3C Basic Logic Dialect (RIF-BLD).
The mission of the Rule Interchange Format (RIF) Working Group is to produce
W3C recommendations for rules interchange languages. Next step will be the
call for implementations of RIF which might be demonstrated at the
RuleML-2009 W3C RIF Workshop. Upcoming future RIF dialects might address a
reaction rules dialect for rule-based complex event processing (CEP).
The new RIF standard is featured at the RuleML 2009 Conference in a W3C RIF
workshop in November 2009 (see http://2009.ruleml.org) with a keynote from
Sandro Hawke (W3C staff representative on the RIF WG) and a tutorial from
Christian de Sainte Marie (ILOG/IBM, co-chair of the RIF WG). There will be
also keynote by Paul Vincent (TIBCO CTO for Business Rules and CEP, EPTS-RA
WG Co-Chair) about "Why Rules Matter in Complex Event Processing... and vice
versa" and a keynote by Donald Chapin (co-chair of the OMG Business Modeling
& Integration Domain Task Force, co-chair OMG SBVR) about "Terminology: The
Semantic Foundation for an Organization's Executable Rules".
About RuleML-2009
============================================================================
This year, the 3rd International Symposium on Rules, Applications and
Interoperability (RuleML-2009) takes place in Las Vegas, Nevada, USA,
collocated with the 12th Business Rules Forum, the world's largest Business
Rules event. RuleML-2009 is devoted to practical distributed rule
technologies and rule-based applications. The International Symposium on
Rules, Applications and Interoperability has evolved from an annual series
of international workshops since 2002, international conferences in 2005 and
2006, and international symposia since 2007, and is now in the top 100
venues for scientific impact factor in CiteseerX
(http://citeseerx.ist.psu.edu/stats/venues).
Supported by
===================================================================
W3C, OMG, ACM, AAAI, ECCAI, IAAIL, ACM, Belgian Business Rules Forum MIT
Sloan CIO Symposium, EPTS, BPM Forum Belgium
Sponsored by
===================================================================
Franz Inc
NICTA (National ICT Australia) Ltd
Corporate Semantic Web
Logic Programming Associated Ltd
ruleCore
JBoss
Modelsystems Ltd
(sponsoring opportunities: http://www.defeasible.org/ruleml2009/sponsors)
===================================================================
15 years, 5 months
StatefulKnowledgeSession leaves threads running
by Rafael Ribeiro
Hi all,
I've downloaded Drools fusion sample and started to make some changes to
the code (first of all wipe out the UI so I can test it easier).
I tried to get to a minimal set so I can run a console main class and see
what happens but I am facing a strange behaviour.
As soon as I start pushing events into the WorkingMemoryEntryPoint
("StockTick stream") a Thread - not daemonized since it blocks shutdown from
ending - is spawned and this prevents my JVM from shutting down (obviously
if I call System.exit(0) it will but I am avoiding this).
I've tried both to halt and dispose the session that this entry point
belongs but with no success. Does anyone know how could I get rid of this
thread?
best regards,
--
View this message in context: http://www.nabble.com/StatefulKnowledgeSession-leaves-threads-running-tp2...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 5 months