Problem with Negative Patterns and Temporal Constraints
by Weiss, Wolfgang
Hi all!
We have the problem that the following rule never fires:
rule "test-rule"
agenda-group "evaluation"
salience 100
when
$cue : AnalysisCue() from entry-point "LowLevelCueStream"
not(AnalysisCue(this after[0ms,2500ms] $cue) from entry-point "LowLevelCueStream")
then
logger.debug("... some message ..");
end
We found out that the problem is the combination of the negation with the conditional element "not" and the temporal constraint "[0ms,2500ms]". Using the temporal operator "this after $cue" without a temporal constraint works correct in its semantics.
Interestingly, when adding a constraint (cueType == 1) to the type in the negative pattern the rule begins to work. The rule would look like as follows:
rule "test-rule"
agenda-group "evaluation"
salience 100
when
$cue : AnalysisCue() from entry-point "LowLevelCueStream"
not(AnalysisCue(cueType == 1, this after[0ms,2500ms] $cue) from entry-point "LowLevelCueStream")
then
logger.debug("... some message ..");
end
unfortunately the rule then fires with a delay of 4 to 5 seconds. The second parameter of the temporal constraint influences the delay.
When changing the first parameter of the temporal constraint to a value greater than 0 the rule works as expected! The constraint would then look like as follows: "[1ms, 2500ms]". Whereas in our case, we want to evaluate the time window from 0 - 2500ms.
Our system works in the stream mode and we could reproduce this behaviour with the versions 5.3.1 and 5.4.0 Beta 1.
Can anybody confirm if this is a bug in Drools, or did I overlook here something?
Best regards,
Wolfgang Weiss
12 years, 10 months
Large number of rules in Drools
by Shweta1986
Hi,
I am using drools for 2 of our projects. For one of them I have
more than 20K simple rules. But with number of rules I have started seeing
out of memory exceptions and also configuring 20K rules through guvnor is
difficult. Is there an alternative for this? Is there something like file
upload for drl on guvnor ? Is there a limit on number of rules ?
Thanks,
Shweta
--
View this message in context: http://drools.46999.n3.nabble.com/Large-number-of-rules-in-Drools-tp36303...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Re: [rules-users] Using Drools Planner for dynamic service composition
by ge0ffrey
johan.kumps wrote
>
> Hi,
>
> Could you point me to a document providing some more information on this.
> Using the Drools Planner documentation alone I'm not able to find a design
> for my problem.
>
> Kind regards,
>
This problem, "the most optimal service composition achieving a certain
consumer goal" probably falls into the category of problems called "assembly
line optimization". An example of assembly line optimization is in a
furniture factory: manufacture a number of chairs and tables and order the
usage of the machines (sequentially and in parallel) as optimal as possible.
There is no public canonical example of "assembly line optimization" yet,
but Drools Planner has been successfully used for it already, for example by
ualtin (irc). The trick is to create/remove machine assignments in Move's
(something the other examples don't do). You can reuse the local search
algorithms, such as Tabu Search, but the construction heuristics might be a
problem, in which case you 'll need to write a custom SolutionInitializer
like in some examples (until the construction heuristics become more
flexible).
--
View this message in context: http://drools.46999.n3.nabble.com/Using-Drools-Planner-for-dynamic-servic...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Application Guvnor integration
by Senthil K
Hi,
I am trying to do integration between application and guvnor. I am unable to
build knowledge base using the change_set provided for the package in
Guvnor. Following is the snipet of code i am using. When i try to print
number of packages from knowledgebase, it shows 0.
Can you help me please.
System.out.println("Before rule engine start ");
String
urlstr="http://192.168.2.247:8080/guvnor-5.3.0.Final-jboss-as-5.1/org.drools.guvn...";
URL url = new URL(urlstr);
KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
aconf.setProperty("drools.agent.newInstance", "false");
_kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent",aconf );
System.out.println("after creating kagent");
_kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
System.out.println("after apply change set");
ResourceChangeScannerConfiguration sconf=
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "30");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
System.out.println("After starting Notification service");
_kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
_kbase = _kagent.getKnowledgeBase();
Collection<KnowledgePackage> kpackages =
_kbase.getKnowledgePackages();
System.out.println("no of packages"+kpackages.size());
--
View this message in context: http://drools.46999.n3.nabble.com/Application-Guvnor-integration-tp365592...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Knowledge base in cache
by apache
Hi,
Usually when fireallrules() is called then then the drools engine matches
current facts in the jvm memory ( knowledge base ) with the rules in the
rule engine. Is there a way where we can put the facts in a cache like
mamecache or something where when fireallrules() is called the jvm matches
all the facts in the cache also rather than just in the jvm memory.
--
View this message in context: http://drools.46999.n3.nabble.com/Knowledge-base-in-cache-tp3664908p36649...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Rules for generating calendar events
by sverker
Hi
I have an application where I want to generate calendar events. Each event
will have an attached resource and people will be able to book themselves to
this event. The events are re-occuring in that they are on fixed time each
day/weekday etc, like "every friday 07:00 -12:00 unless holiday" or
something like that. The events shall be batch generated at beginning of
each month and put into a database. I want the rules that generate the
events to have some kind of DSL to be easily readable also for
non-technishians.
My question, would drools be a suitable tool for this task? I've been trying
to find examples on the above but couldn't find any.
/Sverker
--
View this message in context: http://drools.46999.n3.nabble.com/Rules-for-generating-calendar-events-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
agenda group fires multiple times
by srinivasasanda
i created 3 agenda groups 101,102,103, and in each group i created some
rules, and i want to fire only one group .
i fired the rules in loop , at first iteration 101 agenda group is fired,
and 2nd iteration 102 group fired and also 101 is also firing. i want to
fire only 102 agenda group in second iteration and third iteration 103
group. i have even given no-loop true . but it not working , please give me
some solution how to solve it.
1. |package pricing
2. |
3. |
4. | declare person
5. | age: Integer
6. | income: Integer
7. | cpv: Integer
8. | end
9. |
10. | declare specification
11. | databandwidth: Integer
12. | smsusage: Integer
13. | voiceusage: Integer
14. | videousage: Integer
15. | end
16. |
17. | declare results
18. | result: String
19. | end
20. |
21. | declare policy
22. | policyid: Integer
23. | end
24. |
25. |
26. |
27. | rule "ageprice"
28. | agenda-group "101"
29. | no-loop true
30. | dialect "mvel"
31. | when
32. | person( age < 99 && > 1 )
33. | r : results( )
34. | then
35. | r.setResult("199");
36. | System.out.println("age price fired =result= ");
37. | System.out.println(r.getResult());
38. | end
39. |
40. |
41. | rule "incomeprice"
42. | agenda-group "102"
43. | no-loop true
44. | dialect "mvel"
45. | when
46. | person( income < 99999 && > 1 )
47. | r : results( )
48. | then
49. | r.setResult("599");
50. | System.out.println("income price fired result=");
51. | System.out.println(r.getResult());
52. | end
53. |
54. |
55. | rule "cpvprice"
56. | agenda-group "103"
57. | no-loop true
58. | dialect "mvel"
59. | when
60. | person( cpv < 6 && > 1 )
61. | r : results( )
62. | then
63. | r.setResult("999");
64. | System.out.println("cpv price fired =result=");
65. | System.out.println(r.getResult());
66. | end
67. |
68. |
69. |
70. |
71. | rule "policy"
72. | dialect "mvel"
73. | when
74. | policy( policyid == 101 )
75. | then
76. | System.out.println("policy filred");
77. | drools.setFocus("101");
78. | end
79. |
80. |
81. | rule "policy2"
82. | dialect "mvel"
83. | when
84. | policy( policyid == 102 )
85. | then
86. | System.out.println("102 policy fired");
87. | drools.setFocus("102");
88. | end
89. |
90. |
91. | rule "policy3"
92. | dialect "mvel"
93. | when
94. | policy( policyid == 103 )
95. | then
96. | System.out.println("103 policy is focused");
97. | drools.setFocus("103");
98. | end
--
View this message in context: http://drools.46999.n3.nabble.com/agenda-group-fires-multiple-times-tp366...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months
Calling POJO class get Method in BRL
by srinivasasanda
Hi,
I've a BRL with Person as a fact containing field name age(in sample
package).
Now,I've a POJO class named PersonDetails with fields age,name with its
getters,setters methods.Now I uploaded that POJO model in that sample
package.
Now,I need to check in When condition of brl whether age in Person fact is
equal to the value obtained from getAge() method of PersonDetails POJO
class.
When I used guided editor it is giving as age is equal to 1.Literal
Value,2.Expression editor,3.Formulae.
How can i achieve that ??I should create new instance of PersonDetails p in
When condition and i should call p.getAge() and that value must be compared
to age in Person Fact.
Can you please suggest me how to achieve this..
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Calling-POJO-class-get-Method-in-BRL-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 10 months