Wednesday, 16 May 2012

Decision Trees and Decision Tables

Decision tree
  • It is a tree like structure that represents the various conditions and the subsequent possible actions.
  • It also shows the priority in which the conditions are to be tested or addressed.
  • Each of its branches stands for any one of the logical alternatives and hence the name tree. 
  • The decision sequence starts from the root of the tree that is usually on the left of the diagram.
  • The path to be followed to traverse the branches is decided by the priority of the conditions. 
  • A series of decisions are taken, as the branches are traversed from left to right. The nodes are the decision junctions (function points).
  • It is a tree like structure that represents the various conditions and the subsequent possible actions.
  • It also shows the priority in which the conditions are to be tested or addressed.
  • Each of its branches stands for any one of the logical alternatives and hence the name tree. 
  • The decision sequence starts from the root of the tree that is usually on the left of the diagram.
  • The path to be followed to traverse the branches is decided by the priority of the conditions. 
  • A series of decisions are taken, as the branches are traversed from left to right. The nodes are the decision junctions (function points).

Consider the following example which will be continued for today's entire discussion.

A manufacturing company has stated the following rules to prepare an invoice.
  1. Orders booked on or before 31st Jan, offer a discount of 10% on the items listed and displayed in the advertisement and 2% discount to be offered to the appointed dealers. 
  2. If the customer is within Maharashtra state and has a sales tax exemption certificate then no sales tax is levied. Otherwise 8% sales tax is charged on the sales value. If a customer is outside Maharashtra state then 4% central tax in place of sales tax is charged.
  3. For charging excise duty there are two categories.
  • Cat 1 – Attract 10% excise duty
  • Cat 2 – is exempted from excise duty
Form three independent decision tables respectively for discount, sales tax and excise duty to represent sales?
1)
Discount Decision Tree

2) 

Sales Tax Decision Tree


3)

Excise Duty Decision Tree

Decision Tables



A decision table is a matrix of rows and columns that shows conditions and actions. Decision rules, included in a decision table, state what procedure to follow when certain condition exists.
The decision table is made up of four sections: condition statements, condition entries, action statements, and action entries.
  • The condition statement identifies the relevant conditions. Condition Entries tell which value, if any, applies for a particular condition.
  • Action Statements lists the set of all steps that can be taken when a certain condition occurs. Action entries show what specific actions in the set to take when selected conditions or combinations of conditions are true.
The column on the right side of the table, linking conditions and actions, form decision rules, which state the conditions that must be satisfied for a particular set of actions to be taken.

Eliminating redundancy 
Decision tables can become too large and can grow in an uncontrolled fashion. Removing redundant entries can help manage table size. Redundancy occur when both of the following are true.
(1) Two decision rules are identical except for one condition row, and
(2) The actions for the two rules are identical.

Types of Table Entries

Limited Entry Form

It is one of the most commonly used formats. 

1) Discount Table

Conditions

Order on or before 31st Jan
Y
Y
Y
Y
N
N
N
N
Items Listed in Advertisement
Y
Y
N
N
Y
Y
N
N
Dealer Appointed
Y
N
Y
N
Y
N
Y
N









Actions
10% Discount
X
X
-
-
-
-
-
-
2% Discount
X
-
-
-
-
-
-
-
No Discount
-
-
X
X
X
X
X
X

After eliminating redundancy

Conditions

Order on or before 31st Jan
Y
Y
Y
N
Items Listed in Advertisement
Y
Y
N
-
Dealer Appointed
Y
N
-
-





Actions
10% Discount
X
X
-
-
2% Discount
X
-
-
-
No Discount
-
-
X
X
  

2) Sales Tax Table

Conditions

Customer in Maharashtra
Y
Y
N
N
Sales Tax Exemption Certificate
Y
N
Y
N





Actions
4% Central Tax
-
-
X
X
8% Service Tax
-
X
-
-
No Service Tax
X
-
-
-


After eliminating redundancy

Conditions

Customer in Maharashtra
Y
Y
N
Sales Tax Exemption Certificate
Y
N
-




Actions
4% Central Tax
-
-
X
8% Service Tax
-
X
-
No Service Tax
X
-
-


3) Excise Duty Table

Conditions

Category 1
Y
N
Category 2
N
Y



Actions
10% Excise Duty
X
-
No Excise Duty
-
X


Extended-Entry Form

It replaces Y & N with action entries telling the reader how to decide. In this format, the condition and action statements themselves are not complete, which is why the entries contain more details than Y & N.

Conditions

Item
Order on or before 31st Jan & listed by dealer
Order on or before 31st Jan & listed
Order on or before 31st Jan
Order after 31st Jan





Actions
Discount 12%
Discount 10%
No Discount
No Discount


Mixed-Entry Form

Analyst may prefer to combine features of both the limited and extended entry forms in the same table. Generally only one form should be used in each section of the table, but between the condition and action sections, either form can be used. 


Conditions

Item
Order on or before 31st Jan & listed by dealer
Order on or before 31st Jan & listed
Order on or before 31st Jan
Order after 31st Jan





Actions
10% Discount
X
X
-
-
2% Discount
X
-
-
-
No Discount
-
-
X
X

ELSE Form

This version of decision table is aimed at omitting repetition through ELSE rules. To build an ELSE-form decision table, specify rules with condition entries to cover all sets of actions except for one, which will be the rule to follow when none of the other explicit conditions is true. The ELSE rule eliminates the need to repeat conditions that lead to the same actions.

Conditions

Item
Order on or before 31st Jan & listed by dealer
Order on or before 31st Jan & listed
E
L
S
E




Actions
10% Discount
X
X
-
2% Discount
X
-
-
No Discount
-
-
X




Multiple Decision Tables

This is a way to control the size of decision tables by linking together multiple decision tables. Depending on the actions selected on the first table, additional actions are explained by one or more additional tables; each additional table provides greater details about the actions to be taken. Multiple tables also enable analysts to state what repetitive actions should occur after some decision have been made and will continue until a certain condition has been reached.

The tables are linked together in hierarchical fashion: a top-level table contains the major conditions which, when selected, determines what additional actions and tables to reference for further details. A transfer statement, such as GO TO or PERFORM in the action section of the controlling table, directs the routing to lower tables.  There are two types of transfer: direct and temporary.

Direct Transfer uses a onetime transfer. The referenced table does not refer back to the original table. The action statement “GO TO table name” indicates which table to examine next.

Temporary Transfer is achieved through the statement “PERFORM table 2”. At the end of the table 2 a RETURN statement sends the control back to the statement following in the controlling table.

Discount Table

Conditions

Item
Order on or before 31st Jan & listed by dealer
Order on or before 31st Jan & listed
E
L
S
E




Actions
10% Discount
X
X
-
2% Discount
X
-
-
No Discount
-
-
X
PERFORM Sales Tax Table
X
X
X
GO TO Excise Duty Table
X
X
X


Sales Tax Table

Conditions

Customer in Maharashtra
Y
Y
N
Sales Tax Exemption Certificate
Y
N
-




Actions
4% Central Tax
-
-
X
8% Service Tax
-
X
-
No Service Tax
X
-
-
RETURN
X
X
X


Excise Duty Table

Conditions

Category 1
Y
N
Category 2
N
Y



Actions
10% Excise Duty
X
-
No Excise Duty
-
X

No comments:

Post a Comment

Your comments are very much valuable for us. Thanks for giving your precious time.