Rule Engine Execution Modes
The execution of the rules inside the rule engine of IBM Operational Decision Management follows three rule engine execution modes – RetePlus, sequential, and Fastpath execution modes. Execution mode affects which rules are executed and in which order. Execution mode specifies the algorithm used by the rule engine inside Decision Server.
Rete Plus Rule Engine Execution Mode
Use RetePlus optimization techniques to improve performance through reduction of the number of rules and conditions, computation of the rules to run, and prioritization of the rule order.
In RetePlus mode, the rule engine execution minimizes the number of rules and conditions to be evaluated, computes which rules must be run, and identifies in which order these rules must be run. In RetePlus, the rule engine uses a working memory and an agenda for storing and manipulating application objects. The working memory contains references to the application objects. The agenda lists and orders the rule instances that are eligible to be run.
RetePlus, an extension based on the Rete algorithm, was the default execution mode for rule flow tasks in Operational Decision Manager V8.5.1 and earlier. Note that the execution mode is always RetePlus if there is no rule flow.
The RetePlus algorithm operates as follows:
- The rule engine matches the conditions of the rules in the ruleset against the objects in working memory. During the pattern matching process, RetePlus creates a network based on semantic relationships between rule condition tests.
- For each match, a rule instance is created and put on the agenda. Then, based on some ordering principles, the agenda selects the rule instance to be run.
- When the rule instance is executed, the rule action is executed. This action modifies the working memory in the following way
- By adding an object to the working memory.
- By removing an object from the working memory.
- By modifying the attributes of an existing object.
- The process carries on cyclically until no more rule instances are left on the agenda.
whenever the working memory is modified, the rule engine repeats the pattern matching process. It reassesses matches after each rule instance is executed and modifies the data. As a possible consequence, the list of rule instances in the agenda can change. Thus, RetePlus is incremental and data-driven.
Conclusion:
- Default mode that executes in most of the cases.
- Characteristics
- Rule Chaining
- Agenda
- Input : Objects in the working memory or ruleset.
- Excels in incremental, data-driven execution(execution which reacts to the changes of data)
- Best performance for applications that performs computation or correlation between objects.
- Recommended for
- Rules with dynamic priorities
- Rule chaining : execution of a rule may cause other rules to fire
- Rule actions that manipulate working memory objects(update, retract and insert)
- Event management.
Sequential Rule Engine Execution Mode
The sequential mode executes all the eligible rules for a given rule task in sequence, which provides specific performance advantages.
The sequential algorithm operates as follows:
- The rule engine performs pattern matching on input ruleset parameters and on the conditions defined on the collections of objects in working memory.
- For each match, a rule instance is created and immediately executed. When a rule instance is executed, it sets the value of an attribute or an output ruleset parameter.
Conclusion:
- A mode for sequential exection.
- Characteristics:
- No rule chaining
- No agenda
- Input : Ruleset parameters recommended.
- For applications, that perform validation and compliance.
- Recommended for
- Numerous rules with randomly ordered tests
- Rules that use ruleset parameters.
- Rules that use same class in their conditions, but perform different tests on this class.
Fastpath Rule Engine Execution Mode
Fastpath is a sequential execution mode that also detects semantic relations between rule tests in the same way as RetePlus. However, unlike RetePlus, the Fastpath mode does not support the inference.
The Fastpath algorithm operates as follows:
- The rule engine uses a working memory that references application objects or ruleset parameters. Fastpath performs the pattern matching process, as in RetePlus, by creating a tree based on semantic relations between rule condition tests.
- For each match, a rule instance is created and inserted in the agenda.
- After the pattern matching process, the rule instances in the agenda are executed.
- The rule engine stops after the rule instances have been executed. This behavior also depends on the exit criteria of the rule task. The pattern matching process is not repeated.
Conclusion:
- A mode for sequential execution, with detection of semantic relation between rule tests.
- Characteristics:
- No rule chaining
- No agenda
- Input : Objects in the working memory or ruleset.
- For applications that perform validation and compliance, or stateless correlation objects.
- Recommended for
- Rules with shared test patterns
- Rules with heterogeneous bindings
- Rules that use ruleset parameters or working memory objects.
Happy Learning! Happy Exploring!!
Enjoy Reading This Article?
Here are some more articles you might like to read next: