[planner][5.3.0.Final] Benchmark
by Guilherme Kunigami
I'm trying to upgrade from drools 5.2.0 to 5.3.0 and having some
difficulties with the planner benchmark.
I'd like to make a set of move factories common to all local search solvers,
by adding them to inheritedSolverBenchmark block. But it seems that the
localSearch environment always requires a selector, so I can't specify the
localSearch environment for the solverBenchmark's without providing a
selector. Here's a piece of code that gives runtime error:
http://paste.ubuntu.com/718806/
The error is:
Exception in thread "main" java.lang.IllegalArgumentException: A selector
requires configuration, for example a moveFactoryClass.
--- Note ---
If I understood correcly, the following configuration from examination
examples:
examinationStepLimitSolverBenchmarkConfig.xml
contains a bug, because it specifies a maximum step count for a general
solver
<termination>
<maximumStepCount>70</maximumStepCount>
</termination>
This gave the following exception:
Exception in thread "main" java.lang.UnsupportedOperationException:
StepCountTermination can only be used for phase termination.
Thanks,
14 years, 8 months
Looking for a Drools lecturer
by Laurence Vignollet
Hello,
We have introduced a "rule-engine" course in a 5th year of Computer
Science Study in University of Savoie, France.
We would like to give some hours on a Drools initiation, including
practise, to the 20 students attending this course.
If somebody could be interested, please contact me by email.
Thanks in advance,
all the best,
Laurence Vignollet
--
Université de Savoie
Campus Scientifique
73370 Le Bourget-du-Lac
Tel : +33 (0)479 758 847
Fax : +33 (0)479 758 690
14 years, 8 months
Advice on varying rule behavior based on object tested?
by zstlaw
Each item I am testing MAY have overridden the default thresholds or disable
the rule entirely. I would prefer to have this data related to the item I
am testing rather than have each rule manage customized behavior for
thousands of different types of objects.
The object could have a map of rule thresholds it overrides, but for
simplicity I assume there is a method to return the current threshold for
the current object. is there a better way to perform this kind of logic?
Example of my current code:
declare TestedEntity
temp : Double
end
declare AlertThreshold
maxAllowed : Double
end
rule "Check temperature"
when
$entity : TestedEntity( )
// would prefer to use drools.getRule().getName() on next line
AlertThreshold($entity.temp > maxAllowed) from
$entity.getAlertThresholdForRule("Check temperature")
then
// raise alert
end
I dislike hard-coding the rule name as it leads to copy paste errors. I
can't insert thresholds easily unless I define different ones for each rule
and I want to be able to fall back to defaults easily. This is a type of
problem I have come up against several times now so I feel like others must
have dealt with it before. The idea of writing copies of rules tailored to
each Entity appeals less than a generalized way of doing this. By doing
this I want to contain complexity. Dozens of slightly different
implementations of the same rule would be much harder to test and support.
I am dealing with hundreds of thousands of facts today and will need to
scale to millions before I can deploy fully. But with that large number I
need to have ways to manage exceptions to the general case just to keep
complexity manageable.
Thanks,
Zack
--
View this message in context: http://drools.46999.n3.nabble.com/Advice-on-varying-rule-behavior-based-o...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
WorkingMemoryLogger + statelessSessions = memory leak?
by Swindells, Thomas
Hi everyone,
I believe that there is a memory leak when using WorkingMemoryLoggers with statelessSessions. This was raised against 5.1.1 but I think it will still exist in the latest as well.
Our code basically has the following pattern:
KnowledgeBase kb ==;
while(nextEvent()) {
StatelessKnowledgeSession session = kb.newStatelessKnowledgeSession();
auditor = new WorkingMemoryInMemoryLogger(session);
session.execute(getEvent());
dumpAuditLog(auditor);
session = null; //no dispose it's stateless
}
We were getting Out of Memory Exception on site and the stack dump showed a high number of MemoryLoggers on the heap.
Having a look at the code I think the problem is in the WorkingMemoryLogger constructor:
} else if (session instanceof StatelessKnowledgeSessionImpl) {
((StatelessKnowledgeSessionImpl) session).workingMemoryEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).agendaEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).ruleFlowEventSupport.addEventListener( this );
((StatelessKnowledgeSessionImpl) session).getRuleBase().addEventListener( this );
}
The last statement gets the knowledge base and attaches the event listener to it.
As far as I can see there is no way to dispose of the WorkingMemoryLogger and you don't dispose stateless sessions (and it doesn't know about the listener anyway). This means that even after the session is gone the rule base still has a reference to the logger.
The work around is to make the logger a singleton and clear it in each loop rather than creating a new one each time, however this obviously doesn't scale to multiple threads.
Have I missed some fundamental in the api or should I raise a Jira for this?
Thomas
________________________________
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster(a)nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************
14 years, 8 months
Rule, import with wildcards and variable / patternBinding
by Per Sterner
Hello,
Yesterday I wanted to upgrade my drools version to 5.3 (from 5.1). I got
the exception "java.lang.NoClassDefFoundError:
de/pelle7/testpackage/event/myEvent (wrong name:
de/pelle7/testpackage/event/MyEvent)" while adding my resources.
I removed the import wildcards and the error disappeard.
Finally I found the problem:
I used the patternBinding 'myEvent' and there is a class called
'MyEvent' and I used an wildcard import where the class 'MyEvent' is
located.
Example code:
"
package de.pelle7.testrules.impl.drools
import de.pelle7.testpackage.event.*
rule "Test rule 1"
dialect "java"
salience 50
when
myEvent : MyEvent( )
myEvent2 : MyEvent( data == myEvent.data ) <-- here the Exception
is thrown
then
System.err.println("Output");
end
"
My solution is that I replaced all my pattern bindings with the suffix
'$' which is more convenient.
Perhaps it would be nice to produce an rule-compilation error. with a
line notice.
Regard,
Per Sterner
14 years, 8 months
Why this rule fires immediately ?
by eskomk
Hi all,
Here is the rule:
CLIP -->
rule "ZZZOver30" dialect "mvel"
when
$tsb : ZZZBean($prof : profileID)
$avg : Number( doubleValue > 30 ) from accumulate(
ZZZBean( $tempr : temperature, profileID == $prof) over
window:length( 3 ),
average( $tempr ) )
then
// do something
end
CLIP <--
The intention as you can see is that the rule fires if the average
temperature rises above 30 degrees (of Celsius) in some measuring period.
For testing purposes the rule takes a specific number of temperatures
(window:length), in production environment the window will be time
(window:time(Xm)).
My question is, why this rule fires immediately after drools-expert is
started ?
Is there something wrong in syntax ?
In startup there are obviously no objects of this kind (ZZZBean) in Working
Set's memory, so it really shouldn't fire.
We are running Drools ver. 5.1.1 as a web service on top of apache, and the
facts (events) are fed to Drools via REST interface as XML.
thanks and regards,
Esko
-----
Esko Hujanen
www.ebsolut.fi
--
View this message in context: http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp34304...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Validation flow - defer expression evaluation
by peters
Hi,
I was wondering which is the proper way to do sanity checks (not null
etc...) on a fact before starting the actual business rules.
I have created a a ruleflow with a validation node (VALRFG) and a business
rule node (BRRFG) to determine execution order.
If in the validation node a not null constraint is violated, the session is
aborted (drools.halt()).
Problem with this approach is that assertions defined in rules of the
ruleflow-group "BRRFG" are validated before the validation rules execute.
The engine throws exception at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:298)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:130).
...
at
org.drools.base.mvel.MVELPredicateExpression.evaluate(MVELPredicateExpression.java:101)
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:291)
How can I make sure that the validation rules are executed before the mvel
expressions in the business rules are being evaluated?
Thanks for feedback,
--
View this message in context: http://drools.46999.n3.nabble.com/Validation-flow-defer-expression-evalua...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
5.3.0.Final resource change scanner bug
by lhorton
I tried loading up 5.3.0 this weekend but have run into this bug:
https://bugzilla.redhat.com/show_bug.cgi?id=733008
my server log says:
Exception in thread "Thread-38" java.lang.IllegalStateException: reader does
have a modified date
at
org.drools.io.impl.ReaderResource.getLastModified(ReaderResource.java:64)
at
org.drools.io.impl.ResourceChangeScannerImpl.scan(ResourceChangeScannerImpl.java:166)
at
org.drools.io.impl.ResourceChangeScannerImpl$ProcessChangeSet.run(ResourceChangeScannerImpl.java:311)
at java.lang.Thread.run(Thread.java:662)
some rules files loaded, but some failed (silently, except for the above
message). Is there a workaround for this problem? we cannot migrate to
5.3.0 unless this is fixed or there is a way to work around the problem.
thanks for any help.
--
View this message in context: http://drools.46999.n3.nabble.com/5-3-0-Final-resource-change-scanner-bug...
Sent from the Drools: User forum mailing list archive at Nabble.com.
14 years, 8 months
Printing rule content when a rule is fired
by GPatel@tsys.com
Is is possible to get textual rule content from
org.drools.definition.rule.Rule? What I am looking to do is get the rule
definition (the when/then part) when a rule fires (i.e on
AfterActivationFiredEvent)
Thanks
G. Patel
-----------------------------------------
The information contained in this communication (including any
attachments hereto) is confidential and is intended solely for the
personal and confidential use of the individual or entity to whom
it is addressed. If the reader of this message is not the intended
recipient or an agent responsible for delivering it to the intended
recipient, you are hereby notified that you have received this
communication in error and that any review, dissemination, copying,
or unauthorized use of this information, or the taking of any
action in reliance on the contents of this information is strictly
prohibited. If you have received this communication in error,
please notify us immediately by e-mail, and delete the original
message. Thank you
14 years, 8 months