decision tables and prologa [email protected] modelling business rules

44
Decision Tables Decision Tables and Prologa and Prologa [email protected] M M odelling Business odelling Business Rules Rules

Upload: aracely-homewood

Post on 31-Mar-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Decision TablesDecision Tablesand Prologaand Prologa

[email protected]

MModelling Business Rulesodelling Business Rules

Page 2: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

What is a decision table ?

Completeness criterion

Exclusivity criterion

Table Representing complete set of conditional expressions where expressions are mutually exclusive In a predefined area

Decision TablesDecision Tables

Page 3: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

condition entries (condition states)

condition stub (condition subjects)

action stub (action subjects) action entries (action values)

Decision TablesDecision Tables

Page 4: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

What kinds of knowledge ?What kinds of knowledge ?

Regulations, legislation, …Regulations, legislation, … Business rules, corporate policy, ...Business rules, corporate policy, ...

» accept/refuse ordersaccept/refuse orders

» discountsdiscounts

» ……

ExpertiseExpertise Classification knowledgeClassification knowledge

» types of customerstypes of customers

» risk categoriesrisk categories

» ……

Page 5: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

– Powerful visualisationPowerful visualisation

– Preventing errors is easierPreventing errors is easier

– Modular knowledge organisationModular knowledge organisation

– PerformancePerformance

Compact and structured presentation

Avoid incompleteness and inconsistency

Group rules into single table

Fast decision tree execution

Why use decision tables ?Why use decision tables ?

Page 6: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

if (credit limit = 'Ok') and (customer = 'Good') and (Stock Sufficient)if (credit limit = 'Ok') and (customer = 'Good') and (Stock Sufficient) then Execute Orderthen Execute Order

if (customer = 'Not Good') and (credit limit = 'Not Ok') then Refuse Orderif (customer = 'Not Good') and (credit limit = 'Not Ok') then Refuse Order

if (credit limit = 'Not Ok')if (credit limit = 'Not Ok') and (customer = 'Good') and (customer = 'Good') and and not(Stock Sufficient) not(Stock Sufficient) then Put On Waiting Listthen Put On Waiting List

if (Customer = 'Good') and (Stock Sufficient) then Execute Orderif (Customer = 'Good') and (Stock Sufficient) then Execute Order

if (Customer = 'Good') and not(Stock Sufficient) and (credit limit = 'Ok') then Put On Waiting Listif (Customer = 'Good') and not(Stock Sufficient) and (credit limit = 'Ok') then Put On Waiting List

if (credit limit = 'Ok') and (Customer = 'Not Good') and not(Stock Sufficient) then Put On Waiting Listif (credit limit = 'Ok') and (Customer = 'Not Good') and not(Stock Sufficient) then Put On Waiting List

if (credit limit = 'Ok') and (Stock Sufficient) and (Customer = 'Not Good') then Execute Orderif (credit limit = 'Ok') and (Stock Sufficient) and (Customer = 'Not Good') then Execute Order

Why use decision tables ?Why use decision tables ?

Page 7: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

The number of holidays depends on age and years of service. Every employee receives at least 22 days. Additional days are provided according to the following criteria:

Only employees younger than 18 or at least 60 years, or employees with at least 30 years of service will receive 5 extra days.

Employees with at least 30 years of service and also employees of age 60 or more, receive 3 extra days, on top of possible additional days already supplied.

If the employee has at least 15 but less than 30 years of service, 2 extra days are given. These 2 days are also provided for employees of age 45 or more. The 2 extra days can not be combined with the 5 extra days.

ExampleExample

Page 8: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Empty decision tableEmpty decision table

Page 9: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Decision rulesDecision rules Every employee receives at least 22 days.

Only employees younger than 18 or at least 60 years, or employees with at least 30 years of service will receive 5 extra days.

Rule 2: 5 extra days generally if only age < 18 or age >= 60 or service >= 30;

Rule 1: assign 22 days definitely if always;

Page 10: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Rule 3: 3 extra days generally if age >= 60 or service >= 30;

Employees with at least 30 years of service and also employees of age 60 or more, receive 3 extra days, on top of possible additional days already supplied.

If the employee has at least 15 but less than 30 years of service, 2 extra days are given. These 2 days are also provided for employees of age 45 or more. The 2 extra days can not be combined with the 5 extra days.

Rule 4: 2 extra days generally if (45 <= age < 60 or age >= 60 or 15 <= service < 30) minus rule 2;

Page 11: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

From common sense knowledge, it is clear that an employee younger than 18 years can not have 15 or more years of service. The impossible condition combinations should be discarded from the table by adding the rule:

Rule 5: impossible definitely if age < 18 and (15 <= service < 30 or service >= 30);

Page 12: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Rule 1: assign 22 days definitely if always;

Rule 2: 5 extra days generally if only age < 18 or age >= 60 or service >= 30;

Rule 3: 3 extra days generally if age >= 60 or service >= 30;

Rule 4: 2 extra days generally if (45 <= age < 60 or age >= 60 or 15 <= service < 30) minus rule 2;

Rule 5: impossible definitely if age < 18 and (15 <= service < 30 or service >= 30);

Page 13: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Expanded decision tableExpanded decision table

Page 14: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Contracted decision tableContracted decision table

Page 15: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Kinds of tablesKinds of tablestable w ith non-exclusive columns

decision table

rule table or decision grid chart

"c lassic" multiple hit table

the table representa tion of a ll singledecision columns

the compact table representa tion of a lldecision columns for a given conditionorder

the compact table representa tion of a lldecision columns for the optimalcondition order (cf. infra)

M H/AA ll H it

M H/FFirst H it

M HM ultiple H it

SH /XE xpanded

SH /CC ontrac ted

SH /OO ptimized

SHSingle H it

Page 16: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Holidays (multiple hit, all hits)Holidays (multiple hit, all hits)

Page 17: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Holidays (multiple hit, first hit)Holidays (multiple hit, first hit)

Page 18: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Holidays (single hit contracted)Holidays (single hit contracted)

Page 19: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

System of decision tablesSystem of decision tables Customer

Orders

Execute

Page 20: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Application areasApplication areas

1960 1970 1980 1990 2000

automation of construction

application field enlargement

advanced preprocessors

algorithms

initial preprocessors

initial developments

transformations

knowledge validation

knowledge engineering

conditional logic experiments

Page 21: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

3 aspects of a decision situation3 aspects of a decision situation

Specification(construction)

Representation(verification)

Implementation(decision making)

Page 22: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

InterfacesInterfaces

Text

Program Code

Rules

Decision Trees

ConsultationEnvironment

Expert SystemShells

Decision Tables

CasesExamples

Page 23: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Decision Tables?Decision Tables?

Decision Tables and PROLOGADecision Tables and PROLOGA

FeaturesFeatures

ExperiencesExperiences

PROcedural LOGic Analyzer

PrologaProloga

Page 24: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

PrologaProloga from...from... “a rule-based design tool for computer-

supported construction and manipulation of decision tables”

to…to…

“a tool environment that uses decision tables for knowledge modelling, validation, optimization and implementation”

Page 25: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Knowledge Modelling Tool Uses Decision Tables Integrated V&V Features Knowledge Optimization Consultation Engine Import/Export Facilities

To/From other knowledge representations

What is the PROLOGA system?What is the PROLOGA system?

Page 26: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Decision tables

Rules

Conditions

Actions

Table structures

Dependency graph

The Prologa system - PreviewThe Prologa system - Preview

Page 27: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

– Modelling featuresModelling features

– Verification & ValidationVerification & Validation

– Optimization featuresOptimization features

– Implementation featuresImplementation features

All table manipulations (fill by rules, refined specification language, compose, optimization)

Structures of tables, modularization

(Intra)tabular and intertabular

Minimal columns, minimal rules, interfaces

Why use Prologa?Why use Prologa?

Page 28: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Modelling Features (1)Modelling Features (1)

Building & manipulating decision tablesBuilding & manipulating decision tables– specify conditions & actionsspecify conditions & actions– reorder by drag & dropreorder by drag & drop– specify input rules :specify input rules :

Actions [generally] if condition combinationsNot action definitely if condition combinationsAction only possible if condition combinationsAction definitely if and only if condition combination

– fill in entries by mousefill in entries by mouse

Page 29: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Building Tables ; Screen Building Tables ; Screen Example Example

Page 30: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Modelling Features (2)Modelling Features (2)

Structures of tablesStructures of tables– Condition subtables :Condition subtables :

subtables that determine the state of a subtables that determine the state of a condition (e.g. when do you consider condition (e.g. when do you consider someone a good customer?)someone a good customer?)

– Action subtables :Action subtables : subtables that further elaborate on what additional subtables that further elaborate on what additional

knowledge holds for certain cases (e.g. what knowledge holds for certain cases (e.g. what discount to give if an order is accepted)discount to give if an order is accepted)

Page 31: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Table Structures ; ExampleTable Structures ; Example

"Execute Order" subtable"Execute Order" subtable

main tablemain table

"Customer" subtable"Customer" subtable

subtable further specifies what is understoodsubtable further specifies what is understood by the notion of a "good" customer by the notion of a "good" customer

"Execute Order" subtable is only applicable"Execute Order" subtable is only applicable in cases where Credit Limit = Ok in cases where Credit Limit = Ok and/or Customer = Good and/or Customer = Good

Page 32: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Modelling Features (3)Modelling Features (3)

Support for automatic modularizationSupport for automatic modularization

Page 33: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Our Modularization ApproachOur Modularization Approach

Rule 1 Rule 2

Rule 4

Rule 6

Rule 3

Rule 5

Rule 8

Rule 7

Rule 11

Rule 10

Rule 9

decomposing knowledge intomultiple-table structure

““Order”Order”

““Execute Order”Execute Order”

Page 34: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Working with ProjectsWorking with Projects

a “project” is a collection of related tablesa “project” is a collection of related tables consists of :consists of :

» prj-fileprj-file» MS Access database-fileMS Access database-file» tab-filestab-files

file management is handled by Prologafile management is handled by Prologa table linking based on logical table & variable table linking based on logical table & variable

names instead of tab-filenamesnames instead of tab-filenames consultation environmentconsultation environment other representation formalisms than tables other representation formalisms than tables

(future Prologa versions)(future Prologa versions)

Page 35: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Although the use of decision tables has been proposed before in V&V literature (Cragun, Puuronen), our viewpoint differs from these other approaches

decision tables as a modelling technique on its own, and not merely as a means towards verification of rule-based systems

As pointed out in (Preece 94), tools that verify rule-bases after operationalizing them into decision table format, generally fail to find anomalies that stretch beyond simple pairs of rules

full V&V between tables

Prologa and V&VProloga and V&V

Page 36: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

V&V FeaturesV&V Features

Intra-tabular verification : verify each tableIntra-tabular verification : verify each table– single-hit decision tablessingle-hit decision tables– contradiction messagescontradiction messages– verification reportverification report

Inter-tabular verification : verify different Inter-tabular verification : verify different (sub)tables with respect to each other(sub)tables with respect to each other

(topic of a current thesis)(topic of a current thesis)

inter-tabularinter-tabular

intra-tabularintra-tabular

Page 37: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

V&V ; ExampleV&V ; Example

Page 38: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

The cleanroom approach

Inconsistency or contradictionsAvoided by modelling tables

IncompletenessAvoided by automatic generation

RedundancyAvoided by table mechanism

Prologa and V&V experiencesProloga and V&V experiences

Page 39: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Optimization FeaturesOptimization Features

Table contractionTable contraction– merge columns with identical action partsmerge columns with identical action parts

Row order optimizationRow order optimization– less columns by changing order of condition less columns by changing order of condition

rowsrows Export to minimal rulesExport to minimal rules

– improved rule notationimproved rule notation

Page 40: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

OptimizationOptimization

Problem

(DGC)If Then Rules

Extended Rules(XDGC)

Decision Table

Exp

Contr

OptC

Optimal Execution Tree

Display

Execution Tree

Minimal Rules

Examples

Shell

Page 41: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Implementation FeaturesImplementation Features

Prologa’s consultation environmentProloga’s consultation environment AionDS generationAionDS generation Export to …Export to …

» PascalPascal

» CobolCobol

» Optimal codeOptimal code

What’s next ? What’s next ? » use Prologa to build Web-based applications (JAVA)use Prologa to build Web-based applications (JAVA)

» Prologa as OLE Server or Delphi-componentProloga as OLE Server or Delphi-component

Page 42: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Consultation Session ; ExampleConsultation Session ; Example

Page 43: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

AionDS Generation ; ExampleAionDS Generation ; Example

Page 44: Decision Tables and Prologa Jan.Vanthienen@econ.kuleuven.ac.be Modelling Business Rules

Credit_Limit CustomerGood Stock_Sufficient ExecuteOrder Refuse_Order Put_On_Waiting_List

ok y y x - -

ok y n - - xnot ok y y x - -

RuleNoNo

Subject Value1 Credit_Limit Ok1 Stock_Sufficient Y1 ExecuteOrder x2 Credit_Limit Ok2 Stock_Sufficient N2 Put_On_Waiting_List x3 Credit_Limit Not_Ok

VANTHIENEN J., WETS G., Integration of the Decision Table Formalism with a Relational Database Environment, Information Systems, 20 (7), pp. 595-616, 1995.

Storing the DT as a relational tableStoring the DT as a relational table

– Storing rules as dataStoring rules as data

Storing persistent decision tablesStoring persistent decision tables