Production systems with SELECT equivalent?

G

Guest

Guest
Archived from groups: comp.ai.games (More info?)

Production systems typically consist of a database containing a set of
facts, and a set of IF-THEN rules that act on these.

However, in practice what one often needs is "take the set of all
entities for which such-and-such is true, and do so-and-so with it";
the SQL SELECT operator is an example of something designed to meet
this requirement.

Are there any existing production systems that can do this, or some
equivalent of it?

Thanks,

--
"Sore wa himitsu desu."
To reply by email, remove
the small snack from address.
http://www.esatclear.ie/~rwallace
 
Archived from groups: comp.ai.games (More info?)

Russell Wallace wrote:
> Production systems typically consist of a database containing a set of
> facts, and a set of IF-THEN rules that act on these.
>
> However, in practice what one often needs is "take the set of all
> entities for which such-and-such is true, and do so-and-so with it";
> the SQL SELECT operator is an example of something designed to meet
> this requirement.
>
> Are there any existing production systems that can do this, or some
> equivalent of it?
>
> Thanks,
>

Maybe I'm misunderstanding you, but it seems to me that any production
that allows relational matching (which all the reasonable ones do) would
support what you are talking about. Here's an example Soar production rule:

sp {example-rule
(state <s> ^object <x>
^io.output-link <ol>)
(<x> ^edible *yes*)
-->
(<ol> ^eat <x>)
}

This rule will find every object that is marked as edible, and issue a
command (on the "output link") to eat it.

Is that what you're looking for?

Most production systems will do this kind of matching for you.
Essentially, the rule above instantiates itself to each object that
satisfies the conditions. Some production systems then allow you to
fire one instantiation at a time, and others allow all the matching
instantiations to fire at the same time.

Randy Jones
 
Archived from groups: comp.ai.games (More info?)

On Fri, 07 May 2004 08:38:02 -0400, "Randolph M. Jones"
<rjones@colby.edu> wrote:

>This rule will find every object that is marked as edible, and issue a
>command (on the "output link") to eat it.
>
>Is that what you're looking for?

Not quite.

It's true that a standard system can do things like "for all X such
that X is edible, eat X".

However, in practice it will typically be necessary to take the set
"all X such that X is edible" and _reify it as a value on which other
operations can be performed_.

Example (pseudocode):

MyFood = {all X such that X is edible and X is in MyHome}
MyFoodQty = sum(for all X in MyFood, NutritionValue(X))
if MyFoodQty < MinimumSafeLevel then ForageForMoreFood

AFAIK standard production systems can't do that. Are there any that
can? A couple hours of Google searching has thus far not found any
indication that anyone has ever even thought of the idea before, which
strikes me as odd; perhaps I'm missing something obvious?

--
"Sore wa himitsu desu."
To reply by email, remove
the small snack from address.
http://www.esatclear.ie/~rwallace
 
Archived from groups: comp.ai.games (More info?)

Russell Wallace wrote:
> On Fri, 07 May 2004 08:38:02 -0400, "Randolph M. Jones"
> <rjones@colby.edu> wrote:
>
>
>>This rule will find every object that is marked as edible, and issue a
>>command (on the "output link") to eat it.
>>
>>Is that what you're looking for?
>
>
> Not quite.
>
> It's true that a standard system can do things like "for all X such
> that X is edible, eat X".
>
> However, in practice it will typically be necessary to take the set
> "all X such that X is edible" and _reify it as a value on which other
> operations can be performed_.
>
> Example (pseudocode):
>
> MyFood = {all X such that X is edible and X is in MyHome}
> MyFoodQty = sum(for all X in MyFood, NutritionValue(X))
> if MyFoodQty < MinimumSafeLevel then ForageForMoreFood
>
> AFAIK standard production systems can't do that. Are there any that
> can? A couple hours of Google searching has thus far not found any
> indication that anyone has ever even thought of the idea before, which
> strikes me as odd; perhaps I'm missing something obvious?
>

I agree with you that this kind of thing isn't supported by the standard
pattern-matching in production systems, because they normally localize
everything to individual instatiations of each rule, and this type of
computation requires handling the complete set of instantiations. I
also agree that being able to do this can be very useful. When I've
done it using Soar in the past, I did it by writing my own external
function that I would have a rule invoke (most production systems
support something like this). Basically I first have a production use
whatever relational pattern I want to mark the set of objects, then the
external function searches through working memory to collect the marked
objects and then apply whatever function you want to the collection.

I'd guess this isn't normally built in to production systems because it
doesn't fit well into an efficient matcher like RETE, but that's only a
guess.

There was an old production system called PRISM that supported matching
and computation over sets. I'm pretty sure it supported this type of
thing, but PRISM disappeared many years ago.

Randy
 
Archived from groups: comp.ai.games (More info?)

On Fri, 07 May 2004 10:04:14 -0400, "Randolph M. Jones"
<rjones@colby.edu> wrote:

>I'd guess this isn't normally built in to production systems because it
>doesn't fit well into an efficient matcher like RETE, but that's only a
>guess.

You may be right, though if so this reminds me of the quote: "If it
doesn't have to work, I can write one that takes one millisecond per
card" :)

I'm also inclined to think, again unless I'm missing something, that
the ability to handle sets in this way would be helpful in solving the
problem of encapsulation.

(Consider a system simulating a world that contains agents; each agent
will have its own set of known facts and rules - but an agent's rules
must be constrained to operating on its knowledge base, and not
allowed directly access the world. If a value can contain a set of
facts and rules, then it can encapsulate an agent.)

>There was an old production system called PRISM that supported matching
>and computation over sets. I'm pretty sure it supported this type of
>thing, but PRISM disappeared many years ago.

Langley and Neches, CMU, 1981? Thanks, I've emailed the CS department
to see if it's still possible to obtain a copy of the manual for this.

--
"Sore wa himitsu desu."
To reply by email, remove
the small snack from address.
http://www.esatclear.ie/~rwallace