The default behavior for a rulesheet is to try all of the rules against all of the instances that are referred to in the conditions. If there are multiple instances of entities or aliases then Corticon will automatically try all combinations of those entities or aliases (it’s this power that makes it possible to solve a Sudoku, or Magic Square problem with a single rule!)
In nearly all cases this is the behavior that you want. Corticon generally does the right thing and you don’t have to think about it.
However sometimes you may be faced with a situation where you don’t want all the instances processed or you don’t want all the rules processed.Perhaps you want to find only the first instance out of a set of thousands that meets certain conditions
CAPT is a mechanism that enables you to terminate processing of a rulesheet once a rule has fired without needing to evaluate the remaining instances. If you want to terminate the processing of other rules on a rulesheet once one of the rules has fired then that is done by adding an explicit “stop” condition to the rule. These two techniques can be used in combination.
In this paper we’ll look at several scenarios
A local stop condition is one that tests an attribute of the instances being processed
A global stop condition is one that tests an independent attribute
This feature only works at a single-rule level. It doesn’t work across multiple rules. After a rule fires against one alias binding and potentially updates working memory, but before moving on to evaluate the rule against the next alias binding, the engine performs a check against the current alias binding: If all the conditions that held true before the rule fired no longer hold afterwards then we’ve reached the “processing threshold” for this rule and we stop processing. Otherwise, we keep going.
Consider the following scenarios:
Note how the rule fires against both Thing and Thing as expected.
Note how the stop condition doesn’t prevent rule 1 from firing against both Thing and Thing.
Note how rule 1 now only fires against Thing and not against Thing.
Note how the CaPT doesn’t prevent the rule from firing against both Thing and Thing. This is because the lack of stop condition causes the “Processing Threshold” to never be triggered. Basically nothing that is used in the condition has changed.
Finds the FIRST small and the FIRST large thing
Finds ALL the small (if there are any) OR ALL the large but not both.
Finds only ONE instance that is large or small
Here are the rules about CaPT expressed as a decision table
Local means that the stop condition is an attribute of the instance being tested
Global means that the stop condition is a single global value
Download PDF version.