decision tables - a brief overview dr. rogelio dávila pérez itesm, campus guadalajara

28
Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Upload: brenda-newth

Post on 31-Mar-2015

223 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Decision Tables - a brief overview

Dr. Rogelio Dávila Pérez

ITESM, Campus Guadalajara

Page 2: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Index

Definition

Structure

Steps to build a decision table

Example

Solution to the example

Exercises

Page 3: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Decision Tables

In the 50's General Electric, the Sutherland Corporation, and the United States Air Force worked on a complex file maintenance project, using flowcharts and traditional narratives, they spend six labor-years of effort but failed to define the problem.

It was not until 1958, when four analysts using decision tables, successfully defined the problem in less than four weeks 1.

_____________________________________1Taken from “A History of Decision Tables” located at http://www.catalyst.com/products/logicgem/overview.html

Page 4: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Definition

Tables represent an easy way for humans to read, understand and execute complex procedures, particular policies, etc.

A decision table is a useful tool that allows us:- To present decision procedures in a clear tabular form. - To understand complex logic expressed in traditional

narrative form.- To check for inconsistencies verifying that every possibility

was considered in the solution.

Page 5: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Structure

A decision table is typically divided in four areas:

The conditions are decisions that depending on their values, define different states of affairs in the problem.

Actions (effects, results, etc.) are operations or values that will be determined by particular circumstances.

ConditionsCondition

Alternatives

Actions Action Entries

Page 6: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

<cond-1> F T F T F T F T … T

<cond-2> F F T T F F T T … T

<cond-3> F F F F T T T T … T

… …

<cond-n> F F F F F F F F … T

<action-1>       X X   X     X

<action-2>   X       X X     X

<action-3>     X X   X   X    

… …

<action-m> X       X         X

Actions

Conditions

All possible combinations

Actions per combination (each column represents a different state of affairs)

Page 7: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Steps to create a decision table

1. List all the conditions which determine which action to take.

2. Calculate the space of combinations.

3. Fill all combinations in the table.

4. Analyze column by column to determine which actions are appropriate for each combination.

5. Reduce the table by eliminating redundant columns.

Page 8: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

ExamplePolicy for charging charter flight costumers

for certain in-flight services:2

If the flight is more than half-full and costs more than $350 per seat, we serve free cocktails unless it is a domestic flight. We charge for cocktails on all domestic flights; that is, for all the ones where we serve cocktails. (Cocktails are only served on flights that are more than half-full.)

_____________________________________2 Example taken form: Structured Analysis and System Specification, Tom de Marco, Yourdon inc., New York, 1979.

Page 9: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

List all the conditions that determine which action to take.

Conditions Values

The flight more than half-full?

Yes (Y), No (N)

Cost is more than $350? Y, N

Is it a domestic flight? Y, N

Page 10: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Calculate the space of combinations

Conditions

Number of Combinations

Possible Combinations

1 2 Y N

2 4 YY

NY

YN

NN

3 8 YYY

NYY

YNY

NNY

YYN

NYN

YNN

NNN

… …

n 2n

Page 11: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Calculate the space of combinations1

Number of Values to the power of the number of conditions with these values

If all conditions are simply Y/N values:2number of conditions

If 1 condition with 3 values and 3 with 2:31 * 23 = 24

Or, use the values per condition and multiply each value down the column, e.g. 3*2*2*2=24_____________________________________

1 Taken from Mariel de Wilde’s Decision Table Training Session

Page 12: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Calculate the space of combinations

Conditions in the example are 3 and all are two-valued ones, hence we have:

All combinations are 23 = 8

Page 13: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Fill all combinations in the table.

Page 14: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Analyze column by column to determine which actions are appropriate for each combination

Page 15: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Note that some columns are identicalbut by one condition.

Page 16: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Note that some columns are identicalbut by one condition.

Which means that actions are independent fromthe value of that particular condition.

Page 17: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Note that some columns are identicalbut by one condition.

Which means that actions are independent fromthe value of that particular condition.

Hence, the tablecan be simplified.

Page 18: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

First we combine the yellow onesnullifying the condition.

Page 19: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

First we combine the yellow ones nullifying the condition.

Then the red ones.

Page 20: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

First we combine the yellow ones nullifying the condition.

Then the red ones.

Notice that yellow and red columns are identical but by one condition.

Page 21: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

First we combine the yellow ones nullifying the condition.

Then the red ones.

Notice that yellow and red columns are identical but by one condition.

So, we combine them.

Page 22: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

First we combine the yellow ones nullifying the condition.

Then the red ones.

Notice that yellow and red columns are identical but by one condition.

So, we combine them.

Then we combine the violet colored ones.

Page 23: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Notice that even when we observe that the green columns seem to be identical but by one condition.

Page 24: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Notice that even when we observe that the green columns are identical but by one condition.

It is not the same a “NULIFYIED” condition than a valued one.

Page 25: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Reduce the table by eliminating redundant columns.

Notice that even when we observe that the green columns are identical but by one condition.

It is not the same a “NULIFYIED” condition than a valued one.

BE CAREFUL, DO NOT OVERSIMPLIFY THE TABLE OR IT WILL GET REDUNDANT.

Page 26: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

Final solution4

_____________________________________4 In previous steps, other combinations were possible that if followed would have led to different but equivalent solution tables.

Page 27: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

ExercisesSubsidy policy for the cub scout pack3:

The subsidy to the cub scout pack is based on number of scouts, rank, and length of membership. The subsidy for each scout is $25 for first-year members, $35 for second-year members, and $50 for scouts who have been members longer than two years. In addition to this base, each scout gets an extra subsidy of $10 if he has attained the rank of Wolf, $15 if he has attained the rank of Bear, and $20 if he has attained the rank of Lion – unless he does it in his first year, in which case he receives $70.

_____________________________________3 Example taken form: Structured Analysis and System Specification, Tom de Marco, Yourdon inc., New York, 1979.

Page 28: Decision Tables - a brief overview Dr. Rogelio Dávila Pérez ITESM, Campus Guadalajara

ExercisesSpecify the following policy using a decision table: 1

A mailing is to be sent out to customers. The content of the mailing is about the current level of discounting and potential levels of discounting. The content is different for different types of customers.

Customer Types A, B and C get a normal letter except Customer Type C, who get a special letter. Any customer with 2 or more current lines or with a credit rating of ‘X’ get a special paragraph added with an offer to subscribe to another level of discounting.

_____________________________________1 Taken from Mariel de Wilde’s Decision Table Training Session