8/8/2019 Rule Engine Ppshow
1/32
Balaji Venugopal Vimal Kumar
8/8/2019 Rule Engine Ppshow
2/32
A rule engine is a piece of software, which having someknowledge is able to perform conclusions.
Rules Engines are the pluggable software componentsthat separate the business rules from the application code
A system that attempts to act as a domain
expert
Definition
8/8/2019 Rule Engine Ppshow
3/32
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?
Some frequently asked questions
We will attempt to address these
questions.
8/8/2019 Rule Engine Ppshow
4/32
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?
8/8/2019 Rule Engine Ppshow
5/32
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?
8/8/2019 Rule Engine Ppshow
6/32
The Solution
Rule engines are a great way to collect complex decision-making logicand work with data sets too large for humans to effectively use.
Why use a Rule Engine?
8/8/2019 Rule Engine Ppshow
7/32
Complicated logic (not1+1 = 2)
When should I use a Rule Engine?"when there is no satisfactory traditional programming
approach to solve the problem."
8/8/2019 Rule Engine Ppshow
8/32
The Robot Example
Teaching a robot to prepare breakfast cereal (in an optimal environment)
STARTputOnTable(bowl)
putOnT
able(spoon)putOnTable(napkin)open(cereal-container)pour(cereal)open(milk-container)pour(milk)
inviteOwner("You may begin eating")END
8/8/2019 Rule Engine Ppshow
9/32
The Robot Example
Teaching a robot to drive is much more difficult because the task varyaccording
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 aparking 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 stalledTHEN start car
IF you hear sirensTH
EN pull over to the curbetc.
8/8/2019 Rule Engine Ppshow
10/32
Changes often (whatever thatmeans)
Traditional approaches are unmaintainable
The problem is beyond any obvious algorithmic solution
Domain experts (or business analysts) are readily available, but arenontechnical
When should you use a Rule Engine?
8/8/2019 Rule Engine Ppshow
11/32
Declarative Programming
Logic and Data Separation
Speed and Scalability
Centralization of Knowledge
Tool Integration
Explanation Facility
Advantages of a Rule Engine
8/8/2019 Rule Engine Ppshow
12/32
High Level view of a Rule Engine
8/8/2019 Rule Engine Ppshow
13/32
8/8/2019 Rule Engine Ppshow
14/32
8/8/2019 Rule Engine Ppshow
15/32
Architecture ofTypical Rule Based
System
rulememory
Inferenceengine
working memory
observed data
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
16/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
interpreter
working memory
New information
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
17/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
interpreter
working memory
New information
fire
modify
select
output
8/8/2019 Rule Engine Ppshow
18/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
Inference
engine
executes
actions
working memory
New information
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
19/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
Inference
engine
executes
actions
working memory
New information
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
20/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
interpreter
working memory
New information
fire
modify
select
output
8/8/2019 Rule Engine Ppshow
21/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
Inferenceengine
executesactions
working memory
New information
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
22/32
Reasoning with production rules
l Architecture of a typical productionsystem:
rulememory
Inferenceengine
executes
actions
working memory
New information
fire
modifyselect
output
8/8/2019 Rule Engine Ppshow
23/32
Methods of execution for a rule system
Forward Chaining Backward Chaining
Goal
Start
Goal
Start
8/8/2019 Rule Engine Ppshow
24/32
Goal
conclude the color ofmy pet Fritz
Forward Chaining
Working Memory
he croakseats flies
Rule Base
1. IfX croaks and eats flies - Then X is a frog2. IfX chirps and sings - Then X is a canary
3. IfX is a frog - Then X is green4. IfX is a canary - Then X is yellow
8/8/2019 Rule Engine Ppshow
25/32
Working Memory
he croakseats flies
Rule Base
1. IfX croaks and eats flies - Then X is a frog2. IfX chirps and sings - Then X is a canary
3. IfX is a frog - Then X is green4. IfX is a canary - Then X is yellow
Working Memory
he croakseats flies
frog
the color of my et Fritz
GREEN
8/8/2019 Rule Engine Ppshow
26/32
Backward Chaining
Working Memory
he croakseats flies
Rule Base
1. IfX croaks and eats flies - Then X is a frog2. IfX is a frog - Then X is green
3. IfX is a canary - Then X is yellow
Goal
conclude the color ofmy pet Fritz
8/8/2019 Rule Engine Ppshow
27/32
Rule Base
1. IfX croaks and eats flies - Then X is a frog
2. IfX chirps and sings - Then X is a canary3. IfX is a frog - Then X is green4. IfX is a canary - Then X is yellow
Goal List
1. conclude the color of my petF
ritz
Goal List
1. conclude the color of my pet Fritz2. X is a frog
3. X is a canary
Working Memory
he croakseats flies
o my et Fritz
Is frog Is Green He croaks and eats flies
8/8/2019 Rule Engine Ppshow
28/32
Business Process/Workflow
Data Validation/Formatting Self-ServiceWeb Inquiries Regulatory Compliance
Order Configuration Call Center/CRM Fraud Detection
Authorization Benefits Analysis
Manufacturing Process Claims Processing
Compliance Enforcement Database Migration Tool.
SolutionsWhich Are AttractingThe Use Of
Business Rules For More Efficiency
Marketing/Campaign Management Account Management/Personalization
Behavior Scoring Product / Service
Recommendation Underwriting
(Lending/Insurance) Diagnostics/Problem Resolution Sales Commission Calculation Pension Portfolio Marketing Risk Analysis
8/8/2019 Rule Engine Ppshow
29/32
8/8/2019 Rule Engine Ppshow
30/32
Heart of the System
8/8/2019 Rule Engine Ppshow
31/32
8/8/2019 Rule Engine Ppshow
32/32
Top Related