conflict driven asp solving with external source access
play

Conflict-driven ASP Solving with External Source Access Thomas - PowerPoint PPT Presentation

Conflict-driven ASP Solving with External Source Access Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl redl@kr.tuwien.ac.at September 05, 2012 Redl C. (TU Vienna) HEX-Programs September 05, 2012 1 / 24 Motivation


  1. Conflict-driven ASP Solving with External Source Access Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl redl@kr.tuwien.ac.at September 05, 2012 Redl C. (TU Vienna) HEX-Programs September 05, 2012 1 / 24

  2. Motivation HEX-Programs Extend ASP by external sources Current algorithm based on a translation to ASP Scalability problems Contribution New genuine algorithms Based on conflict-driven algorithms Much better scalability Redl C. (TU Vienna) HEX-Programs September 05, 2012 2 / 24

  3. Outline Introduction 1 2 Algorithms with External Behavior Learning Nogood Generation for External Behavior Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 05, 2012 3 / 24

  4. Introduction Outline Introduction 1 2 Algorithms with External Behavior Learning Nogood Generation for External Behavior Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 05, 2012 4 / 24

  5. Introduction HEX-Programs HEX-programs extend ordinary ASP programs by external sources Definition (HEX-programs) A HEX-program consists of rules of form a 1 ∨ · · · ∨ a n ← b 1 , . . . , b m , not b m + 1 , . . . , not b n , with classical literals a i , and classical literals or an external atoms b j . Definition (External Atoms) An external atom is of the form & p [ q 1 , . . . , q k ]( t 1 , . . . , t l ) , p . . . external predicate name q i . . . predicate names or constants HEX- t j . . . terms Reasoner program Semantics: 1 + k + l -ary Boolean oracle function f & p : Implementation p [ q 1 , . . . , q k ]( t 1 , . . . , t l ) is true under assignment A & of & p iff f & p ( A , q 1 , . . . , q k , t 1 , . . . , t l ) = 1 . Redl C. (TU Vienna) HEX-Programs September 05, 2012 5 / 24

  6. Introduction Examples & rdf The & rdf External Atom Input: URL Output: Set of triplets from RDF file External knowledge base is a set of RDF files on the web: addr ( http : // . . . / data1 . rdf ) . addr ( http : // . . . / data2 . rdf ) . bel ( X , Y ) ← addr ( U ) , & rdf [ U ]( X , Y , Z ) . Redl C. (TU Vienna) HEX-Programs September 05, 2012 6 / 24

  7. Introduction Examples & rdf The & rdf External Atom Input: URL Output: Set of triplets from RDF file External knowledge base is a set of RDF files on the web: addr ( http : // . . . / data1 . rdf ) . addr ( http : // . . . / data2 . rdf ) . bel ( X , Y ) ← addr ( U ) , & rdf [ U ]( X , Y , Z ) . & diff & diff [ p , q ]( X ) : all elements X , which are in the extension of p but not of q : dom ( X ) ← # int ( X ) . nsel ( X ) ← dom ( X ) , & diff [ dom , sel ]( X ) . sel ( X ) ← dom ( X ) , & diff [ dom , nsel ]( X ) . ← sel ( X 1 ) , sel ( X 2 ) , sel ( X 3 ) , X 1 � = X 2 , X 1 � = X 3 , X 2 � = X 3 . Redl C. (TU Vienna) HEX-Programs September 05, 2012 6 / 24

  8. Introduction Current Evaluation Method Evaluating Program Π 1 Replace external atoms & g [ � p ]( � c ) by ordinary ones e & p ] ( � c ) and g [ � guess their values → guessing program ˆ Π 2 For each candidate, check if the truth values coincide with external sources 3 Check if A is subset-minimal under all compatible sets Definition (Compatible Set) A compatible set of a program Π is an assignment A (i) which is an answer set [Gelfond and Lifschitz, 1991] of ˆ Π , and (ii) f & g ( A ,� p ,� c ) = 1 iff T e & p ] ( � c ) ∈ A for all external atoms & g [ � p ]( � c ) in Π g [ � Definition (Answer Set) An ( DLVHEX ) answer set of Π is any set S ⊆ { T a | a ∈ A (Π) } such that (i) S = { T a | a ∈ A (Π) } ∩ A for some compatible set A of Π and (ii) S �⊂ { T a | a ∈ A (Π) } ∩ A for every compatible set A of Π . Redl C. (TU Vienna) HEX-Programs September 05, 2012 7 / 24

  9. Introduction Current Evaluation Method Translation Approach HEX-Program Π : p ( c 1 ) . dom ( c 1 ) . dom ( c 2 ) . dom ( c 3 ) . p ( X ) ← dom ( X ) , & empty [ p ]( X ) . Guessing program ˆ Π : p ( c 1 ) . dom ( c 1 ) . dom ( c 2 ) . dom ( c 3 ) . p ( X ) ← dom ( X ) , e & empty [ p ] ( X ) . e & empty [ p ] ( X ) ∨ ¬ e & empty [ p ] ( X ) ← dom ( X ) . 8 candidates, e.g.: { T p ( c 1 ) , T p ( c 2 ) , T dom ( c 1 ) , T dom ( c 2 ) , T dom ( c 3 ) , F e & empty [ p ] ( c 1 ) , T e & empty [ p ] ( c 2 ) , F e & empty [ p ] ( c 3 ) } Compatibility check: passed ⇒ compatible set Redl C. (TU Vienna) HEX-Programs September 05, 2012 8 / 24

  10. Algorithms with External Behavior Learning Outline Introduction 1 2 Algorithms with External Behavior Learning Nogood Generation for External Behavior Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 05, 2012 9 / 24

  11. Algorithms with External Behavior Learning Novel Algorithm Idea Use a conflict-driven (disjunctive) ASP solver [Drescher et al., 2008] Program ˆ Π is represented as a set of nogoods Redl C. (TU Vienna) HEX-Programs September 05, 2012 10 / 24

  12. Algorithms with External Behavior Learning Novel Algorithm Idea Use a conflict-driven (disjunctive) ASP solver [Drescher et al., 2008] Program ˆ Π is represented as a set of nogoods Introduce additional nogoods to describe external sources Definition (Assignment) An assignment is a consistent set of signed literals T a or F a , where a is an atom. Definition (Nogoods) A nogood is a set of signed literals . Definition (Solution to Nogoods) An assignment A is a solution to a set of nogoods ∆ iff δ �⊆ A for all δ ∈ ∆ . Redl C. (TU Vienna) HEX-Programs September 05, 2012 10 / 24

  13. Algorithms with External Behavior Learning Basic Definitions Definition (Correct Nogoods) A nogood δ is correct wrt. program Π , if all compatible sets of Π are solutions to δ . Definition (Learning Function) A learning function for Π is a mapping Λ : E × 2 D �→ 2 2 D E . . . set of all external predicates with input list in Π D . . . set of all signed literals Definition (Correct Learning Functions) A learning function Λ is correct for a program Π , if and only if all d ∈ Λ( & g [ � p ] , A ) p ] in E and A ∈ 2 D . are correct for Π , for all & g [ � Redl C. (TU Vienna) HEX-Programs September 05, 2012 11 / 24

  14. Algorithms with External Behavior Learning Algorithms Algorithm: HEX-Eval Algorithm: HEX-CDNL Input : A program Π , its guessing program ˆ Input : A HEX-program Π Π , a set of correct nogoods ∇ of Π Output : An answer set of ˆ Output : All answer sets of Π Π (candidate for a compatible set of Π ) which is a solution to all nogoods d ∈ ∇ , or ⊥ if none exists ˆ Π ← Π with all external atoms & g [ � p ]( � c ) replaced by e & p ]( � c ) g [ � Add guessing rules for all replacement atoms to ˆ /* assignment over A ( ˆ Π) ∪ BA ( ˆ Π) ∪ BA ( sh ( ˆ Π A ← ∅ Π)) */ ∇ ← ∅ dl ← 0 /* decision level */ /* set of dynamic nogoods */ Γ ← ∅ while true do /* set of all compatible sets */ ( A , ∇ ) ← Propagation ( ˆ while C � = ⊥ do Π , ∇ , A ) C ← ⊥ if δ ⊆ A for some δ ∈ ∆ ˆ Π ∪ Θ sh ( ˆ Π) ∪ ∇ then inconsistent ← false if dl = 0 then return ⊥ while C = ⊥ and inconsistent = false do ( ǫ, k ) ← Analysis ( δ, ˆ Π , ∇ , A ) A ← HEX-CDNL (Π , ˆ Π , ∇ ) ∇ ← ∇ ∪ { ǫ } if A = ⊥ then A ← A \ { σ ∈ A | k < dl ( σ ) } inconsistent ← true dl ← k else else if AT ∪ AF = A ( ˆ Π) ∪ BA ( ˆ Π) ∪ BA ( sh ( ˆ Π)) then compatible ← true U ← UnfoundedSet ( ˆ Π , A ) for all external atoms & g [ � p ] in Π do if U � = ∅ then Evaluate & g [ � p ] under A let δ ∈ λ ˆ Π( U ) such that δ ⊆ A ∇ ← ∇ ∪ Λ( & g [ � p ] , A ) if { σ ∈ δ | 0 < dl ( σ ) } = ∅ then return ⊥ Let A & g [ � p ]( � c ) = 1 ⇔ T e & c ) ∈ A g [ � p ]( � ( ǫ, k ) ← Analysis ( δ, ˆ Π , ∇ , A ) g [ � p ]( � c ) then c ) � = A & if ∃ � c : f & g ( A ,� p ,� ∇ ← ∇ ∪ { ǫ } A ← A \ { σ ∈ A | k < dl ( σ ) } Add A to ∇ dl ← k Set compatible ← false else return AT ∩ A ( ˆ Π) if compatible then C ← A else if Heuristic decides to evaluate & g [ � p ] then if inconsistent = false then Evaluate & g [ � p ] under A and set ∇ ← ∇ ∪ Λ( & g [ � p ] , A ) /* C is a compatible set of Π */ else ∇ ← ∇ ∪ { C } and Γ ← Γ ∪ { C } σ ← Select ( ˆ Π , ∇ , A ) dl ← dl + 1 Output {{ T a ∈ A | a ∈ A (Π) } | A ∈ Γ } which are subset-minimal A ← A ◦ ( σ ) Redl C. (TU Vienna) HEX-Programs September 05, 2012 12 / 24

  15. Algorithms with External Behavior Learning Algorithms Restricting to learning functions that are correct for Π , the following results hold. Proposition If for input Π , ˆ Π and ∇ , HEX -CDNL returns (i) an interpretation A , then A is an answer set of ˆ Π and a solution to ∇ ; (ii) ⊥ , then Π has no compatible set that is a solution to ∇ . Proposition HEX -Eval computes all answer sets of Π . Redl C. (TU Vienna) HEX-Programs September 05, 2012 13 / 24

  16. Nogood Generation for External Behavior Learning Outline Introduction 1 2 Algorithms with External Behavior Learning Nogood Generation for External Behavior Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 05, 2012 14 / 24

Recommend


More recommend