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
13 years, 8 months
Setting WorkItem parameter to object in working memory
by Swindells, Thomas
We have a process which runs some rules against items in the working memory. We then want to use one of the objects in the working memory as the input parameter to a work item.
The only way I can see to do this is to use a script step to fetch the fact from the wm (via a query or whatever) and then set a global, then have the global map into the in paramater. This however seems very messy, scoping the variable far larger than it needs to.
Is there a more appropriate solution which doesn't pollute the global variable namespace - perhaps running some code in the work items on entry action to populate the parameter directly?
Thanks,
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
**************************************************************************************
13 years, 8 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
13 years, 8 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."
13 years, 8 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.
13 years, 8 months