Indeed. Either approach has it's advantages.
The "encode an agent's id into the rule conditions" was exactly how I
imagined agents in a shared rete would be differentiated. This has the advantage of
scaling well via rete node sharing if the agents are substantially similar. Also
communication between agents, in a unicast but especially multicast fashion, is natural in
the shared rete approach: just deposit an object into working memory that multiple
agent's rules match upon.
The separate rete approach ultimately scales better, though. And if the agents' rules
don't all change in a coordinated fashion, it's a must. (I'm pretty sure
drools and other engines have to halt processing while rules are added/removed.) And even
though drools does have a multi-threaded execution mode, there's no guarantee that
multiple agents in the same rete would take advantage of it well, and of course the one
agent per thread model would. Also, there's no reason why agents should execute on
the same JVM, so mattering on the inter-agent communication requirements it could be
embarrassingly parallel. Use some clustering technology like Terracotta and agents
wouldn't even know they were executing on separate JVMs.
Sounds like a lot of fun. :)
--- On Sun, 8/23/09, Mauricio Salatino <salaboy(a)gmail.com> wrote:
From: Mauricio Salatino <salaboy(a)gmail.com>
Subject: Re: [rules-users] Using Drools for modeling with rule-driven agents
To: Russ.Abbott(a)gmail.com, "Rules Users List"
<rules-users(a)lists.jboss.org>
Cc: "Greg Barton" <greg_barton(a)yahoo.com>, "HusseinAbbass"
<h.abbass(a)adfa.edu.au>, "Antony W. Iorio" <antony.iorio(a)gmail.com>
Date: Sunday, August 23, 2009, 12:16 AM
Seems that each agent will have a session
created based on different knowledge that can be dinamically
modified.
2009/8/22 Russ Abbott <russ.abbott(a)gmail.com>
Thanks Greg, That sounds quite
promising. I've never used Drools and can't say
how the Rete network will be organized. In fact, before your
message I wasn't aware that Drools allows multiple Rete
networks. If that's the case it seems to make a lot of
sense for each agent to have its own. Since the agents are
supposed to be individual and disjoint I was imagining that
I'd have to code an agent's id into its rules to
limit those rules from being applied to other agents. But
multiple Rete networks sounds much much better! It would
be even better if each agent could run its rules
asynchronously in its own thread. Is something like that
possible: multiple threads of rule evaluators running on a
single workspace?
-- Russ
On Sat, Aug 22, 2009 at 9:26 PM,
Greg Barton <greg_barton(a)yahoo.com>
wrote:
Yes, rules can be manipulated at runtime. The class
org.drools.RuleBase has methods for adding Packages and
removing Packages and individual rules, and can be called at
runtime as demonstrated by Mark in this jira post:
https://jira.jboss.org/jira/browse/JBRULES-1431
I haven't tried it myself, but now that the subject has
come up I probably will. :)
As for the best approach to do this, I'd suggest that
you have your own rule representation that generates DRL,
then compile that DRL in the standard way using the
PackageBuilder. On first blush it may seem best or more
elegant to try creating Rule objects directly, circumventing
the PackageBuilder, but that's a waste of time in my
opinion. (The main focus for support from the drools team is
the language and other "external" parts of the
system.)
So, how will agents interact in your system? Will each
have it's own rete network? Or will several agents
share a rete?
--- On Sat, 8/22/09, Russ Abbott <russ.abbott(a)gmail.com>
wrote:
> From: Russ Abbott <russ.abbott(a)gmail.com>
> Subject: Re: [rules-users] Using Drools for
modeling with rule-driven agents
> To: "Greg Barton" <greg_barton(a)yahoo.com>
> Cc: rules-users(a)lists.jboss.org,
"Antony W. Iorio" <antony.iorio(a)gmail.com>,
"HusseinAbbass" <h.abbass(a)adfa.edu.au>
> Date: Saturday, August 22, 2009, 10:15 PM
> That's a possibility. But
the
> underlying capability comes first. Can we do it in
Drools?
> Has anyone done it, and if so would you be willing to
share
> your experience?
>
> -- Russ
>
>
>
> On Sat, Aug 22, 2009 at 6:50 PM,
> Greg Barton <greg_barton(a)yahoo.com>
> wrote:
>
>
> This wouldn't happen to involve evolutionary
pressures
> altering rules, would it?
>
>
>
> --- On Sat, 8/22/09, Russ Abbott <russ.abbott(a)gmail.com>
> wrote:
>
>
>
> > From: Russ Abbott <russ.abbott(a)gmail.com>
>
> > Subject: [rules-users] Using Drools for modeling
with
> rule-driven agents
>
> > To: rules-users(a)lists.jboss.org
>
> > Cc: "Antony W. Iorio" <antony.iorio(a)gmail.com>,
> "Abbass, Hussein" <h.abbass(a)adfa.edu.au>
>
> > Date: Saturday, August 22, 2009, 5:52 PM
>
> >
>
> > Hi,
>
> >
>
> > I'm interested in developing (if it
doesn't
> already
>
> > exist) and then using a framework for
agent-based
> modeling
>
> > in which the agents are rule driven. An
important
> feature is
>
> > that the agents and their rules must be
dyanically
>
> > manipulable. That is, both the agents and the
rules
> must be
>
> > first class objects that can be manipulated as
the
> system is
>
> > running. Can Drools support that?
>
> >
>
> >
>
> >
>
> >
>
> > As someone not familiar with Drools I did my best
to
> find
>
> > out by looking at the Drools
>
> > Expert User's Manual. From what I could tell,
the
> Template
>
> > feature in which one uses Java objects as
Template
> data
>
> > sources comes close. I'd like your advice
> before
>
> > putting too much development effort into
attempting to
> use
>
> > it for that purpose.
>
> >
>
> >
>
> >
>
> >
>
> > In particular, would it be possible to set up a
> mechanism
>
> > that could: create and delete agents on the fly;
> associate
>
> > rule sets with agents on the fly; and modify the
> rules
>
> > associated with an agent on the fly? After
each
> such
>
> > action the system would change to reflect the
change
> in
>
> > agents and rules.
>
> >
>
> >
>
> >
>
> >
>
> > Thanks for your help.
>
> >
>
> > -- Russ Abbott
>
> >
>
> > P.S. If Drools would not be a good choice, is
there
> some
>
> > other system that you could recommend?
>
> >
>
> >
>
> >
>
> >
>
> > -----Inline Attachment Follows-----
>
> >
>
> > _______________________________________________
>
> > rules-users mailing list
>
> > rules-users(a)lists.jboss.org
>
> >
https://lists.jboss.org/mailman/listinfo/rules-users
>
> >
>
>
>
>
>
>
>
>
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
-
http://salaboy.wordpress.com
-
http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -