1. Home
  2. Preparing a decision table

Preparing a decision table

Print Friendly, PDF & Email

◷ Reading Time: 6 minutes

There are several ways to model a Decision Table. No matter what method is used, the end result will be a IIterable<ITable>. This can be used to execute the table.

For the purposes of this article, we picked a simple airline policy. We will model this in different ways.

Airline Passenger Discount Policy

An airline offers only flights to India and Asia. Under special conditions, a discount is offered on the normal airfare:

  • Passengers older than 18 with destinations in India are offered a discount of 20%, as long as the departure is not on a Monday or Friday.
  • For destinations outside of India, passengers are offered a discount of 25%, if the departure is not on a Monday or Friday.
  • Passengers who stay at least 6 days at their destination receive an additional discount of 10%.
  • Passengers older than 2 but younger than 18 years are offered a discount of 40% for all destinations.
  • Children 2 and under travel for free.

Extracting Rules

If all the conditions and actions from the scenario are extracted, you can summarize it as follows:

Conditions:

  • Destination (India, Asia)
  • Passenger Age (<= 2, > 2 && < 18, > 18
  • Depart on Monday or Friday (Yes, No)
  • Stay 6 days or more (Yes, No)

Actions:

  • Travel Free
  • 0% discount
  • 10% discount
  • 20% discount
  • 40% discount

Number of rules: 2 values * 3 values * 2 values * 2 values = 24 rules

Now we dump the result in a simple table to visualize a combination of all these conditions.

Scenarios

For rules 1 to 4, and 13 to 16, you’ve got an interesting set of actions: some of these columns state a 10% discount for staying 6+ days, but all of these columns also state that these passengers travel for free. Since a passenger traveling for free can’t receive an additional discount, we can combine all 8 rules into rule #1, as shown below.

You can reduce rules 10 and 22 (passengers over 18 departing on a Monday/Friday who are staying less than 6 days, regardless of destination, get no discount at all) although this may be hard to see until after you reduce the table at least once.

We can also reduce rules 5/7 (passengers traveling to India, between 3 and 18 years of age, staying 6+ days (it doesn’t matter what day they leave) and 6/8 (same as previous, except staying less than 6 days).

You can reduce rules 10 and 22 (passengers over 18 departing on a Monday/Friday who are staying six days or more, regardless of destination, get no discount at all), although this may be hard to see until after you reduce the table at least once.

Similarly, you can reduce rules 9 and 21 (passengers over 18 departing on a Monday/Friday who are staying less than six days, regardless of destination, get a 10% discount).

Reduced Table

(Reference: http://www-acad.sheridanc.on.ca/~jollymor/info16029/week4.html)

Preparing Decision Table

Now we can define the aging groups as shown in the following definition:

  • Group1 : <=2
  • Group2 : 3-18
  • Group3 : >18

It is simpler when we prepare a model to help make a decision. It would encapsulate all conditions:

  • Destination: The destination of travel
  • AgeGroup: The aging group as defined
  • IsWeekDay: The condition for “Depart Mon/Fri?”
  • StaryMoreThan6: The condition for “Stay >= 6 Days?”

And last, we change the table into a vertical table in which conditions/actions sit in columns. We can then have Decision Table like this:

DestinationAgeIsWeekDayMoreThan6Discount
Rule 1Group1100
Rule 2IndiaGroup2Y40
Rule 3IndiaGroup2N50
Rule 4Group3YN0
Rule 5Group3YY10
Rule 6IndiaGroup3NY30
Rule 7IndiaGroup3NN20
Rule 8AsiaGroup2YY50
Rule 9AsiaGroup2YN40
Rule 10AsiaGroup2NY75
Rule 11AsiaGroup2NN65
Rule 12AsiaGroup3NY35
Rule 13AsiaGroup3NN25

We do not need the Rule name (the first column)

The final table looks like this:

DestinationAgeIsWeekDayMoreThan6Discount
Group1100
IndiaGroup2Y40
IndiaGroup2N50
Group3YN0
Group3YY10
IndiaGroup3NY30
IndiaGroup3NN20
AsiaGroup2YY50
AsiaGroup2YN40
AsiaGroup2NY75
AsiaGroup2NN65
AsiaGroup3NY35
AsiaGroup3NN25

This table is now the source for modeling. In fact, this exact table can be executed by your application with a few more additional rows.

What’s next?

  1. Introduction to decision tables
  2. Preparing a decision table
  3. Modeling decision table
  4. Decision Model and Notation – decision table
  5. Check overlaps
  6. Decision Table final logic
  7. Multilingual decision table
  8. Decision Table 101

Tutorials

  1. Decision Table Hello World
Updated on July 9, 2019

Was this article helpful?