Hit policies are used to define how the decision table manages inputs that match several rules, or alternatively, inputs that do not match any rules.
There are two main types of hit policies. The first is the single hit policy. With this policy, only one rule can fire, and the final result of the decision is one output value.
The second is the multiple hit policy. With this policy, rules can fire without an explicit order. Multiple hit tables either return set of values or aggregate the final result of the decisions.
Single hit policy - unique
There is a third hit policy - the unique hit policy. When the unique hit policy is used, only one rule is allowed to fire for any combination of inputs. All inputs are assumed to be independently partitioned from each other, i.e. that any combination is actually possible. Overlapping rules are not allowed.
Note
U = unique hit policy
A '-' stands for wild card, which matches any value.
Take a look at the rules:
- In rule two: if the chosen type of delivery is Express delivery, the Type of customer is a Retailer, and Kind of goods is the wild card, it doesn't matter whether the kind of goods are Groceries or Material goods, any value is fine. The output of the rule will always be High shipping priority.
- In rule three: if the Chosen type of delivery is Standard delivery, the Kind of goods are Groceries, and the type of customer is a Wholesaler, then the priority of shipment is High.
Single hit policy - first
When the first policy is used, rules might overlap, but only one rule fires. The first hit policy assumes an ordering of the rules - they are evaluated from top to bottom. As soon as one rule fires, the output of that rules is the result of the decision. Once one rule fires, no other rule is checked.
In this example the first rule to be checked by the decision table is whether the Chosen type of delivery is Express delivery and whether the customer is a Wholesaler. If so, this rule fires. If not, the second rule is checked. If the second rule doesn't match the input values, the third rule is checked and so on.
Note that the last rule in the table serves as a 'catch all rule'. This means that when none of the previous rules match the input values, this rule will fire.