I think Rakesh Ambewadkar wrote:
> 
> 
> Hi All,
>   In the 2nd point out here, Todd says that if there is a complex logic using
> the rule based systems is effective.
> I can't get this point. After all i can replace the loop he has give with
>  If (a and b) then f
> If (a and not(b) and c) then g
> ...
> ...
> After all in a rule based system, u are going to write rules like that only !!!!
> So why can't i write them in a procedural code.

You can write them in procedural code, BUT...

- Rules are separate, small, understandable modules, while the "if"
statements can become very deeply nested and entangled.

- Under appropriate circumstances, the Rete algorithm is much faster
than the equivalent set of "if" statements. That's why it was
invented, after all.

Rete improves performance in two main ways. The first is that many
rules will have parallel sections - for instance, your two example
rules above share a first condition. If you're writing "if"
statements, you can exploit this by writing

if (a) then
   if (b) then
      f;
   if (c) then
      g;

If you don't do this, then you have to evaluate a and b more than
once (an obvious inefficiency.) Now imagine you've got hundreds of
rules. If you want to share parallel sections, you'll have to write a
horribly tangled knot of "if"s. On the other hand, Rete does this
automatically. You write the rules separately, and the parallel
sections are shared. No tangles.

The second improvement is memory. Imagine that you've just evaluated
your big "if" statement. Then another record is entered. What happens
next? You have to evaluate the entire "if" statement again - every
condition, all the a's, b's, c's, etc. But the Rete algorithm
"remembers" all the previous results. Only the conditions directly
affected by the new record will be evaluated. If there are thousands
of conditions, this is again an obvious performance advantage.

You can certainly mitigate some of the "if" approach's problems with
careful design, database triggers, etc, but you can't do as well as
a real RBS can do unless you basically recreate all the functionality
of an RBS. 

- I'm not a language bigot, so I don't think anyone should use an RBS
for everything; you should use the right tool for the right job. Use
whatever tool produces the cleanest, easiest to maintain, more
performant system. For a certain class of problems, my experience is
that RBSs are indeed the best tool.


> I still can't get this point.
> Also if you write each rule in a rule based approach as an if loop in procedural
> code why will it not work???
> If i want to fire the rule dynamically, then too i can implement it, say using
> propertychange listener of JavaBean architecture.
> Please throw some light on this.
> 
> Thanks in advance
> Rakesh
> 
> 
> 
> 
> 
> 
> 
> "Blanchard, Todd" <[EMAIL PROTECTED]> on 03/06/2000 04:08:34 AM
> 
> Please respond to "Blanchard, Todd" <[EMAIL PROTECTED]>
> 
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Rakesh Ambewadkar/LTITLPUN)
> 
> Subject:  RE: JESS: Need of Rule Based Systems !!!
> 
> 
> 
> Its gratifying to see people starting to figure out that you can't really
> implement complex business rules with just objects.  I wrote a couple
> workshop papers at the 95 oopsla and it seemed that there was a lot of
> harumphing and nobody really quite understood.
> 
> A couple points I made:
> 1) Objects are intentionally myopic.  In an effort to maximize cohesion
> and minimize coupling, designers work to minimize cross object visibility.
> This is good software design but it tends to hinder the implementation of
> complex constraints with conditions that have a disperse locality of
> reference.  For instance, trying to constrain available services in a sales
> application based on a complex combination of the customer's geographic
> location and tax status.
> 
> 2) Complex ladder logic is fragile.  If you find yourself with 2 or more
> levels of nested if statements with duplicated code:
> 
> if(a)
> {
>    if(b) then f
>    else if(c) then g
>    else if (d) then h
> }
> else
> {
>    if (c) and (d) then g
>    else if (d) and (b) then f
> }
> 
> its totally time to go to a production rules based architecture.
> 
> 3) State machines require more than 1 look-back or look-ahead to decide next
> state.
> I implemented a work planning system using production rules because I was
> able to identify
> complex opportunities to reuse work and take short cuts given certain
> conditions.
> 
> These are a few of the heuristics I use to decide whats algorithm and whats
> better as a kb.
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> eTranslate, Inc.                                    The Power of Language
> Todd Blanchard                                       main +1.415.970.7119
> Chief Technology Architect                            fax +1.415.371.0008
> http://www.etranslate.com/
> 500 Treat Street, Suite 100,      San Francisco, California 94110, U.S.A.
> 
> > -----Original Message-----
> > From: DATA [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, June 02, 2000 9:41 AM
> > To: [EMAIL PROTECTED]
> > Subject: Fw: JESS: Need of Rule Based Systems !!!
> >
> >
> >
> >
> > Giarratano & Riley "Expert Systems Principles and Programming" has a
> > gooddiscussion on the different approaches.
> >
> > >-----Original Message-----
> > >From: Sachin <[EMAIL PROTECTED]>
> > >To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> > >Date: Friday, June 02, 2000 5:03 AM
> > >Subject: JESS: Need of Rule Based Systems !!!
> > >
> > >
> > >>Hi,
> > >>I read all the documentation of rule based systems, but am
> > sorry to say
> > >that
> > >>i am still not able to appreciate its importance in a
> > business. Can any
> > >body
> > >>give me some specific example and then quote out by comparing the
> > >difference
> > >>between the procedural and rule based approach. After all
> > what is wrong
> > >with
> > >>encoding business knowledge in business objects of business level
> > >middletier
> > >>layer. Kindly quote an business example !!!
> > >>Thanks
> > >>Sachin
> > >>
> > >>
> > >>------------------------------------------------------------
> > ---------
> > >>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]
> > >>------------------------------------------------------------
> > ---------
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > 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]
> > ---------------------------------------------------------------------
> >
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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