2.5.7.2. Agenda Groups

2.5.7.2. Agenda Groups

Sometimes known as "modules" in CLIPS terminology, Agenda groups are a way to partition the activation of rules on the agenda. At any one time, only one group has "focus" which means that only the activations for rules in that group will take effect. You can also "auto focus" a rule, causing its agenda group to gain "focus" when that rule's conditions are true.

Agenda groups are a way to create a "flow" between grouped rules. You can switch the group which has focus either from within the rule engine, or from the API. If your rules have a clear need for multiple "phases" or "sequences" of processing, agenda groups can be used for this purpose.

Each time setFocus() is called it pushes that Agenda Group onto a stack. When the group is empty it is popped off and the next one on the stack evaluates. An Agenda Group can appear in multiple locations on the stack. The default Agenda Group is "MAIN", all rules which do not specify an Agenda Group are placed there, it is also always the first group on the Stack and given focus as default.