Ernest:

What I have done in the past is to establish a Goal object to control "rule flow"
such that we assert the Goal objects in the reverse order of rule flow so that the
last asserted Goal will be examined first.  This lets the rules control the flow
using the recency of the Goals.  If I want to establish that at least one instance
of the object (a Platinum loan, for example) exists (don't care how many) then I
retract that Goal on the RHS of the rule and the next Goal is examined.  If I want
to do something with all of the instances of the object, then I don't put the
retract in the RHS of the rule.

For example, let's say that I wanted a general set of rules such that certain things
would be done for all Platinum account holders and another set of rules such that
certain things would be done for all of the Platinum accounts.  In the first
instance, I only need to know that the customer has at least one Platinum account.
In the second, I might want to do something special for each Platinum account.

First, "assert" all of the Account, Party and the Goal objects that you want to
process using the procedure above for the Goal objects.  The last Goal asserted
looks for PLATINUM accounts.  In the first case above, the RHS of the rule would
"retract" the Goal of looking for a Platinum account when it found the first
instance.  The rules would then move on to the next goal.  In the second case, you
would establish a subset of those Platinum accounts and further process them
depending on the next-to-last Goal asserted.  Just depends on what the situation
calls for.

I've used this procedure on my past projects and it seems to work quite well.  I
really like to use this Goal-oriented or Goal-driven process whenever I'm doing
anything like configuration management, pricing, diagnosis, etc.  Seems to work
"almost" like the old backward chaining process but with just a couple of twists
that you have to iron out.

SDG
jco

[EMAIL PROTECTED] wrote:

> But you seem to be ignoring the whole problem, the "refractoriness"
> problem, I think you might call it. Show me how, using Jess's current
> semantics, you might accomplish what this rule (using the new feature)
> does:
>
> > > (defrule count-x-facts
> > >         (declare (one-shot TRUE))
> > >         (x)
> > >         ?count <- (count (x ?n))
> > >         =>
> > >         (modify ?count (x (+ ?n 1))))
>
> (keeping in mind that the "x" template has forty-seven slots that are
> constantly being modified by unrelated rules) and then explain to me
> why it's better.
>
> I think James C. Owen wrote:
> > OK, now that we're off and running, one-shot seems like it would work for a
> > limited set of circumstances.  However, if we use goal-oriented programming
> > then we don't need a special set of rules or objects.  If we have a specific
> > goal and the goal exists THEN we do either one or two things:
> >
> > 1.  If we want to know only that there exists at least one instance of a set
> > of circumstances, then the RHS would retract that goal and either assert
> > another or let the last goal have predominance on the conflict resolution
> > table.
> >
> > 2.  If we want to do something for all of the instances, don't retract the
> > goal.  Just let nature take it's course and do the same thing for all
> > instances of that particular situation.
> >
> > As has been stated so many times, "Folks, this stuff ain't rocket science.
> > It's just logic.  And if Psychologists, Business Analysts and Doctors with not
> > computer training at all can understand this and write decent programs (after
> > a year or two of working with it) then any half-fast programmer SURELY can
> > understand how to adjust to a given set of circumstances for a certain set of
> > rules."  Well, actually, that's my favorite quote.  It follows the old KISS
> > principle.
> >
> > SDG
> > jco
> >
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research        Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 [EMAIL PROTECTED]
> Livermore, CA 94550        http://herzberg.ca.sandia.gov
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------

--
SDG
jco

---------------------------------
James C. Owen
Senior KE
Knowledgebased Systems Corporation
6314 Kelly Circle
Garland, TX   75044
972.530.2895

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to