activationCancelled() not being executed?
by Fermion
Hi!
I'm using a JTable to display rules that have been activated.
My goal is to have the table display a set of activations ordered by their
salience. The user should then choose which one of them to fire (if you want
to know why, be invited to read the background).
Of course this makes only sense as long as the activations are valid. Rules
whose activation has been cancelled should still be displayed, but in a
different style (like greyed out).
In order to accomplish this, I want to use an implementation of the
AgendaEventListener-interface, implementing the
activationCancelled()-method.
The Listener itself works, as I use the activationCreated()-method to add
the rule as a row to my table (which works fine).
Unfortunately the activationCancelled()-method doesn't seem to be executed
at all!
I assume that I have a fundamental misunderstanding of what should trigger
an activationCancelled() event?
Background: (just if you're curious...)
I'm working as a PhD student in physics at the CERN international
high-energy physics laboratory, for the ATLAS experiment.
As a member of the Detector Control System (DCS) group, I'm going to write
an expert system in order to assist the shift crew with the detector
operation.
The operation of the detector is a difficult task, because more than 70000
parameters (like voltages, currents and temperatures) have to be controlled.
A Finite State Machine (FSM) computes a defined and limited number of states
from the given parameters (like ON, OFF, STANDBY,...).
I'm going to synchronize the expert system application to ERROR states of
the FSM, in order to extract the relevant parameters from the system (as it
would be impossible to feed all parameters into the XPS all the time).
This is handled by quite some control rules that decide which data has to be
requested, released and so on.
Once all necessary data has been received, this might lead to activations of
the (more interesting) user rules.
Those rules have an explanatory character like "The temperature of this XYZ
is too high, so please try ABC."
For a given set of facts I assume more then one rule to be activated. Whilst
the rule engine should take care of the execution (firing) of all control
related rules, the execution of the user rules should be under direct user
control.
Displaying all activations in a GUI will allow the user to pick one (try it)
and rate it (the proposed solution solved the problem "yes/no"). Changing
the rules salience according to the answer, will allow the system to
dynamically reflect the current system status. (Rules that are related to
broken connections / wrongly connected cables are likely to be found at the
beginning of the experiment but hopefully only on rare occasion later on.)
In order to ensure that no information is lost during the absence of DCS
experts (which will not always be around), a log file should be written for
each major FSM-ERROR. At the moment the WorkingMemoryFileLogger seems to be
predestined for this job. This way I hope to collect large amounts of ERROR
data during the initial phase of the experiment that helps to extract rules
for numerous error conditions.
This will become especially handy, as such errors have a tendency to come
back, even if the original detector experts are gone for years...
--
View this message in context: http://www.nabble.com/activationCancelled%28%29-not-being-executed--tf434...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 9 months
Exception executing eval predicate in a Split node (RuleFlow)
by Sangrish
hey guys
I am getting the exception :
-----------------------------
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( mhc!=MIN_INT.intValue() )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
....................
-------------------------------
while executing the predicate : Author1( eval(
mhc!=MIN_INT.intValue() ) )
in the condition part of a Split node in a ruleflow
where, Author1 is a class defined as:
------------------------------
package com.sample;
public class Author1 {
public int mhc = -1;
public Author1()
{}
public int getMhc() { return mhc; }
public void setMhc(int y) { mhc = y; };
}
----------------------------
and MIN_INT is a global Integer (duly set and imported as global through the
Split node constraint editor)
I have not been able to understand the reason for it. Please enlighten me.
Secondly, I am not able to have the concerned condition without "eval"
predicate which I heard is not good performance wise. I think that without
"eval" the Right Hand Side of a condition cannot have a non-constant. More
enlightenment!!! :)
I am using Drools Eclipse Plugin : 4.0.7
Thanks
Siddharth
--
View this message in context: http://www.nabble.com/Exception-executing-eval-predicate-in-a-Split-node-...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 9 months
Exception executing eval predicate in a Split node (RuleFlow)
by Sangrish
hello
I am getting the exception :
-----------------------------
Exception in thread "main" org.drools.RuntimeDroolsException: Exception
executing predicate eval( mhc!=MIN_INT.intValue() )
at
org.drools.rule.PredicateConstraint.isAllowed(PredicateConstraint.java:216)
at org.drools.reteoo.AlphaNode.assertObject(AlphaNode.java:137)
at
org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
....................
-------------------------------
while executing the predicate : Author1( eval(
mhc!=MIN_INT.intValue() ) )
in the condition part of a Split node in a ruleflow
where, Author1 is a class defined as:
------------------------------
package com.sample;
public class Author1 {
public int mhc = -1;
public Author1()
{}
public int getMhc() { return mhc; }
public void setMhc(int y) { mhc = y; };
}
----------------------------
and MIN_INT is a global Integer (duly set and imported as global through the
Split node constraint editor)
I have not been able to understand the reason for it. Please enlighten me.
Secondly, I am not able to have the concerned condition without "eval"
predicate which I heard is not good performance wise. I think that without
"eval" the Right Hand Side of a condition cannot have a non-constant. More
enlightenment!!! :)
I am using Drools Eclipse Plugin : 4.0.7
Thanks
Siddharth
--
View this message in context: http://www.nabble.com/Exception-executing-eval-predicate-in-a-Split-node-...
Sent from the drools - user mailing list archive at Nabble.com.
17 years, 9 months
first steps with drools.....first errors
by Nicola Benaglia
Hi,
I am moving my first steps with Drools 4.0.7.
In my case I have an exam result to valuate.
I can pass an ExamDetailas fact containing (value, authLimit, lawLimit)
where authLimit may or may not be present.
How can I force to valuate a rule only if a property exists?
Here an example:
rule "Rule n.1"
dialect "mvel"
no-loop true
salience 10
when
exists ExamDetail(authLimit);
$examDetail : ExamDetail( $value: value < authLimit);
then
System.out.println( "1 Exam passed!" + $value);
end
rule "Rule n.2"
dialect "mvel"
no-loop true
salience 10
when
not exists ExamDetail(authLimit);
ExamDetail( $value: value < lawLimit);
then
System.out.println( "2 Exam passed! + $value);
end
With these 2 rules I expected to cover my 2 cases:
1) When I have authLimit --> rule #1
2) When authLimit is absent --> rule #2
But I get this error (when I don't have authlimit):
Exception in thread "main" org.drools.rule.InvalidRulePackage: [14,21]:
unknown:14:21 Unexpected token 'authLimit'[25,6]: unknown:25:6
Unexpected token 'exists'[25,24]: unknown:25:24 Unexpected token 'authLimit'
at org.drools.rule.Package.checkValidity(Package.java:424)
at
org.drools.common.AbstractRuleBase.addPackage(AbstractRuleBase.java:394)
at eu.tecnoprogetti.rules.seam.ExamCheck.main(ExamCheck.java:23)
Any suggestions?
Thank you for your time.
Nico
17 years, 9 months
UseCase: Drools in Engineering
by Michael Zimmermann
HI Edson,
while discussing custom operators in drools trunk, you pocked me
repeatedly to write something about how we use drools in a research
project in the field of engineering. Here you go... may be it is also
helpful or at least interesting for the other readers on this list :-)
The Scope: Naval Engineering,
In naval engineering vessels consists of thousands of parts (read: way
more than an aircraft has today). Focusing on the steel structure, most
of these parts are 2-dimensional plates of a certain size, thickness,
grade and contour. For most fields of applications detailed regulations
from classification societies etc. exist.
Currently, the design of such objects is done using specialized CAD
systems. Here the following issues are present in all cad systems and
the design process today:
- design time is 6 - 18 months (and not 10 - 15 years as for an
air plane)
- this means concurrent design, i. e. different people are working on
parts or features that are closely related (strength, fatigue, cost,
functional aspects or just being in the same room) on different levels
of granularity (changing the hull 6 weeks before building happens!)
- and no connection between design intent (specification on paper),
design conditions (regulations, by the customer, results of
calculations) and design solution chosen.
Result:
- We just have the geometrical data, nothing more in the CAD-model
- No automatic checks if a certain component is changed; no automatic
tests if a chosen design solutions really satisfies the conditions at
lowest cost today
- Therefore, changes (which you can't avoid) are cost intensive and
error prone. Also, no one really knows why a certain solutions was chosen
Enter Logic & Drools
The objective of our research is to make the design process context
aware. Example: If I design a "door" in a watertight "wall" the cad
system should check whether the selected door is a watertight model.
So, using one of the most popular commercial cad systems for naval
engineering the approach is to define the standards (currently
paper-based) electronically using DROOLS. Also, context-information
like watertight, stress level=x ... is added to the model and reused in
the design process. For standard design tasks (in a part of the field of
detailed steel structural design) we use drools to completely automate
the design process, i. e.
- find a design problem in the model
- select a suitable solution adhering to all known boundary conditions
- design the solution
- and assign a assurance level for the solution (how good is it?)
Lessons Learnt from an Engineering POV
1) Extracting the knowledge is hard
2) Formulating it logically sound even harder (even official regulations
are vague on a regular basis)
3) Defining the context a solution is valid for is even more difficult.
4) Current CAD systems in naval engineering are not really capable to
store meta information and to interface with other applications.
Lessons Learnt from a Drools POV
1) Drools is quite a nice system :-)
2) With DSL even engineers can use it (once they are trained how to
"Think Rules". And that is next to impossible)
3) What's missing is some solution to easily define classes, class
hierarchies and (!) instance data. We use OWL for now. eCore might be
usable yet is terrible from a UI usability perspective
4) Not drools is the problem but getting the data in and out!
4a) The Smooks binding could be a godsend for this
4b) Fact templates sound really promising if you think dynamically
generated classes via web services...
What's missing in Drools?
- An OWL/RDF binding would be really great (we use OWL to define, edit,
store our standards. But encountered the clash of open world logic (DL)
and closed world logic (CS) more than once.) I know there is quite a
large interest for such a solution in the Ontology user base.
- Better support for constraint programming (what we do here and there)
for simple primitive cases (read: selection processes) would help.
Drools solver is overkill; drools rules can not handle this if you think
optional constraints. The custom operator "== (open world style)" we
talked about helps, though.
Well, it has gotten longer than I expected yet only skimmed the surface
of our approach, I think. Hopefully not to long :-)
cu, Michael
17 years, 9 months
Drools Research Network
by Mark Proctor
I'm trying to get together a single source of knowledge on all the
drools related research going on and various institutes involved. I've
setup a wiki page to capture this information, if you are able to add to
it please do. It contains a list of the projects, as well as the
universities and mentors associated with Drools research.
http://wiki.jboss.org/wiki/DroolsInAcademia
The wiki page can be edited by anyone who has registered and logged in,
the registration link should be on the top of the page.
Mark
17 years, 9 months
Drools & "Query by Example"?
by Michael Zimmermann
Hi there,
I am not really sure what is the best approach to model this the drools
way... So, what is the best approach using drools to find all objects of
a known type that fulfil certain criterias? Caveat: The number of
criterias is flexible and not known?
I know, that such a selection process can be defined as simple case of
constraint programming. Afaik this could be a problem for any rulebased
system. Yet we do not want to introduce another compontent as this leads
to dependency and communication issues.
Example:
Assume a class book with properties "author", "year", "id" and
"publisher". As our problem is more complex I want to test book
instances for the properties "author", "year" etc. in individual rules.
Now, given a list of books in the working memory I want to get answer to
the following questions:
- List all books with author="myName", id="123"
- List all book with publisher="Frank"
Due to the closed world assumption in Java and hence Drools, what is not
possible is:
rule "MyRule"
when
book(year==myYear, author==myAuthor ...)
then
....
This works only if all properties myYear, myAuthor ... are present. If
one is undefined, the rule does not match.
The System:
The system uses drools quite successfully for many tasks. All data
objects are persisted using db4o.
Currently, I can think of two different approaches:
1)
- Start with all objects in the working memory
- For each condition, if present, flag all objects, that do not
fulfil this condition, as invalid
- Afterwards, list / process all objects that are not marked as invalid
2)
- Start with no object in the working memory
- Construct a blank object of the type analyzed
- If a certain condition is present, add this conidtion to
the object
- Query the object database in db4o and add all valid matching
object to the working memory. (db4o supports QueryByExample)
The double negotiation in the first approach is hard to understand and
difficult to maintain. The second approach works reasonably well yet
moves some of the main application logic to another component.
So, any clues, pointers or ideas how to solve this problem in a better way?
cu, Michael
17 years, 9 months