Forward chaining
- Last Updated: March 24, 2022
- 2 minute read
- Corticon
- Version 6.3
- Documentation
The first step in learning to use looping is to understand how it differs from the normal inferencing behavior of executing rules, whether executed by Corticon Studio or Corticon Server. When a Ruleflow is compiled into a Decision Service, a dependency network for the rules is automatically generated. Corticon uses this network to determine the order in which rules fire at run time. For example, in the following simple rules, 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 that 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 is 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 the preceding example, 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). You 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 occurs too. Looping and its enablement are discussed next.