Exploiting Unfounded Sets for HEX-Program Evaluation Thomas Eiter, Michael Fink, Thomas Krennwallner, Christoph Redl, Peter Sch¨ uller redl@kr.tuwien.ac.at September 27, 2012 Redl C. (TU Vienna) HEX-Programs September 27, 2012 1 / 23
Motivation HEX-Programs Extend ASP by external sources Scalability problems due to minimality checking HEX- Reasoner program External Source Contribution Exploit unfounded sets for minimality checking Search for unfounded sets encoded as separate search problem Much better scalability Redl C. (TU Vienna) HEX-Programs September 27, 2012 2 / 23
Outline Introduction 1 2 Answer Set Computation Optimization and Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 27, 2012 3 / 23
Introduction Outline Introduction 1 2 Answer Set Computation Optimization and Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 27, 2012 4 / 23
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 27, 2012 5 / 23
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 27, 2012 6 / 23
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 27, 2012 6 / 23
Introduction Semantics of HEX-Programs Definition (FLP-Reduct [Faber et al., 2004]) For an interpretation A over a program Π , the FLP-reduct f Π A of Π wrt. A is the set { r ∈ Π | A | = b , for all b ∈ B ( r ) } of all rules whose body is satisfied under A . Definition (Answer Set) An interpretation A is an answer set of program Π iff it is a subset-minimal model of the FLP reduct f Π A . Example Program Π : dom ( a ) . dom ( b ) . p ( a ) ← dom ( a ) , & g [ p ]( a ) . p ( b ) ← dom ( b ) , & g [ p ]( b ) . where & g implements the following mapping: ∅ �→ { b } ; { a } �→ { a } ; { b } �→ ∅ ; { a , b } �→ { a , b } A = { T dom ( a ) , T dom ( b ) , T p ( a ) , F p ( b ) } is a model but no subset-minimal model of f Π A = { dom ( a ); dom ( b ); p ( a ) ← dom ( a ) , & g [ p ]( a ) } Redl C. (TU Vienna) HEX-Programs September 27, 2012 7 / 23
Answer Set Computation Outline Introduction 1 2 Answer Set Computation Optimization and Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 27, 2012 8 / 23
Answer Set Computation Answer Set Computation 2-Step Algorithm 1 Compute a compatible set (=answer set candidate) [Eiter et al., 2012] 2 Check minimality Redl C. (TU Vienna) HEX-Programs September 27, 2012 9 / 23
Answer Set Computation Answer Set Computation 2-Step Algorithm 1 Compute a compatible set (=answer set candidate) [Eiter et al., 2012] 2 Check minimality The Naive Minimality Check 1 Let A be a compatible set 2 Compute f Π A 3 Check if there is a smaller model than A Problem: Reduct has usually many models Note: In practice, smaller models are rarely found Redl C. (TU Vienna) HEX-Programs September 27, 2012 9 / 23
Answer Set Computation Answer Set Computation 2-Step Algorithm 1 Compute a compatible set (=answer set candidate) [Eiter et al., 2012] 2 Check minimality The Naive Minimality Check 1 Let A be a compatible set 2 Compute f Π A 3 Check if there is a smaller model than A Problem: Reduct has usually many models Note: In practice, smaller models are rarely found Complexity Minimality check is Co-NP-complete, lifting the overall answer set existence problem to Π P 2 (in presence of disjunctions and/or nonmonotonic external atoms) Redl C. (TU Vienna) HEX-Programs September 27, 2012 9 / 23
Answer Set Computation Using Unfounded Sets [Faber, 2005] Definition (Unfounded Set) A set of atoms X is an unfounded set of Π wrt. (partial) assignment A , iff for all a ∈ X and all r ∈ Π with a ∈ H ( r ) at least one of the following holds: 1 A �| = B ( r ) . 2 A ∪ ¬ . X �| = B ( r ) 3 A | = h for some h ∈ H ( r ) \ X . (where A ∪ ¬ . X = { T a ∈ A | a �∈ X } ∪ { F a ∈ A } ∪ { F a | a ∈ X } ) Definition (Unfounded-free Assignments) An assignment A is unfounded-free wrt. program Π , iff there is no unfounded set X of Π wrt. A such that T a ∈ A for some a ∈ X . Theorem A model A of a program Π is is an answer set iff it is unfounded-free. Redl C. (TU Vienna) HEX-Programs September 27, 2012 10 / 23
Answer Set Computation Using Unfounded Sets Encode the search for unfounded sets as SAT instance Unfounded Set Search Problem Π over atoms A (ˆ Nogood Set Γ A Π = N A Π ∪ O A Π) ∪ { h r , l r | r ∈ Π } consisting of a necessary part N A Π and an optimization part O A Π N A Π = {{ F a | T a ∈ A }} ∪ �� r ∈ Π R A � r R r , A = H r , A ∪ C r , A , where H r , A = {{ T h r } ∪ { F h | h ∈ H ( r ) }} ∪ {{ F h r , T h } | h ∈ H ( r ) } {{ T h r } ∪ { F a | a ∈ B + o ( r ) , A | = a } ∪ { t a | a ∈ B e (ˆ r ) } ∪ C r , A = { T h | h ∈ H ( r ) , A | = h }} if A | = B ( r ) , {} otherwise Intuition: Solutions of Γ A Π correspond to potential unfounded sets of Π wrt. A Redl C. (TU Vienna) HEX-Programs September 27, 2012 11 / 23
Answer Set Computation Using Unfounded Sets Each unfounded set corresponds to a solution of Γ A Π Definition (Induced Assignment of an Unfounded Set) Let U be an unfounded set of a program Π wrt. assignment A . The assignment induced by U , denoted I ( U , Γ A Π ) , is I ( U , Γ A Π ) = I ′ ( U , Γ A Π ) ∪ { F a | a ∈ A (Γ A Π ) , T a �∈ I ′ ( U , Γ A Π ) } , where I ′ ( U , Γ A Π ) = { T a | a ∈ U } ∪ { T h r | r ∈ Π , H ( r ) ∩ U � = ∅} ∪ . c ) ∈ A (ˆ { T e & p ] ( � c ) | e & p ] ( � Π) , A ∪ ¬ . U | = & g [ � p ]( � c ) } . g [ � g [ � Proposition Let U be an unfounded set of a program Π wrt. assignment A such that A T ∩ U � = ∅ . Then I ( U , Γ A Π ) is a solution to Γ A Π . Redl C. (TU Vienna) HEX-Programs September 27, 2012 12 / 23
Answer Set Computation Using Unfounded Sets Not each solution of Γ A Π corresponds to an unfounded set, but ... Proposition Let S be a solution to Γ A Π such that . p ] ( � c ) ∈ S and A �| = & g [ � p ]( � c ) implies A ∪ ¬ . U | = & g [ � p ]( � c ) ; and (a) T e & g [ � . p ] ( � c ) ∈ S and A | = & g [ � p ]( � c ) implies A ∪ ¬ . U �| = & g [ � p ]( � c ) (b) F e & g [ � where U = { a | a ∈ A (Π) , T a ∈ S } . Then U is an unfounded set of Π wrt. A . Our Approach 1 Compute a solution S of Γ A Π p ] ( � 2 Check if truth value of external atom replacement e & c ) in S is equal to g [ � . g [ � p ]( � c ) under A ∪ ¬ . U truth value of & 3 If yes: S represents an unfounded set 4 If no: continue with next solution of Γ A Π Redl C. (TU Vienna) HEX-Programs September 27, 2012 13 / 23
Optimization and Learning Outline Introduction 1 2 Answer Set Computation Optimization and Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 27, 2012 14 / 23
Optimization and Learning Optimization and Learning Optimization Generate additional nogoods O A Π to prune search space Restrict search to atoms which are true in A Try to avoid changes of truth values of external atoms Learning Nogood exchange: Search for models ↔ UFS search Learn nogoods from detected unfounded sets Redl C. (TU Vienna) HEX-Programs September 27, 2012 15 / 23
Implementation and Evaluation Outline Introduction 1 2 Answer Set Computation Optimization and Learning 3 Implementation and Evaluation 4 Conclusion 5 Redl C. (TU Vienna) HEX-Programs September 27, 2012 16 / 23
Recommend
More recommend