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

formalizing both refraction based and sequential
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 2

RuleML 2012 Formalizing the Execution of Production Rule Programs

Motivation

R = {r1, . . . } r1(p) : ... → p.discount := p.age

slide-3
SLIDE 3

RuleML 2012 Formalizing the Execution of Production Rule Programs

Motivation

R = {r1, r2} r1(p) : ... → p.discount := p.age

“(limited to 70 %)”

r2(p) : p.discount > 70 → p.discount := 70

slide-4
SLIDE 4

RuleML 2012 Formalizing the Execution of Production Rule Programs

Motivation

R = {r1, r2} r1(p) : ... → p.discount := p.age

“(limited to 70 %)”

r2(p) : p.discount > 70 → p.discount := 70 {. . .} R {∀p (p.discount ≤ 70)}

2 / 10

slide-5
SLIDE 5

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)}

slide-6
SLIDE 6

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)} p.age : 75 > 18 r1 p.discount : 75

slide-7
SLIDE 7

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)} p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70

slide-8
SLIDE 8

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)} p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 p.age > 18

slide-9
SLIDE 9

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)} p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 p.age > 18 r1

3 / 10

slide-10
SLIDE 10

RuleML 2012 Formalizing the Execution of Production Rule Programs

Challenges

r1(p) : p.age ≥ 18 → p.discount := p.age r2(p) : p.discount > 70 → p.discount := 70 {true} R {∀p (p.discount ≤ 70)} p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 p.age > 18 r1

→ Control: applicability vs. eligibility

3 / 10

slide-11
SLIDE 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

slide-12
SLIDE 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

slide-13
SLIDE 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

slide-14
SLIDE 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 Ek−1, sk−1 Rk − → Ek, sk, the eligibility strategy updates the set of eligible rule instances: Ek = E(Ek−1, Rk, . . . ). {Rk} = S(Ask−1 ∩ Ek−1) sk−1

Rk

− → sk Ek = E(Ek−1, . . .) Ek−1, sk−1 Rk − → Ek, sk

6 / 10

slide-15
SLIDE 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]

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70

slide-16
SLIDE 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]

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 p.age > 18 Rule r1 will not be fired because its guard has remained true.

7 / 10

slide-17
SLIDE 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]

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 p.age > 18 Rule r1 will not be fired because its guard has remained true.

Eref(Ek−1, Rk, sk) = Ek−1 \ {Rk} ∪ {R | R is not applicable in sk}

7 / 10

slide-18
SLIDE 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.

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70

slide-19
SLIDE 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.

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 All rules have been processed on p.

8 / 10

slide-20
SLIDE 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.

p.age : 75 > 18 r1 p.discount : 75 > 70 r2 p.discount : 70 All rules have been processed on p.

Eseq(Ek−1, Rk) = {R ∈ Ek−1 | Rk <seq R}

8 / 10

slide-21
SLIDE 21

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0

slide-22
SLIDE 22

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0

slide-23
SLIDE 23

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75

slide-24
SLIDE 24

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable).

slide-25
SLIDE 25

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable).

In the sequential execution, rules are given no second chance.

slide-26
SLIDE 26

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable). p.discount > 70 r2 not applicable p.age : 75 p.discount : 0

In the sequential execution, rules are given no second chance.

slide-27
SLIDE 27

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable). p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75

In the sequential execution, rules are given no second chance.

slide-28
SLIDE 28

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable). p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 r2 p.age : 75 p.discount : 70

In the sequential execution, rules are given no second chance.

slide-29
SLIDE 29

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable). p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 r2 p.age : 75 p.discount : 70 p.age > 18 No rule eligible (r1 applicable).

In the sequential execution, rules are given no second chance.

9 / 10

slide-30
SLIDE 30

RuleML 2012 Formalizing the Execution of Production Rule Programs

No, it’s not the same

Sequential – with r2 <seq r1 Refraction – try r2 first

p.age : 75 p.discount : 0 p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 No rule eligible (r2 applicable). p.discount > 70 r2 not applicable p.age : 75 p.discount : 0 p.age > 18 r1 p.age : 75 p.discount : 75 p.discount > 70 r2 p.age : 75 p.discount : 70 p.age > 18 No rule eligible (r1 applicable).

In the sequential execution, rules are given no second chance. Is refraction more intuitive or less predictible?

9 / 10

slide-31
SLIDE 31

RuleML 2012 Formalizing the Execution of Production Rule Programs

Conclusion

Contribution

A formal description of the execution semantics of business rules programs.

Short-term benefits

Provide such a formalization. Cover Rete’s refraction as well as sequential execution.

Long-term motivations

Verification of Business Rules programs. Better compilation for faster execution. More generally, enhance understanding of rule programs.

10 / 10