Pushing Efficient Evaluation of HEX Programs by Modular - - PowerPoint PPT Presentation

pushing efficient evaluation of hex programs by modular
SMART_READER_LITE
LIVE PREVIEW

Pushing Efficient Evaluation of HEX Programs by Modular - - PowerPoint PPT Presentation

Pushing Efficient Evaluation of HEX Programs by Modular Decomposition Thomas Eiter Michael Fink Giovambattista Ianni Thomas Krennwallner Peter Schller KBS Group Institut fr Informationssysteme, Technische Universitt Wien


slide-1
SLIDE 1

Pushing Efficient Evaluation of HEX Programs by Modular Decomposition

Thomas Eiter Michael Fink Giovambattista Ianni Thomas Krennwallner Peter Schüller

KBS Group – Institut für Informationssysteme, Technische Universität Wien Dipartimento di Matematica, Università della Calabria

IJCAI – July 20, 2011 – Barcelona Best Paper Track – LPNMR 2011 – Vancouver

supported by: Austrian Science Fund (FWF) project P20841 and Vienna Science and Technology Fund (WWTF) project ICT08-020

slide-2
SLIDE 2

Motivation and Overview

Motivation:

◮ HEX extends Answer Set Programming ◮ supports external atoms for external knowledge/computations ◮ drawbacks of previous HEX evaluation algorithm

⇒ applications called for efficiency improvements

1 / 17

slide-3
SLIDE 3

Motivation and Overview

Motivation:

◮ HEX extends Answer Set Programming ◮ supports external atoms for external knowledge/computations ◮ drawbacks of previous HEX evaluation algorithm

⇒ applications called for efficiency improvements

This work:

◮ novel HEX evaluation formalism

⇒ evaluation graph + model graph

◮ implementation + experimental evaluation

⇒ can even outperform standard ASP solvers

1 / 17

slide-4
SLIDE 4

Answer Set Programming [Gelfond and Lifschitz, 1991]

Programs are sets of rules of the form

α1 ∨ · · · ∨ αk ← β1, . . . , βn, not βn+1, . . . , not βm

where not is negation-as-failure and αi, βj are atoms of the form

p(t1, . . . , tk).

Herbrand base HBP is the set of all ground atoms using constants of P Interpretation I ⊆ HBP

I | = rule body iff

  • positive atoms β1, . . . , βn are in I, and

negative atoms βn+1, . . . , βm are not in I I |

= rule iff some head atom αi is in I, or the rule body is not satisfied I | = P iff I | = grnd(P) iff I satisfies all ground rules of program P

FLP reduct [Faber et al., 2011] of P wrt. I:

fPI is the set of ground rules of P where I satisfies the rule body I is an answer set of P iff I is a ⊆-minimal model of fPI

2 / 17

slide-5
SLIDE 5

HEX Syntax and Semantics [Eiter et al., 2005]

Program (choose a plan, choose a usage, determine resource needs): EDB

{ choose(a, c, d) ←, choose(b, e, f) ← }

IDB

           r1: plan(a) ∨ plan(b) ← r2: need(p,C) ← &res[plan](C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y) r4: need(u,C) ← &res[use](C) c5: ← need(_ ,money)           

External Atom:

◮ &g[x](y) ◮ input list x = x1, . . . , xn and output list y = y1, . . . , ym of terms ◮ I |

= &g[x](y)

iff oracle function f&g(I, x, y) is true

3 / 17

slide-6
SLIDE 6

HEX Example

Program (choose a plan, choose a usage, determine resource needs): EDB

{ choose(a, c, d) ←, choose(b, e, f) ← }

IDB

           r1: plan(a) ∨ plan(b) ← r2: need(p,C) ← &res[plan](C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y) r4: need(u,C) ← &res[use](C) c5: ← need(_ ,money)           

External Atom:

◮ I |

= &res[p](money) if p(C) ∈ I for C ∈ {a, f},

◮ I |

= &res[p](time) if p(C) ∈ I for C ∈ {b, c, d, e},

◮ I |

= &res[p](X) otherwise.

4 / 17

slide-7
SLIDE 7

HEX Example

Program (choose a plan, choose a usage, determine resource needs): EDB

{ choose(a, c, d) ←, choose(b, e, f) ← }

IDB

           r1: plan(a) ∨ plan(b) ← r2: need(p,C) ← &res[plan](C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y) r4: need(u,C) ← &res[use](C) c5: ← need(_ ,money)           

External Atom:

◮ I |

= &res[p](money) if p(C) ∈ I for C ∈ {a, f},

◮ I |

= &res[p](time) if p(C) ∈ I for C ∈ {b, c, d, e},

◮ I |

= &res[p](X) otherwise.

In our example . . .

{plan(a)} | = &res[plan](money) {plan(a)} | = &res[plan](time) {plan(b)} | = &res[plan](money) {plan(b)} | = &res[plan](time)

4 / 17

slide-8
SLIDE 8

HEX Example

Program (choose a plan, choose a usage, determine resource needs): EDB

{ choose(a, c, d) ←, choose(b, e, f) ← }

IDB

           r1: plan(a) ∨ plan(b) ← r2: need(p,C) ← &res[plan](C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y) r4: need(u,C) ← &res[use](C) c5: ← need(_ ,money)           

Guessed Interpretations:

◮ {plan(a), &res[plan](money), need(p, money),

use(c), &res[use](time), need(u, time)}

◮ {plan(a), &res[plan](money), need(p, money),

use(d), &res[use](time), need(u, time)}

◮ {plan(b), &res[plan](time), need(p, time),

use(e), &res[use](time), need(u, time)}

◮ {plan(b), &res[plan](time), need(p, time),

use(f), &res[use](money), need(u, money)}

5 / 17

slide-9
SLIDE 9

HEX Example

Program (choose a plan, choose a usage, determine resource needs): EDB

{ choose(a, c, d) ←, choose(b, e, f) ← }

IDB

           r1: plan(a) ∨ plan(b) ← r2: need(p,C) ← &res[plan](C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y) r4: need(u,C) ← &res[use](C) c5: ← need(_ ,money)           

Guessed Interpretations:

◮ {plan(a), &res[plan](money), need(p, money),

use(c), &res[use](time), need(u, time)}

◮ {plan(a), &res[plan](money), need(p, money),

use(d), &res[use](time), need(u, time)}

◮ {plan(b), &res[plan](time), need(p, time),

⇐ Answer Set use(e), &res[use](time), need(u, time)}

◮ {plan(b), &res[plan](time), need(p, time),

use(f), &res[use](money), need(u, money)}

5 / 17

slide-10
SLIDE 10

HEX evaluation (previous strategy)

(1) calculate models of all program parts that do not depend

  • n external computations that still need to be done

(2) do external computations that depend on (1) (3) replace evaluated external atoms by result of (2) and restart at (1)

6 / 17

slide-11
SLIDE 11

HEX evaluation (previous strategy)

(1) calculate models of all program parts that do not depend

  • n external computations that still need to be done

(2) do external computations that depend on (1) (3) replace evaluated external atoms by result of (2) and restart at (1) r1: plan(a) ∨ plan(b). r2: need(p,C) ←

&res[plan](C). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). r4: need(u,C) ← &res[use](C). c5: ← need(_ ,money). r1: plan(a) ∨ plan(b). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). ⇒ plan/1, use/1 u1 r2: need(p,C) ← &res[plan](C) r4: need(u,C) ← &res[use](C) ⇒ need/2 u2 c5: ← need(_,money) u3

6 / 17

slide-12
SLIDE 12

HEX model building (previous strategy)

r1: plan(a) ∨ plan(b). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). “Evaluation Graph” r2: need(p,C) ← &res[plan](C) r4: need(u,C) ← &res[use](C) c5: ← need(_,money) m1

O:−

= {plan(a), use(c)} m2

O:−

= {plan(a), use(d)} m3

O:−

= {plan(b), use(e)} m4

O:−

= {plan(b), use(f)} Models m5

I:1

= m1 m6

I:2

= m2 m7

I:3

= m3 m8

I:4

= m4

7 / 17

slide-13
SLIDE 13

HEX model building (previous strategy)

r1: plan(a) ∨ plan(b). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). “Evaluation Graph” r2: need(p,C) ← &res[plan](C) r4: need(u,C) ← &res[use](C) c5: ← need(_,money) m1

O:−

= {plan(a), use(c)} m2

O:−

= {plan(a), use(d)} m3

O:−

= {plan(b), use(e)} m4

O:−

= {plan(b), use(f)} Models m5

I:1

= m1 m6

I:2

= m2 m7

I:3

= m3 m8

I:4

= m4 m9

O:5

= {need(p,money),need(u,time)} m10

O:6

= {need(p,money),need(u,time)} m11

O:7

= {need(p,time),need(u,time)} m12

O:8

= {need(p,time),need(u,money)} m13

I:9

= m9 m14

I:10

= m10 m15

I:11

= m11 m16

I:12

= m12

7 / 17

slide-14
SLIDE 14

HEX model building (previous strategy)

r1: plan(a) ∨ plan(b). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). “Evaluation Graph” r2: need(p,C) ← &res[plan](C) r4: need(u,C) ← &res[use](C) c5: ← need(_,money) m1

O:−

= {plan(a), use(c)} m2

O:−

= {plan(a), use(d)} m3

O:−

= {plan(b), use(e)} m4

O:−

= {plan(b), use(f)} Models m5

I:1

= m1 m6

I:2

= m2 m7

I:3

= m3 m8

I:4

= m4 m9

O:5

= {need(p,money),need(u,time)} m10

O:6

= {need(p,money),need(u,time)} m11

O:7

= {need(p,time),need(u,time)} m12

O:8

= {need(p,time),need(u,money)} m13

I:9

= m9 m14

I:10

= m10 m15

I:11

= m11 m16

I:12

= m12 m17

O:15

= ∅

7 / 17

slide-15
SLIDE 15

HEX model building (previous strategy)

r1: plan(a) ∨ plan(b). r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). “Evaluation Graph” r2: need(p,C) ← &res[plan](C) r4: need(u,C) ← &res[use](C) c5: ← need(_,money) m1

O:−

= {plan(a), use(c)} m2

O:−

= {plan(a), use(d)} m3

O:−

= {plan(b), use(e)} m4

O:−

= {plan(b), use(f)} Models m5

I:1

= m1 m6

I:2

= m2 m7

I:3

= m3 m8

I:4

= m4 m9

O:5

= {need(p,money),need(u,time)} m10

O:6

= {need(p,money),need(u,time)} m11

O:7

= {need(p,time),need(u,time)} m12

O:8

= {need(p,time),need(u,money)} m13

I:9

= m9 m14

I:10

= m10 m15

I:11

= m11 m16

I:12

= m12 m17

O:15

= ∅

7 / 17

slide-16
SLIDE 16

Observations

◮ We compute the largest possible fragment

⇒ multiplication of independent guesses ⇒ redundant evaluation of external atoms

◮ Constraints are considered if all dependencies are fulfilled

⇒ some constraints could safely eliminate models earlier

◮ We calculate all models at one unit, then go to the next unit

⇒ if we need only one model, we calculate unnecessary models ⇒ Several improvements possible!

8 / 17

slide-17
SLIDE 17

Improved Strategy Evaluation Graph

r1: plan(a) ∨ plan(b). ⇒ plan/1 r2: need(p,C) ←&res[plan](C). c5: ← need(_,money). ⇒ need(p,C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). ⇒ use/1 r4: need(u,C) ←&res[use](C). c5: ← need(_,money). ⇒ need(u,C) u1 u2 u3 u4

◮ Acyclic Evaluation Graph ◮ Rules cannot be shared among units ◮ Constraints can be shared among units ◮ Rule dependencies must be fulfilled ◮ Constraint dependencies (less strict) must be fulfilled

⇒ e.g., c5 has no negative body, therefore it can be freely shared

9 / 17

slide-18
SLIDE 18

Improved Strategy Model Building

r1: plan(a) ∨ plan(b). ⇒ plan/1 r2: need(p,C) ←&res[plan](C). c5: ← need(_,money). ⇒ need(p,C) r3: use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). ⇒ use/1 r4: need(u,C) ←&res[use](C). c5: ← need(_,money). ⇒ need(u,C) u1 u2 u3 u4 Input and Output models at each Evaluation Unit:

◮ output model = evaluation of program fragment on input model ◮ input model = joined output model of predecessor unit(s) ◮ Principle: common ancestor model at common ancestor units

Soundness + Completeness Theorem:

I = union of connected output models at every unit

iff I = answer set of the program

10 / 17

slide-19
SLIDE 19

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 Model Graph need input need output u1 u2 u3 u4

11 / 17

slide-20
SLIDE 20

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 Model Graph need input need output need output need input need output u1 u2 u3 u4

11 / 17

slide-21
SLIDE 21

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 need output Model Graph need input need output need output need input need output u1 u2 u3 u4

11 / 17

slide-22
SLIDE 22

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} Model Graph m3

I:1

= m1 need output need output need input need output u1 u2 u3 u4

11 / 17

slide-23
SLIDE 23

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} Model Graph m3

I:1

= m1 u2 ∪ m3 has no model need output need output need input need output u1 u2 u3 u4

11 / 17

slide-24
SLIDE 24

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} Model Graph m3

I:1

= m1 need input need output need output need input need output u1 u2 u3 u4

11 / 17

slide-25
SLIDE 25

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} need output Model Graph m3

I:1

= m1 need input need output need output need input need output u1 u2 u3 u4

11 / 17

slide-26
SLIDE 26

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 need output need output need input need output u1 u2 u3 u4

11 / 17

slide-27
SLIDE 27

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} need output need input need output u1 u2 u3 u4

11 / 17

slide-28
SLIDE 28

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} m7

I:2

= m2 need output need input need output u1 u2 u3 u4

11 / 17

slide-29
SLIDE 29

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} m7

I:2

= m2 m10

O:7

= {use(e)} m12

I:5,10

= {need(p, time), use(e)} need output u1 u2 u3 u4

11 / 17

slide-30
SLIDE 30

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} m7

I:2

= m2 m10

O:7

= {use(e)} m12

I:5,10

= {need(p, time), use(e)} m14

O:12

= {need(u, time)} u1 u2 u3 u4

11 / 17

slide-31
SLIDE 31

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} m7

I:2

= m2 m10

O:7

= {use(e)} m12

I:5,10

= {need(p, time), use(e)} m14

O:12

= {need(u, time)} continue enumerating . . . u1 u2 u3 u4

11 / 17

slide-32
SLIDE 32

Improved Strategy Model Building

plan(a) ∨ plan(b). need(p,C) ← &res[plan](C). ← need(_,money). use(X) ∨ use(Y) ← plan(P), choose(P,X,Y). need(u,C) ← &res[use](C). ← need(_,money). u1 u2 u3 u4 m1

O:−

= {plan(a)} m2

O:−

= {plan(b)} Model Graph m3

I:1

= m1 m4

I:2

= m2 m5

O:4

={need(p,time)} m7

I:2

= m2 m10

O:7

= {use(e)} m11

O:7

= {use(f)} m12

I:5,10

= {need(p, time), use(e)} m13

I:5,11

= {need(p, time), use(f)} m14

O:12

= {need(u, time)} . . . no further models u1 u2 u3 u4

11 / 17

slide-33
SLIDE 33

Improvements

Acyclic Directed Evaluation Graph

⇒ independent program fragments evaluated independently ⇒ fewer redundant evaluations ⇒ parallel evaluation possible

Constraints can be shared between units

⇒ early model elimination

Calculating one model at a time

⇒ first model obtained faster ⇒ can discard some intermediate results early

12 / 17

slide-34
SLIDE 34

Reviewer Selection

1 10 100 700 1 10 20 30 40

Evaluation time / secs (logscale) Number of conference tracks T

previous improved

13 / 17

slide-35
SLIDE 35

Multi-Context Systems Evaluation

1 10 100 600 D

  • 7
  • 7
  • 3
  • 3

D

  • 7
  • 7
  • 4
  • 4

D

  • 7
  • 7
  • 5
  • 5

H

  • 9
  • 9
  • 3
  • 3

H

  • 9
  • 9
  • 4
  • 4

R

  • 7
  • 7
  • 4
  • 4

R

  • 7
  • 7
  • 5
  • 5

R

  • 7
  • 8
  • 5
  • 5

R

  • 7
  • 9
  • 5
  • 5

R

  • 8
  • 7
  • 5
  • 5

R

  • 8
  • 8
  • 5
  • 5

Z

  • 7
  • 7
  • 3
  • 3

Z

  • 7
  • 7
  • 4
  • 4

Z

  • 7
  • 7
  • 5
  • 5

Evaluation time / secs (logscale) Benchmark Instance Groups

previous improved

14 / 17

slide-36
SLIDE 36

Reviewer Selection Plain ASP

100 200 300 400 10 20 30 40 50

Evaluation time / secs Number of papers at conference track P

dlv clasp+gringo decomposition+dlv decomposition+clasp+gringo

15 / 17

slide-37
SLIDE 37

Reviewer Selection Plain ASP

500 1000 1500 2000 2500 3000 10 20 30 40 50

Memory usage / MB Number of papers at conference track P

dlv clasp+gringo decomposition+dlv decomposition+clasp+gringo

15 / 17

slide-38
SLIDE 38

Conclusion

Novel Theoretical HEX Evaluation Framework

⇒ Evaluation Graph + Model Graph ⇒ exponential speedup for certain instances ⇒ potential for optimization strategies

(emphasis on parallelization vs. memory usage)

⇒ can even outperform native ASP solvers in some cases

Improved Implementation (Open Source)

⇒ backends dlv and clingo ⇒ Instructions for building and detailed experimental results:

click Experiments on the dlvhex homepage http://www.kr.tuwien.ac.at/research/systems/dlvhex/

16 / 17

slide-39
SLIDE 39

References I

◮ Thomas Eiter, Giovambattista Ianni, Roman Schindlauer, and Hans

  • Tompits. A Uniform Integration of Higher-Order Reasoning and External

Evaluations in Answer-Set Programming. In IJCAI-05, pages 90–96, 2005.

◮ Wolfgang Faber, Nicola Leone, and Gerald Pfeifer. Semantics and

complexity of recursive aggregates in answer set programming. Artificial Intelligence, 175(1):278–298, January 2011.

◮ Michael Gelfond and Vladimir Lifschitz. Classical Negation in Logic

Programs and Disjunctive Databases. Next Generation Computing, 9(3–4):365–386, 1991.