formalizing both refraction based and sequential
play

Formalizing Both Refraction-Based and Sequential Executions of - PowerPoint PPT Presentation

Formalizing Both Refraction-Based and Sequential Executions of Production Rule Programs Bruno Berstel-Da Silva Albert-Ludwigs-Universitt Freiburg IBM France Lab RuleML Montpellier August 29, 2012 1 / 10 RuleML 2012 Formalizing the


  1. Formalizing Both Refraction-Based and Sequential Executions of Production Rule Programs Bruno Berstel-Da Silva Albert-Ludwigs-Universität Freiburg IBM France Lab RuleML Montpellier – August 29, 2012 1 / 10

  2. RuleML 2012 Formalizing the Execution of Production Rule Programs Motivation R = { r 1 , . . . } r 1 ( p ) : ... → p . discount := p . age

  3. RuleML 2012 Formalizing the Execution of Production Rule Programs Motivation R = { r 1 , r 2 } r 1 ( p ) : ... → p . discount := p . age “(limited to 70 %)” r 2 ( p ) : p . discount > 70 → p . discount := 70

  4. RuleML 2012 Formalizing the Execution of Production Rule Programs Motivation R = { r 1 , r 2 } r 1 ( p ) : ... → p . discount := p . age “(limited to 70 %)” r 2 ( p ) : p . discount > 70 → p . discount := 70 { . . . } R {∀ p ( p . discount ≤ 70 ) } 2 / 10

  5. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) }

  6. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) } > 18 r 1 p . age : 75 p . discount : 75

  7. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) } > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . discount : 70

  8. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) } > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . age > 18 p . discount : 70

  9. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) } > 18 r 1 p . age : 75 p . discount : 75 > 70 r 1 r 2 p . age > 18 p . discount : 70 3 / 10

  10. RuleML 2012 Formalizing the Execution of Production Rule Programs Challenges r 1 ( p ) : p . age ≥ 18 → p . discount := p . age r 2 ( p ) : p . discount > 70 → p . discount := 70 { true } R {∀ p ( p . discount ≤ 70 ) } > 18 r 1 p . age : 75 p . discount : 75 > 70 r 1 r 2 p . age > 18 p . discount : 70 → Control: applicability vs. eligibility 3 / 10

  11. RuleML 2012 Formalizing the Execution of Production Rule Programs Rete... What Else? Rete handles eligibility through refraction C. Forgy, 1982: Rete: A Fast Algorithm for the Many Patterns/Many Objects Match Problem Fages et al., 1992: Sémantique opérationnelle et compilation des systèmes de production Cirstea et al., 2004: Production Systems and Rete Algorithm Formalisation W3C recommendation, 2010: Rule Interchange Format, Production Rule Dialect 4 / 10

  12. RuleML 2012 Formalizing the Execution of Production Rule Programs Rete... What Else? Rete handles eligibility through refraction C. Forgy, 1982: Rete: A Fast Algorithm for the Many Patterns/Many Objects Match Problem Fages et al., 1992: Sémantique opérationnelle et compilation des systèmes de production Cirstea et al., 2004: Production Systems and Rete Algorithm Formalisation W3C recommendation, 2010: Rule Interchange Format, Production Rule Dialect Business Rules Management Systems introduced sequential execution IBM Websphere Operation Decision Management (formerly ILOG JRules) FICO Blaze Advisor (formerly Nexpert) Red Hat JBoss Rules (formerly Drools) etc. 4 / 10

  13. RuleML 2012 Formalizing the Execution of Production Rule Programs Outline Motivation Challenges Rete... What Else? Formalizing the Execution Semantics Refraction-Based Execution Sequential Execution Comparison Conclusion 5 / 10

  14. RuleML 2012 Formalizing the Execution of Production Rule Programs Formalizing the Execution Semantics A rule program execution is a sequence of transitions between configurations by applicable and eligible rule instances. A configuration is � E , s � , where E are the eligible rule instances. In a transition � E k − 1 , s k − 1 � R k − → � E k , s k � , the eligibility strategy updates the set of eligible rule instances: E k = E ( E k − 1 , R k , . . . ) . R k { R k } = S ( A s k − 1 ∩ E k − 1 ) s k − 1 − → s k E k = E ( E k − 1 , . . . ) � E k − 1 , s k − 1 � R k − → � E k , s k � 6 / 10

  15. RuleML 2012 Formalizing the Execution of Production Rule Programs Refraction-Based Execution “A rule must not be fired more than once as long as the reasons for firing it hold.” [W3C RIF-PRD recommendation] > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . discount : 70

  16. RuleML 2012 Formalizing the Execution of Production Rule Programs Refraction-Based Execution “A rule must not be fired more than once as long as the reasons for firing it hold.” [W3C RIF-PRD recommendation] > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 Rule r 1 will not be fired because its guard has remained true. p . age > 18 p . discount : 70 7 / 10

  17. RuleML 2012 Formalizing the Execution of Production Rule Programs Refraction-Based Execution “A rule must not be fired more than once as long as the reasons for firing it hold.” [W3C RIF-PRD recommendation] > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 Rule r 1 will not be fired because its guard has remained true. p . age > 18 p . discount : 70 E ref ( E k − 1 , R k , s k ) = E k − 1 \ { R k } ∪ { R | R is not applicable in s k } 7 / 10

  18. RuleML 2012 Formalizing the Execution of Production Rule Programs Sequential Execution Objects are taken in sequence from the working memory, and each rule in sequence is tentatively executed on them. > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . discount : 70

  19. RuleML 2012 Formalizing the Execution of Production Rule Programs Sequential Execution Objects are taken in sequence from the working memory, and each rule in sequence is tentatively executed on them. > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . discount : 70 All rules have been processed on p . 8 / 10

  20. RuleML 2012 Formalizing the Execution of Production Rule Programs Sequential Execution Objects are taken in sequence from the working memory, and each rule in sequence is tentatively executed on them. > 18 r 1 p . age : 75 p . discount : 75 > 70 r 2 p . discount : 70 All rules have been processed on p . E seq ( E k − 1 , R k ) = { R ∈ E k − 1 | R k < seq R } 8 / 10

  21. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first p . age : 75 p . discount : 0

  22. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . discount > 70

  23. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . age > 18 p . discount > 70 r 1 p . age : 75 p . discount : 75

  24. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . age > 18 p . discount > 70 r 1 p . age : 75 p . discount : 75 p . discount > 70 No rule eligible ( r 2 applicable).

  25. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . age > 18 p . discount > 70 r 1 p . age : 75 p . discount : 75 p . discount > 70 No rule eligible ( r 2 applicable). In the sequential execution, rules are given no second chance.

  26. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable r 2 not applicable p . age : 75 p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . discount : 0 p . age > 18 p . discount > 70 p . discount > 70 r 1 p . age : 75 p . discount : 75 p . discount > 70 No rule eligible ( r 2 applicable). In the sequential execution, rules are given no second chance.

  27. RuleML 2012 Formalizing the Execution of Production Rule Programs No, it’s not the same Sequential – with r 2 < seq r 1 Refraction – try r 2 first r 2 not applicable r 2 not applicable p . age : 75 p . age : 75 p . age : 75 p . discount : 0 p . discount : 0 p . discount : 0 p . age > 18 p . discount > 70 p . discount > 70 p . age > 18 r 1 r 1 p . age : 75 p . age : 75 p . discount : 75 p . discount : 75 p . discount > 70 No rule eligible ( r 2 applicable). In the sequential execution, rules are given no second chance.

Recommend


More recommend