Human Task Example
by Chuck Irvine
Hello. Is there a complete Human Task example that someone could point me
to? I'm looking for an example that uses the Eclipse task plugin to allow
users to complete tasks. Thanks! -Chuck
14 years, 11 months
confused on when to call fireAllRules
by Charles Binford
Hi, I'm trying to add some functionality to my 4.0.7 based project and
am realizing I don't understand some basics as well as I thought I did.
Until now, I've been using a very simple model: create session, insert
facts, fire rules, destroy session. My new functionality needs to use a
long lived session. I also may find the duration feature useful so I
searched through the examples and found the TroubleTicketExample. Now
what has be confused is that example shows rules firing AFTER control
has been returned from the fireAllRules() call. I tried to create
something similar - call fireAllRules, then call session.update(han,
obj) - but nothing happens. If I call fireAllRules again (after the
update) then my rule fires as expected. My test didn't use any
duration statement. Is that the magic in the TroubleTicketExample? If
so, then how does one have a clue as to whether one needs to call
fireAllRules after an update or not (i.e. no way to tell if a duration
rule is keeping it running)? Obviously I'm missing some basic
understanding here. Please enlighten me.
Thanks,
Charles Binford
14 years, 11 months
Better Performance and Maintainability?
by HonorGod
Hi,
Can someone plz help me understand performance and maintainability in the
following scenario - ?
I load tons of rows of data from database and store them in an object fact
model [POJO based] and apply the rules using decision tables and finally
persist data.
vs
I load tons of rows of data from database and store them in an object fact
model [HashMap - Key - Value] and apply the rules using decision tables and
finally persist data.
The difference in the above two scenarios is that one of them is pojo based
and the other is key-value pairs that are used on LHS of the decision
tables. When I use Key-Value approach I had to do lot of conversion in terms
converting the conditions into eval statements and validations but where as
the pojo approach is very straight forward and less validations.
Which approach gives me better performance and maintainability?
I would consider the following before I make a decision -
1 - size of data
2 - frequency at which the data changes [in terms of adding new conditions /
adding new columns / removal of new columns etc]
3 - re-usability
Thank You!
--
View this message in context: http://n3.nabble.com/Better-Performance-and-Maintainability-tp136941p1369...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
drools-solver recover the score of last step
by dmzpippo-drools@yahoo.it
Hi all,
is possible in a DRL file, useded for droos-solver, recover the score of last step?
I need it because with the rule I calculate a function score f(n); to diverrsificate the research if f(n) is bigger then f(n) of last step then add a penality...
regards
14 years, 11 months
Is this possible in Guvnor?
by HonorGod
Hi,
I have a single fact model with 5 [a1, a2,a3, a4, and a5] different
attributes. I have 3 decision tables in the following fashion
Decision Table 1
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a3 | a4 = a1+a3|
----------------------------------------------
Once I have the value of a4, I need to hit different set of rules which are
stored in second decision table
Decision Table 2
---------------------------------------------
condition | condition | condition | Action |
---------------------------------------------
a1 | a2 | a4 | a5 = a4 |
----------------------------------------------
Once I have the value of a5, I need to hit different set of rules which are
store in third decision table
Decision Table 3
------------------------------------------------------------------------
condition | condition | condition | condition | condition | Action
|
-------------------------------------------------------------------------
a1 | a2 | a3 | a4 | a5 |
computeValue() |
------------------------------------------------------------------------
I don't have any problem when I load the rules into individual KnowledgeBase
and fire the rules one after the other as follows -
<code>
// apply rules from decision table 1
StatefulKnowledgeSession kSession =
knowledgeBase1.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 2
kSession = knowledgeBase2.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
// apply rules from decision table 3
kSession = knowledgeBase3.newStatefulKnowledgeSession() ;
kSession.insert(caEventDO);
kSession.fireAllRules();
kSession.dispose() ;
</code>
But when I upload the decision tables into Guvnor and use the package / drl
from the package snapshot my second set of rules are not fired at all.
How do I resolve this issue?
Please help.
Thanks
--
View this message in context: http://n3.nabble.com/Is-this-possible-in-Guvnor-tp122132p122132.html
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
How do you know when all rules have finished
by drooler
Hi,
New to Drools. Could not find a specific answer to this, but it may be there
in the forum somewhere. I have written a rule set for testing the 'fitness'
of 3000 generations of organizms. The rules always test fitness against the
last dozen or so generations. So I need to start at generation 13 and then
when all rules have run against that generation and referencing the previous
12 I need to increment the 'current' generation so that it points at
generation 14. All rules are written relative to that current generation.
How do I know when to increment to the next generation as I need to be
certain that Drools has fired all the rules for the current generation?
Once I have done that, I have some modification objects to put in working
memory that influences the 'fitness' of the generations. These modification
objects have up to 5 parameters. I what to be able to vary these 5
parameters and retest. Rather than tweak them and re run the 3000
generations is there a way to use the Planner where different moves can
alter the 5 parameters and determine a score to measure whether the
modifications are enduring over many generations. In other words the score
does not relate to an individual generation but a lasting affect over many
generations.
Thx.
David
--
View this message in context: http://n3.nabble.com/How-do-you-know-when-all-rules-have-finished-tp13476...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Re: [rules-users] Using work items in the Eclipse ruleflow editor
by Jeremy Ary
Mike,
I ran into a similar issue when I began working with ruleflows a few weeks ago. Some of this may not be necessary and it's certainly not all causal, but this was what I noted when working my issue out:
1) If you're working in JBoss Dev Studio, it's possible that you have a conflict between the code you added as a runtime and what's already there, so try the process with a fresh install of eclipse
2) Ensure that any projects you currently have open do not have build/lib/classpath issues (I had the drools projects checked out and open and build errors caused unnecessary complications for me)
3) Be sure that your project has a META-INF on the classpath and that it's set up correctly
4) Place your drools.rulebase.conf & custom definitions .conf that it looks for are both in your META-INF under resources (src/main/resources/META-INF )
5) Once you're sure this much is correct, give Eclipse a restart - my project did not pick up my custom WI's until I restarted
If you're still having issues, I'll be on the IRC channel for the next 5 hours or so as jary - feel free to reply here or look me up there.
(well, I'm heading to lunch very soon, so back in around an hour)
Jeremy
----- Original Message -----
From: "Mike Gill" <mgill(a)modusoperandi.com>
To: rules-users(a)lists.jboss.org
Sent: Monday, September 21, 2009 11:27:46 AM GMT -06:00 US/Canada Central
Subject: [rules-users] Using work items in the Eclipse ruleflow editor
I am using Eclipse to build my Drools rulefow file. I am trying to add custom work items, but I cannot seem to get anything (other than Email and Log) to show up in my Work Items palette.
Does anyone know how to get the existing work items (such as FileFinder or Exec) to show up on the palette in eclipse?
Eventually I will need to add custom work items to the flow, so this is make-or-break Drools functionality for my team.
In pursuit of a solution to this I have combed the documentation, this mailing list archive, as well as endless Google results to no avail. Any help would be very valuable!
Thanks,
Mike
_______________________________________________ rules-users mailing list rules-users(a)lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users
14 years, 11 months
Understanding agenda-group (doesn't work as documented in book or docs)
by Pritam
I'm not quite sure howDrools processes and partitions Agenda based on
agenda-groups as the documentation conflicts with a real example. As per the
documentation in Drools site and Michael Bali's book, page 102
"Drools maintains a stack of Agenda groups. Whenever the focus is set to
true, the active agenda-group is automatically changed to rule's agenda
group. Drools maintains a stack of agenda groups. Whenever the focus is set
to a different group, Drools adds this group to a stack. When there are no
rules to fire from the agenda group, Drools pops from the stack and sets the
agenda group to the next one."
However, when I run a simple example with two rules having agenda groups
set, none of the rules are fired unless the agenda-group is explicitly set
to runtime. Based on the above example, I would expect Drools Agenda to run
all rules under "MAIN" and since there are none, it should pop it out and
point to the next available group and so on.
Am I missing something here?
package com.sample
import com.sample.DroolsTest.Message;
rule "Hello World"
agenda-group "group1" # comment this and rule fires
when
m : Message( status == Message.HELLO, myMessage : message )
then
System.out.println( myMessage );
m.setMessage( "Goodbye cruel world" );
m.setStatus( Message.GOODBYE );
update( m );
end
rule "GoodBye"
agenda-group "group 2" # comment this and rule fires
when
Message( status == Message.GOODBYE, myMessage : message )
then
System.out.println( myMessage );
end
DroolsTest:-
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
Message message = new Message();
message.setMessage("Hello World");
message.setStatus(Message.HELLO);
ksession.insert(message);
// ksession.getAgenda().getAgendaGroup("group1").setFocus(); // enable
this only group1 is fired, not // group2
ksession.fireAllRules();
--
View this message in context: http://n3.nabble.com/Understanding-agenda-group-doesn-t-work-as-documente...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
drools performance with <
by Tom Carchrae
Hello,
I'm new to Drools and am trying it out. I've found it easy enough so
far, but quickly ran into a performance bottleneck. (perhaps an all
too familiar story! :) ). So, I made a simple example to try and
track down the behavior. Here it is.
I wanted to create a rule that uses an < comparison between pairs of
objects. The following are the performance results:
10 objects. Java comparison took 0 ms
10 objects. Rule firing took 2516 ms
100 objects. Java comparison took 0 ms
100 objects. Rule firing took 1984 ms
1000 objects. Java comparison took 47 ms
1000 objects. Rule firing took 132500 ms
10000 objects. Java comparison took 4641 ms
10000 objects. Rule firing took .... (please wait...)
Here is the rule
rule "A < B"
when
a : TestObject( )
b : TestObject( valueDouble < a.valueDouble )
then
b.setValueint(b.getValueint()+1);
end
Now, I do understand that this (worst-case) is a comparison of N x N
objects... so, 1000 = 1000000 comparisons. However, ~100ms per
comparison seems relatively expensive for such a simple check. I am
using StatefulKnowledgeSession (I tried Stateless but this gave only a
mild performance improvement - and I would also like to use insert in
some of my rules).
How would one speed up such a query? I know part of the problem is
the < comparison. The results with == are much better (presumably, it
can do lots of pruning of the space)
Model creation 0
10 objects. Rule firing took 2829 ms
100 objects. Rule firing took 93 ms
1000 objects. Rule firing took 657 ms
10000 objects. Rule firing took 3375 ms
100000 objects. Rule firing took 33266 ms
I have thought about clever tricks that I could do to try and speed
things up, like sorting into groups, etc. But it all seems relatively
convoluted. Am I correct in coming to the conclusion that a <
comparison is not the kind of thing that you should do in Drools?
How would you go about this? I would prefer to keep all the logic in
the DRL files. I'm guessing you do a Java based comparison and use a
fire-once rule to invoke this code.
Thanks in advance for any insight,
Tom
14 years, 11 months