skip to main content
Corticon Studio: Rule Modeling Guide : Rule dependency: Chaining and looping : Forward chaining
 

Try Corticon Now

Forward chaining

The first step in learning to use looping is to understand how it differs from normal inferencing behavior of executing rules, whether executed by Corticon Studio or Corticon Server. When a Ruleflow is compiled (either by Corticon Studio during a Ruletest execution, or by Corticon Server during deployment), a dependency network for the rules is automatically generated. Corticon Studio and Corticon Server use this network to determine the order in which rules fire in runtime. For example, in the simple rules below, the proper dependency network is 1 > 2 > 3 > 4.
This is not to say that all three rules will always fire for a given test – clearly a test with B as the initial value will only cause rules 2, 3, and 4 to fire. But the dependency network ensures that rule 1 is always evaluated before rule 2, and rule 2 is always evaluated before rule 3, and so on. This mode of Rulesheet execution is called Optimized Inferencing, meaning the rules execute in the optimal sequence determined by the dependency network generated by the compiler. Optimized Inferencing is the default mode of rule processing for all Rulesheets.
Optimized Inferencing processing is a powerful capability that enables the rule modeler to break up complex logic into a series of smaller, less complex rules. Once broken up into smaller or simpler rules, the logic will be executed in the proper sequence automatically, based on the dependencies determined by the compiler.
An important characteristic of Optimized Inferencing processing: the flow of rule execution is single-pass, meaning a rule in the sequence is evaluated once and never revisited, even if the data values (or data state) evaluated by its Conditions change over the course of rule execution. In our example above, this effectively means that rule execution ceases after rule 4. Even if rule 4 fires (with resulting value = B ), the second rule will not be revisited, re-evaluated, or re-fired even though its Condition (If value = B) would be satisfied by the current value (state). We can force rule 2 to be re-evaluated only if a one of Corticon Studio's looping processing modes is enabled for the Rulesheet. Remember, just because sequential processing occurs automatically does not mean looping will occur too. Looping and its enablement are discussed next.