Using Priority and Rank to Control Order of Rule Execution

For each RTC, the rule agenda is sorted by priority and then within priority by rank, for those rules that use the same ranking. Use of priority and rank is optional. You can also use priority without using rank.

In the rule’s Rank field (or rule attribute, in the source view), you specify a rule function that returns a double. The larger the return value, the higher the ranking. You can specify the same rule function in different rules to perform ranking across tuples of those rules. Here are the requirements:

  • The rule function must have a Validity setting that includes Condition (that is, do not set it to Action Only).
  • You can assign the same rule function to different rules as long as the following is true:
    • The scope of the rule function includes only parameters found in all the rules that use the same function. This can be a subset of what’s in the rule declaration. (As with rules, primitives are not allowed.)
    • The parameters must be used in the same order as they appear in the rule declaration.
  • The rule function must return a double value. (The default value for the Rank field is 0.0.)