The update function inside a rule
by Marc Strabin
Hello,
I've 2 rules which should be similar but the result is different and I can't
understand why :
I insert an object Message() into drools with the following rule :
rule "rule_a"
timer (int:1s 1s)
when
SimpleClock ( d : dateInMillisec != 0 ) // SimpleClock give the current
time (set by a java timer and an update)
m : Message ( internalEndDate < d )
then
System.out.println( "rule a");
m.setInternalEndDate (d + 10000);
* retract (m);*
* insert (m);*
end
> the result is fine : a message every 10.
If I replace the rule_a by the rule_b : (because an update should be better
than an retract/insert I guess)
rule "rule_b"
timer (int:1s 1s)
when
SimpleClock ( d : dateInMillisec != 0 ) // Simple slock give the current
time (set by a java timer and an update)
m : Message ( internalEndDate < d )
then
System.out.println( "rule b");
m.setInternalEndDate (d + 10000);
* update (m);*
end
> the result is bad : a message every 1 second.
It act as if the attibute message.internalEndDate wasn't updated in the
drools engine. Could someone explain me if/why this behaviour is normal ?
Thanks in advance
Marc
14 years, 11 months
Using Drools to model and solve a production scheduling problem with changeovers
by Andrei Neboian
Dear All,
I am looking for a user-friendly platform which would allow me to model and
solve a
*production scheduling problem with changeover times*. Since it's an NP-Hard
problem, I am getting convinced that a CP formulation would be most
appropriate. Later on, a GUI should be designed to allow a user to interact
with the model.
Is "drools" a proper platform for this? Are there any examples of this type
of problem solved with Drools?
I need to tackle a problem with 4 parallel machines, over 100 jobs and 100
changeovertypes (sequence dependant setup times between each job).
I would appreciate any help on this! Thanks
Kind Regards,
Andrei
14 years, 11 months
Mythic Game Project Addition Artificial Intelligence and Quest System Components
by Mark Proctor
http://blog.athico.com/2011/01/mythic-game-project-addition-artificial.html
"In this project, we describe the design decisions and principles behind
the arti cial intelligence (AI) for a multiplayer online role playing
game, and our use of an expert system to implement it. We explain how we
organize AI rules into les, how those rules are assembled from a
database, how AI is assigned to entities, the di erent types of AI, the
di erent phases of AI, and how we manage facts used by AI. We also
review some of the history behind the Mythic project, where it is
headed, what an expert system is and why we chose to use one for our
project. The result of our project is a design that allows us to have
diverse AI behavior and exibility to reuse code to create new behaviors,
but may prove to be ineffcient if implemented on systems with many
players or many instances of AI running."
14 years, 11 months
Problem in DSL with Type constraints
by Leonardo Gomes
Hi,
Given the following DSL definition:
[condition][RestrictedLocation]Is restricted by = ArrayList(size >= 1) from
> collect(RestrictedLocation() from $restrictedLocationList)
> [condition][RestrictedLocation]- test=$test : test
>
and the following rule:
rule "Test"
> when
> Is restricted by
> - test
> then
> ...
> end
>
I'm getting the following DRL:
rule "Test"
> when
> ArrayList(size >= 1) from collect( RestrictedLocation*(, $test : test
> ) *from $restrictedLocationList)
> then
> ...
> end
>
Note the comma before the restriction: ** (, **
Anyone would know how to fix that?
Thanks a lot,
Leonardo.
14 years, 11 months
Test Scenarios with Rule Flows in 5.1.1 Guvnor
by John Peterson
Hi all,
I had (hopefully) a quick question about trying to test rules in rule flows in Guvnor with Drools 5.1.1. I have a simple 4 step rule flow (Start-RuleGroup1-RuleGroup2-End) with 1 rule in each Rule group. When I set up the test scenario to fire the first rule, which will trigger the second rule, activate "RuleGroup1", and run the scenario, it doesn't trigger the RuleFlow and fire the rule. I've also tried activating "Start" instead, but neither of them trigger the RuleFlow.
I know from experience that Rule Flows don't seem to work with 5.0, but with the addition of the entry options, I thought they would with 5.1.1. Am I mistaken?
Also, when I look at the Audit Log, I see the Rule Flow activated and deactivated before any of the facts are asserted:
BEFORE RULEFLOW GROUP ACTIVATED group:Start[size=0]
AFTER RULEFLOW GROUP ACTIVATED group:Start[size=0]
BEFORE RULEFLOW GROUP DEACTIVATED group:Start[size=0]
AFTER RULEFLOW GROUP DEACTIVATED group:Start[size=0]
OBJECT ASSERTED value:com.test.Game@47244724 factId: 1
OBJECT ASSERTED value:com.test.Customer@4c584c58 factId: 2
Could this be part of the problem?
Thanks!
14 years, 11 months
[planner] Hard constraints in drl, MoveFactory or isMoveDoable
by Evert Penninckx
Hi
General question on the drools planner. If I'm not mistaken, I see three
ways to impose hard constraints:
1. Generate violations in the scoring DRL.
2. Check them in isMoveDoable
3. Do not create moves in the MoveFactory which cause hard constraints to be
broken.
For safety I would always add a check in the DRL (1) in combination with 2
or 3 if possible.
I assume that checks in isMoveDoable are more expensive in terms of
performance and should only be put there if they can vary with each
solution.
Does this make sense?
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/planner-Hard-constrai...
Sent from the Drools - User mailing list archive at Nabble.com.
14 years, 11 months
Moving Rules and/or Packages from one Guvnor instance to another
by Dean Whisnant
Hello,
My Guvnor development environment has 2 servers, DEV and TEST. A typical lifecycle includes Business Analysts and developers authoring rules on DEV in multiple packages and then doing releases to the TEST server for our QA folks to verify our work. Eventually, we will also bring our production server into the mix once QA is complete.
It is somewhat painful to move rules between servers as the only 100% successful method I have is to use guvnor's export/import feature that exports the entire repository and the restores it in my TEST environment. I dislike the opportunity that someone has changed or is in the middle of changing a rule in package B on the DEV server and when I deploy to TEST changes for package A, the package B rules move as well.
Does anyone have a reliable method of moving individual rules between servers? How about moving just the contents of one package?
I downloaded and used a tool called Cyberduck and it seemed to do things well, but when moving from one server to another we lose the categories on the individual rules.
Any thoughts are appreciated.
Thanks
Dean
14 years, 11 months
Drools plugin for Grails
by Pablo Nussembaum
Hey All,
I just released a new version of the drools-gorm plugin based on the lastest stable version of Drools and jBPM 5.
Feel free to use and report bugs! ;-)
Thanks!,
--
Bauna
14 years, 11 months
Some question about Drools
by Carlos Santiago Moreno
Hi everyone, I have been working out with Drools, and a few more doubts have
appeared.
In Guvnor, each rule is defined inside a package. When you create a new rule
you must define the package where it belongs. Guvnor doesn't create any
kbase, you can see a package (in Guvnor) like a DRL file split in different
parts: the imports, the globals, each rule, etc. So Guvnor is only in charge
of maintain different versions of that DRLs.
1) Can this be done dynamically? I meant, will the workflow change as soon
as I save the new rules on any pre-existing package?
If I declare the entities in Guvnor, this will use the "declare" keyword to
define a New Data Type. Now...
2) Would this allow me to add workflow steps and rules as well as general
data entities?
and, the last one
3) What should I have in me interface to be able to use Drools as me rules
engine? I don't get it yet...
And if you can recomend me any web site with information about all this
things it'll be nice.
Thanks
Carlos S. Moreno
14 years, 11 months
StatefulKnowledgeSession Vs StatefulSession
by DeepakA
I used a KnowledgeBuilder ro read the resources (DSL & DSLR files)
Then created a KnowledgeBase and created a StatefulKnowledgeSession out of
the KnowledgeBase.
The StatefulKnowledgeSession was used to start the process and fire all
rules.
Then I realized I was not able to access the RuleBase from
StatefulKnowledgeSession.
So, now I create a RuleBase, then a PackageBuilder, add the resources to the
packageBuilder, then add the
package to the RuleBase and create a StatefulSession out of the RuleBase.
This statefulsession is used to start the process and fire all rules.
Can someone explain to me whats the difference in the above 2 methods of
firing the rules.
Whats the difference between StatefulKnowledgeSession & StatefulSession.
--
View this message in context: http://old.nabble.com/StatefulKnowledgeSession-Vs-StatefulSession-tp26511...
Sent from the drools - user mailing list archive at Nabble.com.
14 years, 11 months