RetePlus mode

The default execution mode is RetePlus. Use its optimization techniques to improve performance: reduction of the number of rules and conditions, computation of the rules to execute, and prioritization of the rule order.

RetePlus, an extension based on the Rete algorithm, is the default execution mode.

In RetePlus mode, the rule engine minimizes the number of rules and conditions to be evaluated, computes which rules must be executed, and identifies in which order these rules must be executed. 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 executed.

The following diagram shows how the RetePlus algorithm works.

Diagram of the rule engine in RetePlus mode

The RetePlus algorithm operates as follows:

  1. 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.

  2. For each match, a rule instance is created and put into the agenda. Then the agenda, based on some ordering principles, selects the rule instance to be executed.

  3. When the rule instance is executed, the rule action is executed.

    This action modifies the working memory in the following ways:

    • By adding a new object to the working memory

    • By removing an object from the working memory

    • By modifying the attributes of an existing object.

  4. The process carries on cyclically until no more rule instances are left in the agenda.

In RetePlus, 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. The RetePlus algorithm is based on an inference process that the sequential and FastPath algorithms do not support.