Decision Table Rules Part 1 – The Exclusivity Problem

Summary

How the use of decision tables for modelling business rules gives rise to questions about whether rules are mutually exclusive.

Background

We have recently been using a form of decision table to classify a population of messages. We have constrained our decision table design in the following ways:

  1. We only allow conditions to have Boolean values
  2. We only allow our rules to specify either a Boolean constraint or ‘Don’t Care’ (represented by ‘%’)
  3. Our ‘action’ is simply to report the name of the rule that matched

So a typical decision table might look like this:

Name Condition 1 Condition 2 Condition 3
Rule A T T F
Rule B T % %
Rule C F T T

Conditions are “boiled down” to True or False for each message before they are fed into the decision table, so the decision table itself does not contain any logic about individual conditions. Or in other words, our decision table may know there is a condition called “Message has a valid sender reference”, which can be True or False, but it does not know that this condition was calculated by calling a stored procedure on an external reference data source.

The Problem

How do we ensure that there are no messages which match more than one rule? For example, the following message will match both Rule A and Rule B from the table above:

Condition 1 Condition 2 Condition 3
Message ABC T T F

There are several approaches to solving this problem:

Give Up
We accept there will be multiple matches, and work out a process for determining precedence. For example, we could use some or all of the following:

  1. Most specific rule wins (least wildcards)
  2. Left-most condition matches are more important
  3. Newest rule wins

Brute Force
We generate a message population of all possible conditions, and simply feed it into the decision table. For a domain with many conditions, this population can get very big. For more than 20 conditions, you’ll run out of rows in Excel 2010, and for 80 conditions, you’ll be looking at 280 messages, or 1,208,925,819,614,630,000,000,000 in long hand (1.2 septillion according to Wikipedia) .

Analytical
We test each new rule against every other rule, without reference to example trades.

We will explore some of these approaches in the next posts in this series.

This entry was posted in Models, Routing Rules, Rule Engines and tagged , , . Bookmark the permalink.

One Response to Decision Table Rules Part 1 – The Exclusivity Problem

  1. Johnd299 says:

    Enjoyed studying this, very good stuff, regards . A man may learn wisdom even from a foe. by Aristophanes. bddkdeakdekf

Comments are closed.