Modeling and Design of Rule-Based Systems Yonglei Tao.

Slides:



Advertisements
Similar presentations
Preparing a Decision Table
Advertisements

Chapter 5 Normalization of Database Tables
CHAPTER OBJECTIVE: NORMALIZATION THE SNOWFLAKE SCHEMA.
Decision-Table Test Case Generation. DT terminology 2.
Decision Table Based Testing
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
Chapter 29: Integration Jacob Harper. The Integration Approach The order of adding components to a system is crucial Benefits to careful integration –
Finite state machines.
System Concepts for Process Modeling  Process Concepts  Process Logic  Decomposition diagrams and data flow diagrams will prove very effective tools.
Introduction to Databases CIS 5.2. Where would you find info about yourself stored in a computer? College Physician’s office Library Grocery Store Dentist’s.
Entity Event Modelling
Kendall & KendallCopyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall 9 Kendall & Kendall Systems Analysis and Design, 9e Process Specifications.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
© 2005 by Prentice Hall Chapter 9 Structuring System Requirements: Logic Modeling Modern Systems Analysis and Design Fourth Edition.
Sensitivity Analysis A systematic way of asking “what-if” scenario questions in order to understand what outcomes could possibly occur that would affect.
Equivalence Class Testing
Chapter What kinds of transactions are recorded in a purchases journal? A) Merchandise bought on account B) All cash payments C) Sale of merchandise.
PYP002 Intro.to Computer Science Microsoft Word1 Lab 07 Creating Documents with Efficiency and Consistency.
Fundamentals of Python: From First Programs Through Data Structures
Chapter 9 Structuring System Requirements: Logic Modeling
CSCI 347 / CS 4206: Data Mining Module 03: Output Topic 02: Decision Tables.
Fundamentals of Python: First Programs
Database Tables two order-entry scenarios: A customer wants to cancel an order that she's placed. If her address is in a separate table from her.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 9.1.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Programming Logic and Design Fourth Edition, Introductory
Chapter 9 Designing Databases Modern Systems Analysis and Design Sixth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Normalization Transparencies
Examining data using Microsoft Access Queries Using Criteria and Calculations SESSION 3.2 This section covers specifying an exact match condition in a.
Computer Aided Process Planning (CAPP). What is Process Planning? Process planning acts as a bridge between design and manufacturing by translating design.
Structured Analysis.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 10 Normalization Pearson Education © 2009.
Dale Roberts 1 Program Control - Algorithms Department of Computer and Information Science, School of Science, IUPUI CSCI N305.
Spreadsheet Data Tables Data Table 1 allows you to change one input variable’s value at a time and record the impact that the input assumption has on several.
Sensitivity Analysis A systematic way of asking “what-if” scenario questions in order to understand what outcomes could possibly occur that would affect.
Sensitivity Analysis A systematic way of asking “what-if” scenario questions in order to understand what outcomes could possibly occur that would effect.
Chapter 8 Physical Database Design. Outline Overview of Physical Database Design Inputs of Physical Database Design File Structures Query Optimization.
Seg3430A Tutorial 8 Decision Table. Logic Modeling Data flow diagrams do not show the logic inside the processes Logic modeling involves representing.
© 2005 by Prentice Hall Chapter 9 Structuring System Requirements: Logic Modeling Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey.
CMSC 345 Fall 2000 Requirements Expression. How To Express Requirements Often performed best by working top- down Express general attributes of system.
11 Chapter 111 Sequential File Merging, Matching, and Updating Programming Logic and Design, Second Edition, Comprehensive 11.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 5 Making Decisions.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 1 Database Systems.
1 Management Information Systems M Agung Ali Fikri, SE. MM.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
©2010 Cengage Learning SLIDES FOR CHAPTER 6 QUINE-McCLUSKEY METHOD Click the mouse to move to the next page. Use the ESC key to exit this chapter. This.
 Problem Analysis  Coding  Debugging  Testing.
Decision Tables and Pseudocode
CHAPTER 6 Quine-McCluskey Method
Chapter 9 Structuring System Requirements: Logic Modeling
Control Structure Senior Lecturer
3.4 Computer systems Boolean logic Lesson 2.
Chapter 9 Structuring System Requirements: Logic Modeling
Chapter 9 Structuring System Requirements: Logic Modeling
Test Case Test case Describes an input Description and an expected output Description. Test case ID Section 1: Before execution Section 2: After execution.
Decision Tables SEEM 3430 Tutorial LI Jing.
Regression Testing.
Chapter 9 Structuring System Requirements: Logic Modeling
Chapter 9 Structuring System Requirements: Logic Modeling
Ladder Diagram Design: Huffman Method
Overview Functional Testing Boundary Value Testing (BVT)
Decision Tables SEEM 3430 Tutorial Lanjun Zhou.
Lab 07 Creating Documents with Efficiency and Consistency
Presentation transcript:

Modeling and Design of Rule-Based Systems Yonglei Tao

Key Takeaway Points  Business rules are decision-making rules  each consists of conditions and actions to perform when the conditions are met.  A decision table is used to specify business rules  check complete, consistent, and non-redundant  generate code  support test-case generation and test-driven development  enable rules to be updated dynamically 2

Business Rules of an Office Worker 10% Pay Raise Promotion Own Office Stay Quit 1234 Y x Y Y x Y - - x NN N 41 1 N N - x 2 Rule Count Decision Table 10% Pay Raise Promotion Own Office Stay Quit Y N Y Y Stay N N Quit Decision Tree 3

Decision Table Terminology 10% Pay Raise Promotion Own Office Stay Quit 1234 Y x Y Y x Y - - x NN N 41 1 N N - x 2 Rule Count Decision Table condition stubs condition entry action stubs For checking completeness = 2 3 =8 rule number action entry indifference or don’t care 4

Limited and Extended Entry customer rules covered request pay OK order Rule# 1 >2m - 3 X 2 <=2m 3 X reg. 12 due payment X 4 X new 1 no 5 X 2 <=2m new/ NR not new Extended entry decision table: non-binary. conditions extend into condition entries. 10% Pay Raise Promotion Own Office Stay Quit 1234 Y x Y Y x Y - - x NN N 41 1 N N - x 2 Rule Count Limited entry decision table 5

Systematic Decision Table Construction 1. Identify conditions that affect actions 2. Identify actions that are affected by conditions 3. Draw a table with appropriate rows and columns 4. Enter the conditions and actions into the condition stubs and action stubs 5. Systematically enter the condition values in the condition entries 6. For each condition combination, check the corresponding action(s). If the actions must be performed in a certain order, use serial numbers to indicate the order 6

Systematic Decision Table Construction 10% Pay Raise Promotion Own Office Stay Quit 1234 Y x Y N x N Y Y YY Y 11 1 Y N N 1 Rule Count 5678 N x Y N x N Y Y x NN Y 11 1 N N N x 1 xx 7

Progressive Decision Table Construction  Enter the conditions one at a time and completes a rule as early as possible promoted work interest 10% raise own office stay quite Y N N N N Y YY 8

Progressive Decision Table Construction 1) Draw a table of required rows and columns 2) Enter the actions into the action stubs. Stay Quit Rule Count Rule # 9

Progressive Decision Table Construction 3) Enter one of the conditions into condition stub and one of the condition value into the condition entry. Save the remaining values. Promotion 1 Y Remaining Values Stay Quit Rule Count Rule # N 10

Progressive Decision Table Construction 4) If the rule can lead to an action then  enter “-” in the remaining conditions  check the appropriate action entries  begin a new rule: copy all the condition entries of the previous rule except the last condition  enter one of the remaining values of the last condition Promotion 1 Y Remaining Values Stay Quit Rule Count Rule # N 11

Progressive Decision Table Construction  else  enter another condition and one of its values  save the remaining values >=10% Raise Y N Promotion 1 Y Remaining Values Stay Quit Rule Count Rule # N 12

Progressive Decision Table Construction 5) Repeat the above step promoted work interest 10% raise own office stay quite Y N N N N Y YY >=10% Raise Y N Promotion 1 Y Remaining Values Stay Quit Rule Count Rule # N X -- 2 Y N X 3 N Y N Work Interest Y N -- X 4 N Y N Own Office Y N X 5 N Y N N X 13

Quality Aspect of Decision Table  Completeness  are there missing rules?  check by the rule count  are there missing conditions or actions?  application dependent  Consistency  is there more than one rule with the same condition combination but different actions?  does a rule have conflicting actions?  Non-redundancy  can/should some rules be eliminated or merged? 14

Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N Y N X Y own office N Y N X N 5 N N Y X - 6 N N N X Y 7 N N N X N 8 Are there redundancies in the decision table? What problems can be caused by redundancy? Is there a systematic way to detect and remove redundancies? Decision Table Redundancy 15

Decision Table Redundancy  Problems  can cause inconsistency if one place is modified and the other is not, or  modified differently  the code is more tedious and more difficult to understand and maintain  Benefits to removal  shorter and more efficient code  code is easier to comprehend  will not cause redundancy related inconsistency Removing decision table redundancies is called “decision table consolidation.” 16

Decision Table Consolidation Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N Y N X Y own office N Y N X N 5 N N Y X - 6 N N N X Y 7 N N N X N 8 rule 4: !promoted & 10% raise & !work interest & own office ==> stay rule 7: !promoted & !10% raise & !work interest & own office ==> stay 17

Decision Table Consolidation rules 4+7: (!promoted & !work interest & own office) ==> stay Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N Y N X Y own office N Y N X N 5 N N Y X - 6 N N N X Y 7 N N N X N 8 Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N -- N X Y own office N Y N X N 5 N N Y X - 6 N N N X N 8 Rule 7 deleted. Rule 4 changed. 18

Decision Table Consolidation Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N -- N X Y own office N Y N X N 5 N N Y X - 6 N N N X N 8 Rules 5 and 8 differ on only one condition. So they can be merged. Rule# Rule Count Stay Quit 10% raise Y X promotedY 1 Y N X 2 N Y - - Y X 3 work interest N -- N X Y own office N -- N X N 5 N N Y X - 6 Rule 8 deleted and rule 5 changed. 19

Consolidation Algorithm 2 or more unmarked rules differ on only 1 condition? 1 of the rules has “-” for that condition? delete the other rules Halt Do the rules include all cases for that condition? replace the rules with 1 that has “-” for that condition Y Y Y N N N mark the rules as visited 20

Consolidation Algorithm Decision Table >2 or more unmarked rules differ on 1 condition? 1 of the rules has “-” for condition? the rules include all cases for condition? Rule Count delete the other rules replace rules with one with “-” for condition go to this decision table halt Rule # Y YY Y Y N N N N -- X X X X X X

Code Generation from Decision Table  First, arrange the rows and columns so that the condition rows have increasing frequencies of alternating condition values  Draw a tree to highlight the alternating columns >1 rule differ on 1 condition? 1 of the rules has “-” for condition? the rules include all cases for condition? Rule Count delete the other rules replace rules with one with “-” for condition go to this decision table halt Rule # Y YY Y Y N N N N -- X X X X X X

Code Generation >1 rule differ on 1 condition? 1 of the rules has “-” for condition? the rules include all cases for condition? Rule Count delete the other rules replace rules with one with “-” for condition go to this decision table halt Rule # Y YY Y Y N N N N -- X X X X X X while (true) do if (not >1 rule differ on 1 condition) then break else if (1 of the rules has “--” for the condition) then delete the other rules else if (the rules include all cases) then replace rules with one with “--” for that condition end 23

Test Case Generation  Decision tables are commonly used to generate test cases for cause-effect testing  Each rule is a test case  identify the component under test  initialize the input with appropriate condition values  check the output of the actions  Support unit testing and system testing 24

Decision Tree >1 rule differ on 1 condition? Y N Halt 1 of the rules has “-” for condition? Y N the rules include all cases for condition? Y replace rules with one with “-” for condition; go to this table delete the other rules go to this table N Decision tree is another method to specify process logic. 25

Class Exercise  Using the consolidation algorithm decision table, consolidate the following decision table. More than $1M business/yr? Good payment history? With us more than 10 years? Priority treatment Normal treatment 1234 Y x Y N x N Y Y YY Y 11 1 Y N N 1 Rule Count 5678 N x Y N x N Y Y x NN Y 11 1 N N N x 1 x x 26

Competition of Telephone Companies  In the 1990s, U.S. telephone companies (AT&T, MCI, GTE) competed for customers intensively  They offered discount plans to attract customers  Each new plan required modification of conditional statements of the computer program  It required a lot of time to change, compile, test and debug the computer program  One company adopted a technology that gave it a competitive advantage  The technology is an application of the interpreter patterninterpreter pattern 27