SlideShare uma empresa Scribd logo
1 de 32
Baixar para ler offline
Balaji Venugopal   Vimal Kumar
Definition

A rule engine is a piece of software, which having some
knowledge is able to perform conclusions.
Rules Engines are the pluggable software components
that separate the business rules from the application code


• A system that attempts to act as a domain
  expert
Some frequently asked questions

Why use a Rule Engine?

When should I use a rule engine?
What advantage does a rule engine have
over hand coded "if...then" approaches?



               We will attempt to address these
                                 questions…….
Why use a Rule Engine?
If “Procedural Code” is available then why RULE ENGINE ?
   The Problem
   • Have you developed/seen code with so many nested if statements that
     actually looked like a nest?
Why use a Rule Engine?
The Problem (Contd…)
 • Have you spent sleepless nights debugging code when you modified one
   of those 'if' statements and found that it distorted the next if statement?
 • Ever wondered how others implement these?
Why use a Rule Engine?
The Solution
 • “Rule engines are a great way to collect complex decision-making logic
   and work with data sets too large for humans to effectively use.”
When should I use a Rule Engine?
 "when there is no satisfactory traditional programming approach to solve the problem."

Complicated logic (not 1+1 = 2)‫‏‬
The Robot Example
Teaching a robot to prepare breakfast cereal (in an optimal environment)

START
putOnTable(bowl)
putOnTable(spoon)
putOnTable(napkin)
open(cereal-container)
pour(cereal)
open(milk-container)
pour(milk)
inviteOwner("You may begin eating")
END
The Robot Example
Teaching a robot to drive is much more difficult because the task vary
according
to environmental conditions

a. Robot must not do the tasks for backing out of garage if the garage door is
closed or if there is a little girl on a tricycle right behind the car

b. Backing out will be different on warm days and cold days. Also, in a
parking spaces, backing up procedures will be different in different
Settings

c. So many different circumstances lead to endless logic branching

d. Solution: independent rules that are integrated in an inference engine:

IF the engine has stalled
THEN start car
IF you hear sirens
THEN pull over to the curb
etc.
When should you use a Rule Engine?

Changes often (whatever that means)‫‏‬


Traditional approaches are unmaintainable


The problem is beyond any obvious algorithmic solution


Domain experts (or business analysts) are readily available, but are
nontechnical
Advantages of a Rule Engine
Declarative Programming


Logic and Data Separation


Speed and Scalability


Centralization of Knowledge


Tool Integration


Explanation Facility
High Level view of a Rule Engine
Working Memory. The data that rules work on. Also called the fact base.


Production Memory. Knowledge and inferences are stored in rules, which
are called production rules.


Pattern Matcher. Determines which rules to apply to the data in working
memory.
• There are a number of algorithms used for Pattern Matching by Inference
  Engines including:
  • Linear
  • Rete
  • Treat
  • Leaps


Agenda. Determines the order of execution of rules.


Execution Engine. The part of the rules engine that is responsible for
applying rules to data and then performing the action part of the rules
that have fired.
Architecture of Typical Rule Based
System



            observed data

           working memory
 select                         modify


   rule
                            Inference
  memory         fire                    output
                            engine
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

                working memory
     select                           modify


       rule
                                  interpreter
      memory          fire                      output
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

 select         working memory
                                      modify


      rule
                                  interpreter
     memory           fire                      output
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

                working memory
     select
                                       modify

                                  Inference
      rule                        engine
     memory                                     output
                     fire         executes
                                  actions
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

                working memory
     select                              modify


                                  Inference
      rule                        engine
     memory
                     fire         executes        output
                                  actions
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

 select         working memory
                                      modify


      rule
                                  interpreter
     memory           fire                      output
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

                working memory
     select
                                      modify

                                  Inference
      rule                        engine
     memory                        executes    output
                     fire
                                  actions
Reasoning with production rules
    Architecture of a typical production
     system:
                New information

                working memory
     select                            modify


                                  Inference
      rule                        engine
     memory                       executes
                     fire                       output
                                  actions
Methods of execution for a rule system
Forward Chaining             Backward Chaining




                      Goal                       Goal




                   Start
                                                 Start
Forward Chaining
             Goal
                    conclude the color of my pet Fritz



Working Memory          Rule Base

he croaks               1. If X croaks and eats flies - Then X is a frog
eats flies              2. If X chirps and sings - Then X is a canary
                        3. If X is a frog - Then X is green
                        4. If X is a canary - Then X is yellow
Working Memory           Rule Base

   he croaks                1. If X croaks and eats flies - Then X is a frog
   eats flies               2. If X chirps and sings - Then X is a canary
                            3. If X is a frog - Then X is green
                            4. If X is a canary - Then X is yellow




the color of my pet Fritz                                     Working Memory

                GREEN                                         he croaks
                                                              eats flies
                                                              frog
Backward Chaining
             Goal
                    conclude the color of my pet Fritz



Working Memory          Rule Base

he croaks               1. If X croaks and eats flies - Then X is a frog
eats flies              2. If X is a frog - Then X is green
                        3. If X is a canary - Then X is yellow
Goal List                               Rule Base

 1. conclude the color of my pet         1. If X croaks and eats flies - Then X is a frog
 Fritz                                   2. If X chirps and sings - Then X is a canary
                                         3. If X is a frog - Then X is green
                                         4. If X is a canary - Then X is yellow




                                            Goal List
  Working Memory
                                            1. conclude the color of my pet Fritz
  he croaks                                 2. X is a frog
  eats flies                                3. X is a canary


So my pet Fritz

                  Is frog   Is Green   He croaks and eats flies
Solutions Which Are Attracting The Use Of
Business Rules For More Efficiency
 • Marketing/Campaign               •   Business Process/Workflow
 • Management Account               •   Data Validation/Formatting
 • Management/Personalization       •   Self-Service Web Inquiries
   Behavior Scoring
                                    •   Regulatory Compliance
 • Product / Service
   Recommendation                   •   Order Configuration
 • Underwriting                     •   Call Center/CRM
   (Lending/Insurance)              •   Fraud Detection
 • Diagnostics/Problem Resolution   •   Authorization
 • Sales Commission Calculation     •   Benefits Analysis
 • Pension Portfolio Marketing
                                    •   Manufacturing Process
 • Risk Analysis
                                    •   Claims Processing
                                    •   Compliance Enforcement
                                    •   Database Migration Tool.
Rule Engines
Drools
BizTalk
Blaze Advisor
Jess
JRules
OpenRules
PegaRules
RulesPower
Heart of the System
Rule engine
Rule engine

Mais conteúdo relacionado

Mais procurados

principles of object oriented class design
principles of object oriented class designprinciples of object oriented class design
principles of object oriented class designNeetu Mishra
 
SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?Ed Seidewitz
 
Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護Justin Lin
 
Oracle PL/SQL exception handling
Oracle PL/SQL exception handlingOracle PL/SQL exception handling
Oracle PL/SQL exception handlingSmitha Padmanabhan
 
SO Unidad 3: Administración de memoria y sistemas de archivos
SO Unidad 3: Administración de memoria y sistemas de archivosSO Unidad 3: Administración de memoria y sistemas de archivos
SO Unidad 3: Administración de memoria y sistemas de archivosFranklin Parrales Bravo
 
Análise e Projeto de Sistemas com UML e Java
Análise e Projeto de Sistemas com UML e JavaAnálise e Projeto de Sistemas com UML e Java
Análise e Projeto de Sistemas com UML e Javaarmeniocardoso
 
ATL tutorial - EclipseCon 2009
ATL tutorial - EclipseCon 2009 ATL tutorial - EclipseCon 2009
ATL tutorial - EclipseCon 2009 William Piers
 
Multitarea, multiprogramación, multiprocesos y
Multitarea, multiprogramación, multiprocesos yMultitarea, multiprogramación, multiprocesos y
Multitarea, multiprogramación, multiprocesos yMiguel Magaña
 
AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)Amazon Web Services
 
Validating and Sanitizing User Data
Validating and Sanitizing  User DataValidating and Sanitizing  User Data
Validating and Sanitizing User Datazakieh alizadeh
 
Introduction to JMS and Message-Driven POJOs
Introduction to JMS and Message-Driven POJOsIntroduction to JMS and Message-Driven POJOs
Introduction to JMS and Message-Driven POJOsMatt Stine
 
Crystal metodologia ágil
Crystal   metodologia ágilCrystal   metodologia ágil
Crystal metodologia ágilVanessa Finoto
 
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...Edge AI and Vision Alliance
 
Microsoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMicrosoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMark Ginnebaugh
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL ServerRajesh Gunasundaram
 

Mais procurados (20)

principles of object oriented class design
principles of object oriented class designprinciples of object oriented class design
principles of object oriented class design
 
Aula 2 - Processos de Software
Aula 2 - Processos de SoftwareAula 2 - Processos de Software
Aula 2 - Processos de Software
 
Lectores y escritores
Lectores y escritoresLectores y escritores
Lectores y escritores
 
SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?SysML v2 - What's the big deal, anyway?
SysML v2 - What's the big deal, anyway?
 
Drools
DroolsDrools
Drools
 
Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護Java Web 程式之效能技巧與安全防護
Java Web 程式之效能技巧與安全防護
 
Oracle PL/SQL exception handling
Oracle PL/SQL exception handlingOracle PL/SQL exception handling
Oracle PL/SQL exception handling
 
SO Unidad 3: Administración de memoria y sistemas de archivos
SO Unidad 3: Administración de memoria y sistemas de archivosSO Unidad 3: Administración de memoria y sistemas de archivos
SO Unidad 3: Administración de memoria y sistemas de archivos
 
Análise e Projeto de Sistemas com UML e Java
Análise e Projeto de Sistemas com UML e JavaAnálise e Projeto de Sistemas com UML e Java
Análise e Projeto de Sistemas com UML e Java
 
ATL tutorial - EclipseCon 2009
ATL tutorial - EclipseCon 2009 ATL tutorial - EclipseCon 2009
ATL tutorial - EclipseCon 2009
 
Jcl
JclJcl
Jcl
 
Multitarea, multiprogramación, multiprocesos y
Multitarea, multiprogramación, multiprocesos yMultitarea, multiprogramación, multiprocesos y
Multitarea, multiprogramación, multiprocesos y
 
AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)
 
Validating and Sanitizing User Data
Validating and Sanitizing  User DataValidating and Sanitizing  User Data
Validating and Sanitizing User Data
 
Introduction to JMS and Message-Driven POJOs
Introduction to JMS and Message-Driven POJOsIntroduction to JMS and Message-Driven POJOs
Introduction to JMS and Message-Driven POJOs
 
الأوراكل
الأوراكلالأوراكل
الأوراكل
 
Crystal metodologia ágil
Crystal   metodologia ágilCrystal   metodologia ágil
Crystal metodologia ágil
 
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...
“Accelerating Newer ML Models Using the Qualcomm AI Stack,” a Presentation fr...
 
Microsoft SQL Server Query Tuning
Microsoft SQL Server Query TuningMicrosoft SQL Server Query Tuning
Microsoft SQL Server Query Tuning
 
Query Optimization in SQL Server
Query Optimization in SQL ServerQuery Optimization in SQL Server
Query Optimization in SQL Server
 

Destaque

Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & DroolsSandip Jadhav
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Mark Proctor
 
Success for Admins - Rules Engine & More
Success for Admins - Rules Engine & MoreSuccess for Admins - Rules Engine & More
Success for Admins - Rules Engine & MoreGainsight
 
Business Rule Engine - Jare
Business Rule Engine - JareBusiness Rule Engine - Jare
Business Rule Engine - Jareuwe geercken
 
Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule EngineAnkur Singhal
 
Drools @ IntelliFest 2012
Drools @ IntelliFest 2012Drools @ IntelliFest 2012
Drools @ IntelliFest 2012Mark Proctor
 
Azure Business rules v0.3
Azure Business rules v0.3Azure Business rules v0.3
Azure Business rules v0.3Luca Mauri
 
Square's Machine Learning Infrastructure and Applications - Rong Yan
Square's Machine Learning Infrastructure and Applications - Rong YanSquare's Machine Learning Infrastructure and Applications - Rong Yan
Square's Machine Learning Infrastructure and Applications - Rong YanHakka Labs
 
Construire un moteur d'inférence
Construire un moteur d'inférenceConstruire un moteur d'inférence
Construire un moteur d'inférenceJean Rohmer
 
L'approche par regles metier
L'approche par regles metierL'approche par regles metier
L'approche par regles metiersenejug
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorMaxim Shelest
 
Backward chaining rule-based system
Backward chaining rule-based systemBackward chaining rule-based system
Backward chaining rule-based systemJenny Padillo
 
Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Claus Ibsen
 
Apache UIMA Introduction
Apache UIMA IntroductionApache UIMA Introduction
Apache UIMA IntroductionTommaso Teofili
 
eServices-Tp3: esb
eServices-Tp3: esbeServices-Tp3: esb
eServices-Tp3: esbLilia Sfaxi
 
eServices-Tp5: api management
eServices-Tp5: api managementeServices-Tp5: api management
eServices-Tp5: api managementLilia Sfaxi
 
eServices-Tp4: esb++
eServices-Tp4: esb++eServices-Tp4: esb++
eServices-Tp4: esb++Lilia Sfaxi
 
eServices-Tp2: bpel
eServices-Tp2: bpeleServices-Tp2: bpel
eServices-Tp2: bpelLilia Sfaxi
 

Destaque (20)

Rule Engine & Drools
Rule Engine & DroolsRule Engine & Drools
Rule Engine & Drools
 
Rule engine
Rule engineRule engine
Rule engine
 
Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)Drools 6.0 (Red Hat Summit)
Drools 6.0 (Red Hat Summit)
 
Success for Admins - Rules Engine & More
Success for Admins - Rules Engine & MoreSuccess for Admins - Rules Engine & More
Success for Admins - Rules Engine & More
 
Business Rule Engine - Jare
Business Rule Engine - JareBusiness Rule Engine - Jare
Business Rule Engine - Jare
 
How To Use Dropbox
How To Use DropboxHow To Use Dropbox
How To Use Dropbox
 
Business Rule Engine
Business Rule EngineBusiness Rule Engine
Business Rule Engine
 
Drools @ IntelliFest 2012
Drools @ IntelliFest 2012Drools @ IntelliFest 2012
Drools @ IntelliFest 2012
 
Azure Business rules v0.3
Azure Business rules v0.3Azure Business rules v0.3
Azure Business rules v0.3
 
Square's Machine Learning Infrastructure and Applications - Rong Yan
Square's Machine Learning Infrastructure and Applications - Rong YanSquare's Machine Learning Infrastructure and Applications - Rong Yan
Square's Machine Learning Infrastructure and Applications - Rong Yan
 
Construire un moteur d'inférence
Construire un moteur d'inférenceConstruire un moteur d'inférence
Construire un moteur d'inférence
 
L'approche par regles metier
L'approche par regles metierL'approche par regles metier
L'approche par regles metier
 
Use Cases for Elastic Search Percolator
Use Cases for Elastic Search PercolatorUse Cases for Elastic Search Percolator
Use Cases for Elastic Search Percolator
 
Backward chaining rule-based system
Backward chaining rule-based systemBackward chaining rule-based system
Backward chaining rule-based system
 
Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013Getting started with Apache Camel - May 2013
Getting started with Apache Camel - May 2013
 
Apache UIMA Introduction
Apache UIMA IntroductionApache UIMA Introduction
Apache UIMA Introduction
 
eServices-Tp3: esb
eServices-Tp3: esbeServices-Tp3: esb
eServices-Tp3: esb
 
eServices-Tp5: api management
eServices-Tp5: api managementeServices-Tp5: api management
eServices-Tp5: api management
 
eServices-Tp4: esb++
eServices-Tp4: esb++eServices-Tp4: esb++
eServices-Tp4: esb++
 
eServices-Tp2: bpel
eServices-Tp2: bpeleServices-Tp2: bpel
eServices-Tp2: bpel
 

Semelhante a Rule engine

Towards automating machine learning: benchmarking tools for hyperparameter tu...
Towards automating machine learning: benchmarking tools for hyperparameter tu...Towards automating machine learning: benchmarking tools for hyperparameter tu...
Towards automating machine learning: benchmarking tools for hyperparameter tu...PyData
 
What the Brain says about Machine Intelligence
What the Brain says about Machine Intelligence What the Brain says about Machine Intelligence
What the Brain says about Machine Intelligence Numenta
 
Advanced Hyperparameter Optimization for Deep Learning with MLflow
Advanced Hyperparameter Optimization for Deep Learning with MLflowAdvanced Hyperparameter Optimization for Deep Learning with MLflow
Advanced Hyperparameter Optimization for Deep Learning with MLflowDatabricks
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptxRamanRay105
 
Useful Techniques in Artificial Intelligence
Useful Techniques in Artificial IntelligenceUseful Techniques in Artificial Intelligence
Useful Techniques in Artificial IntelligenceIla Group
 
A Platform for Accelerating Machine Learning Applications
 A Platform for Accelerating Machine Learning Applications A Platform for Accelerating Machine Learning Applications
A Platform for Accelerating Machine Learning ApplicationsNVIDIA Taiwan
 
Artificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support ProjectArtificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support ProjectValerii Klymchuk
 
Optimizing thread performance for a genomics variant caller
Optimizing thread performance for a genomics variant callerOptimizing thread performance for a genomics variant caller
Optimizing thread performance for a genomics variant callerAllineaSoftware
 
Inerview Quesion on Data Mining and Machine Learning
Inerview Quesion on Data Mining and Machine LearningInerview Quesion on Data Mining and Machine Learning
Inerview Quesion on Data Mining and Machine LearningYash Diwakar
 
Deploying signature verification with deep learning
Deploying signature verification with deep learningDeploying signature verification with deep learning
Deploying signature verification with deep learningAdam Gibson
 
Drablos Composite Motifs Bosc2009
Drablos Composite Motifs Bosc2009Drablos Composite Motifs Bosc2009
Drablos Composite Motifs Bosc2009bosc
 
11 expert systems___applied
11 expert systems___applied11 expert systems___applied
11 expert systems___appliedSachin Sharma
 
Deep learning with kafka
Deep learning with kafkaDeep learning with kafka
Deep learning with kafkaNitin Kumar
 
Single Console for viewing OpManager & DeviceExpert Alarms
Single Console for viewing OpManager & DeviceExpert AlarmsSingle Console for viewing OpManager & DeviceExpert Alarms
Single Console for viewing OpManager & DeviceExpert AlarmsManageEngine, Zoho Corporation
 

Semelhante a Rule engine (20)

Caddie presentation
Caddie presentationCaddie presentation
Caddie presentation
 
Towards automating machine learning: benchmarking tools for hyperparameter tu...
Towards automating machine learning: benchmarking tools for hyperparameter tu...Towards automating machine learning: benchmarking tools for hyperparameter tu...
Towards automating machine learning: benchmarking tools for hyperparameter tu...
 
What the Brain says about Machine Intelligence
What the Brain says about Machine Intelligence What the Brain says about Machine Intelligence
What the Brain says about Machine Intelligence
 
Neural Networks-1
Neural Networks-1Neural Networks-1
Neural Networks-1
 
Advanced Hyperparameter Optimization for Deep Learning with MLflow
Advanced Hyperparameter Optimization for Deep Learning with MLflowAdvanced Hyperparameter Optimization for Deep Learning with MLflow
Advanced Hyperparameter Optimization for Deep Learning with MLflow
 
Nimbus
NimbusNimbus
Nimbus
 
Xomics brochure 2013
Xomics brochure 2013Xomics brochure 2013
Xomics brochure 2013
 
Memory organization.pptx
Memory organization.pptxMemory organization.pptx
Memory organization.pptx
 
Useful Techniques in Artificial Intelligence
Useful Techniques in Artificial IntelligenceUseful Techniques in Artificial Intelligence
Useful Techniques in Artificial Intelligence
 
Machine Learning
Machine LearningMachine Learning
Machine Learning
 
Customer Case Study - PLANCK
Customer Case Study - PLANCKCustomer Case Study - PLANCK
Customer Case Study - PLANCK
 
A Platform for Accelerating Machine Learning Applications
 A Platform for Accelerating Machine Learning Applications A Platform for Accelerating Machine Learning Applications
A Platform for Accelerating Machine Learning Applications
 
Artificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support ProjectArtificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support Project
 
Optimizing thread performance for a genomics variant caller
Optimizing thread performance for a genomics variant callerOptimizing thread performance for a genomics variant caller
Optimizing thread performance for a genomics variant caller
 
Inerview Quesion on Data Mining and Machine Learning
Inerview Quesion on Data Mining and Machine LearningInerview Quesion on Data Mining and Machine Learning
Inerview Quesion on Data Mining and Machine Learning
 
Deploying signature verification with deep learning
Deploying signature verification with deep learningDeploying signature verification with deep learning
Deploying signature verification with deep learning
 
Drablos Composite Motifs Bosc2009
Drablos Composite Motifs Bosc2009Drablos Composite Motifs Bosc2009
Drablos Composite Motifs Bosc2009
 
11 expert systems___applied
11 expert systems___applied11 expert systems___applied
11 expert systems___applied
 
Deep learning with kafka
Deep learning with kafkaDeep learning with kafka
Deep learning with kafka
 
Single Console for viewing OpManager & DeviceExpert Alarms
Single Console for viewing OpManager & DeviceExpert AlarmsSingle Console for viewing OpManager & DeviceExpert Alarms
Single Console for viewing OpManager & DeviceExpert Alarms
 

Rule engine

  • 1. Balaji Venugopal Vimal Kumar
  • 2. Definition A rule engine is a piece of software, which having some knowledge is able to perform conclusions. Rules Engines are the pluggable software components that separate the business rules from the application code • A system that attempts to act as a domain expert
  • 3. Some frequently asked questions Why use a Rule Engine? When should I use a rule engine? What advantage does a rule engine have over hand coded "if...then" approaches? We will attempt to address these questions…….
  • 4. Why use a Rule Engine? If “Procedural Code” is available then why RULE ENGINE ? The Problem • Have you developed/seen code with so many nested if statements that actually looked like a nest?
  • 5. Why use a Rule Engine? The Problem (Contd…) • Have you spent sleepless nights debugging code when you modified one of those 'if' statements and found that it distorted the next if statement? • Ever wondered how others implement these?
  • 6. Why use a Rule Engine? The Solution • “Rule engines are a great way to collect complex decision-making logic and work with data sets too large for humans to effectively use.”
  • 7. When should I use a Rule Engine? "when there is no satisfactory traditional programming approach to solve the problem." Complicated logic (not 1+1 = 2)‫‏‬
  • 8. The Robot Example Teaching a robot to prepare breakfast cereal (in an optimal environment) START putOnTable(bowl) putOnTable(spoon) putOnTable(napkin) open(cereal-container) pour(cereal) open(milk-container) pour(milk) inviteOwner("You may begin eating") END
  • 9. The Robot Example Teaching a robot to drive is much more difficult because the task vary according to environmental conditions a. Robot must not do the tasks for backing out of garage if the garage door is closed or if there is a little girl on a tricycle right behind the car b. Backing out will be different on warm days and cold days. Also, in a parking spaces, backing up procedures will be different in different Settings c. So many different circumstances lead to endless logic branching d. Solution: independent rules that are integrated in an inference engine: IF the engine has stalled THEN start car IF you hear sirens THEN pull over to the curb etc.
  • 10. When should you use a Rule Engine? Changes often (whatever that means)‫‏‬ Traditional approaches are unmaintainable The problem is beyond any obvious algorithmic solution Domain experts (or business analysts) are readily available, but are nontechnical
  • 11. Advantages of a Rule Engine Declarative Programming Logic and Data Separation Speed and Scalability Centralization of Knowledge Tool Integration Explanation Facility
  • 12. High Level view of a Rule Engine
  • 13.
  • 14. Working Memory. The data that rules work on. Also called the fact base. Production Memory. Knowledge and inferences are stored in rules, which are called production rules. Pattern Matcher. Determines which rules to apply to the data in working memory. • There are a number of algorithms used for Pattern Matching by Inference Engines including: • Linear • Rete • Treat • Leaps Agenda. Determines the order of execution of rules. Execution Engine. The part of the rules engine that is responsible for applying rules to data and then performing the action part of the rules that have fired.
  • 15. Architecture of Typical Rule Based System observed data working memory select modify rule Inference memory fire output engine
  • 16. Reasoning with production rules  Architecture of a typical production system: New information working memory select modify rule interpreter memory fire output
  • 17. Reasoning with production rules  Architecture of a typical production system: New information select working memory modify rule interpreter memory fire output
  • 18. Reasoning with production rules  Architecture of a typical production system: New information working memory select modify Inference rule engine memory output fire executes actions
  • 19. Reasoning with production rules  Architecture of a typical production system: New information working memory select modify Inference rule engine memory fire executes output actions
  • 20. Reasoning with production rules  Architecture of a typical production system: New information select working memory modify rule interpreter memory fire output
  • 21. Reasoning with production rules  Architecture of a typical production system: New information working memory select modify Inference rule engine memory executes output fire actions
  • 22. Reasoning with production rules  Architecture of a typical production system: New information working memory select modify Inference rule engine memory executes fire output actions
  • 23. Methods of execution for a rule system Forward Chaining Backward Chaining Goal Goal Start Start
  • 24. Forward Chaining Goal conclude the color of my pet Fritz Working Memory Rule Base he croaks 1. If X croaks and eats flies - Then X is a frog eats flies 2. If X chirps and sings - Then X is a canary 3. If X is a frog - Then X is green 4. If X is a canary - Then X is yellow
  • 25. Working Memory Rule Base he croaks 1. If X croaks and eats flies - Then X is a frog eats flies 2. If X chirps and sings - Then X is a canary 3. If X is a frog - Then X is green 4. If X is a canary - Then X is yellow the color of my pet Fritz Working Memory GREEN he croaks eats flies frog
  • 26. Backward Chaining Goal conclude the color of my pet Fritz Working Memory Rule Base he croaks 1. If X croaks and eats flies - Then X is a frog eats flies 2. If X is a frog - Then X is green 3. If X is a canary - Then X is yellow
  • 27. Goal List Rule Base 1. conclude the color of my pet 1. If X croaks and eats flies - Then X is a frog Fritz 2. If X chirps and sings - Then X is a canary 3. If X is a frog - Then X is green 4. If X is a canary - Then X is yellow Goal List Working Memory 1. conclude the color of my pet Fritz he croaks 2. X is a frog eats flies 3. X is a canary So my pet Fritz Is frog Is Green He croaks and eats flies
  • 28. Solutions Which Are Attracting The Use Of Business Rules For More Efficiency • Marketing/Campaign • Business Process/Workflow • Management Account • Data Validation/Formatting • Management/Personalization • Self-Service Web Inquiries Behavior Scoring • Regulatory Compliance • Product / Service Recommendation • Order Configuration • Underwriting • Call Center/CRM (Lending/Insurance) • Fraud Detection • Diagnostics/Problem Resolution • Authorization • Sales Commission Calculation • Benefits Analysis • Pension Portfolio Marketing • Manufacturing Process • Risk Analysis • Claims Processing • Compliance Enforcement • Database Migration Tool.
  • 30. Heart of the System