Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rete_Rule_Engine.pdf

 Rete_Rule_Engine.pdf

Avatar for Ganesh Gunasegaran

Ganesh Gunasegaran

June 25, 2021
Tweet

More Decks by Ganesh Gunasegaran

Other Decks in Technology

Transcript

  1. Concepts: Rules • Represent some knowledge. • In the form

    of if-then-else. • If: one or more condition. • then: one or more action.
  2. Concepts: Facts • Facts are data. • Number of facts

    increases with the number of unique variables.
  3. How? • A complete rule-set is given to the rule

    engine. • The rule engine matches each rule in the ruleset with given facts. • Decide whether to fi re the rule or not. • Repeat!
  4. How? - Cont. • New facts may be added to

    the list. • Old facts may be removed from the list. • Actions of the rules can change a few facts. • Remembers what has already matched and computes only the changes.
  5. Phase 1 - Match • The conditions of the rules

    are matched agains the facts to determine which rules are to be executed. • The rules whose conditions are met are stored in a list called Agenda for fi ring.
  6. Phase 2 - Select • The selection criteria depends on.

    • Priority • Recency of usage • Speci fi city of the rule
  7. Phase 3 - Execute • The selected rule is executed

    by carrying out the actions in the right hand side of the rule . • The action can be • An assertion • A user de fi ned function • A built-in function • A decision table
  8. Internal working • A directed acyclic graph consisting of nodes

    representing patterns in the conditions of the rules is created. • The nodes behave like fi lters, testing the incoming tokens, and sending only those that pass the test.
  9. Internal working - Nodes • Alpha Network • Each alpha

    node has one input that de fi ne intra-elements. • Beta Network • Each beta node takes two inputs to de fi ne intra-elements.
  10. Internal working - Example • if age > 60 or

    age < 5 or income < 10, 000 then concession = 50%
  11. Advantages • Speed as it takes the advantage of structural

    similarity in rules. • Pools the common components so that they need not be computed again.
  12. Disadvantages • Poorly written rule can be memory intensive. •

    The space complexity is O(RFP) • R -> Number of rules • F -> Number of asserted facts • P -> Number of patterns per rule