improving the normalization of weight rules in answer set
play

Improving the Normalization of Weight Rules in Answer Set Programs - PowerPoint PPT Presentation

Improving the Normalization of Weight Rules in Answer Set Programs Jori Bomanson, Martin Gebser, and Tomi Janhunen Helsinki Institute for Information Technology HIIT Department of Information and Computer Science Aalto University JELIA,


  1. Improving the Normalization of Weight Rules in Answer Set Programs Jori Bomanson, Martin Gebser, and Tomi Janhunen Helsinki Institute for Information Technology HIIT Department of Information and Computer Science Aalto University JELIA, Madeira, Portugal, September 24, 2014

  2. Background § Answer set programming (ASP) features a rule-based syntax subject to answer-set semantics. Solve Ý Ý Ý Ñ Problem Solution(s) Formalize Ó Ò Extract Ground & Search Set of rules Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ñ Answer set(s) JELIA’14, September 24, 2014 2/19

  3. Different Types of Rules We consider propositional answer set programs containing: § Normal rules: a Ð b , c , not d , not e § Cardinality rules: a Ð 3 ď t b , c , d , not e , not f u § Weight rules: a Ð 6 ď r b “ 2 , c “ 4 , d “ 3 , e “ 3 , f “ 1 , g “ 4 s Objectives: § Rewrite weight rules using normal rules § Complement back-ends lacking weight rule support § Improve efficiency of nogood recording JELIA’14, September 24, 2014 3/19

  4. Example of Normalization a Ð 3 ď t b , c , d , not e , not f u ÞÝ Ñ a Ð b , c , d . a Ð c , d , not e . a Ð d , not e , not f . a Ð b , c , not e . a Ð c , d , not f . a Ð b , c , not f . a Ð c , not e , not f . a Ð b , d , not e . a Ð b , d , not f . a Ð b , not e , not f . JELIA’14, September 24, 2014 4/19

  5. Related Work § Eén and Sörensson, JSAT’06 ‚ Translation of Pseudo-Boolean to sorting networks to SAT § Bailleux, Boufkhad, and Roussel, SAT’09 ‚ Polynomial Watchdog translation using tares § Codish, Fekete, Fuhs, and Schneider-Kamp, TACAS’11 ‚ Optimal base problem and algorithm(s) § Bomanson and Janhunen, LPNMR’13 ‚ Merging and sorting for normalizing cardinality rules JELIA’14, September 24, 2014 5/19

  6. Outline 1. Primitives: Merging and Sorting Programs 2. Arithmetics Behind the Translation 3. Encoding the Summation 4. Enhancements 5. Experiments 6. Conclusions JELIA’14, September 24, 2014 6/19

  7. 1. Primitives: Merging and Sorting Programs § We illustrate normalization designs using circuits § Merging and sorting circuits have normal rule encodings § Weight rules can be normalized using these primitives a s 1 s 2 s 3 s 4 s 5 s 6 s 7 s 8 s 9 s 10 s 11 Merger 6 , 5 Sorter 17 Sorter 6 Sorter 5 b 2 “ c 4 “ d 3 “ e 3 “ f 1 “ a b c d e f g h i j k g 4 “ JELIA’14, September 24, 2014 7/19

  8. 2. Arithmetics Behind the Translation § Suppose we have a weight rule of the form a Ð 31 ď x b “ 13 , c “ 7 , d “ 1 , e “ 11 , f “ 19 , g “ 19 , h “ 10 , not i “ 13 , not j “ 6 , not k “ 13 , not l “ 3 , not m “ 4 y § ... and an answer set M “ t a , c , d , e , i , k , . . . u § Summing the weights of satisfied body literals gives 7 ` 1 ` 11 ` 6 ` 3 ` 4 “ 32 § Question: How to do this with circuits? JELIA’14, September 24, 2014 8/19

  9. Summing in Mixed-Radix Bases § Using the mixed-radix base B “ 3 , 2 , 8 : 6 3 1 c “ 7 ‚ ‚ d “ ‚ 1 e “ 11 ‚ ‚ ‚‚ not j “ 6 ‚ not l “ 3 ‚ not m “ 4 ‚ ‚ Σ “ 32 ‚‚‚ ‚‚‚ ‚‚‚‚‚ Σ “ 32 ‚‚‚ ‚‚‚‚ ‚‚ Σ “ 32 ‚‚‚‚‚ ‚‚ bound “ 31 ‚‚‚‚‚ ‚ § Eén and Sörensson, JSAT’06 JELIA’14, September 24, 2014 9/19

  10. Simplifying Bound Checking with Tares § Using the mixed-radix base B “ 3 , 2 , 8 and tare t “ 5: 6 3 1 Σ “ 32 ‚‚‚ ‚‚‚ ‚‚‚‚‚ t “ 5 ‚ ‚‚ Σ ` t “ 37 ‚‚‚ ‚‚‚‚ ‚‚‚‚‚‚‚ Σ ` t “ 37 ‚‚‚ ‚‚‚‚‚‚ ˚ Σ ` t “ 37 ‚‚‚‚‚‚ ˚ ˚ bound ` t “ 36 ‚‚‚‚‚‚ § Lexicographical comparison becomes trivial § It suffices to know the most significant digit of the sum § Bailleux, Boufkhad, and Roussel, SAT’09 JELIA’14, September 24, 2014 10/19

  11. Digit-wise Summing Normalization of a Ð 31 ď r b “ 13 , c “ 7 , . . . , not m “ 4 s 5 ˆ 1 0 ˆ 12 3 ˆ 6 3 ˆ 3 Sorter 5 Sorter 6 Sorter 4 Sorter 11 b 13 1001 B “ c 7 101 B “ d 1 1 B “ e 11 112 B “ f 19 1101 B “ g 19 1101 B “ h 10 111 B “ not i 13 1001 B “ not j 6 100 B “ not k 13 1001 B “ not l 3 10 B “ not m 4 11 B “ Base B “ 3 , 2 , 2 , 8 and answer set M “ t a , c , d , e , i , k , . . . u JELIA’14, September 24, 2014 11/19

  12. Carry Propagation § The most significant digit 2 ˆ 12 of the sum is computed 2 ˆ 12 § Divisions by base radices 3 , 2 , 2 give carries Merger 5 , 4 § The representation of the 5 ˆ 6 outcome becomes unique 2 ˆ 6 Merger 6 , 3 4 ˆ 3 1 ˆ 3 Merger 4 , 3 5 ˆ 1 0 ˆ 12 3 ˆ 6 3 ˆ 3 JELIA’14, September 24, 2014 12/19

  13. 4. Enhancements § Several aspects of the translation can be adjusted § Choices can be made between ‚ types of mergers ‚ mixed-radix bases ‚ input arrangement in merge-sorting § These choices affect translation size directly and through impacts on shared structure JELIA’14, September 24, 2014 13/19

  14. Mixed-Radix Base Selection § Eén and Sörensson, JSAT’06 ‚ Enumerating bases consiting of primes ă 20 § Bailleux, Boufkhad, and Roussel, SAT’09 ‚ Using binary bases § Codish, Fekete, Fuhs, and Schneider-Kamp, TACAS’11 ‚ Searching optimal bases with sophisticated algorithms § Our approach: ‚ Radices are selected from least to most significant ‚ Prime numbers are considered as candidates repeat ‚ Effects on translation size are heuristically estimated ‚ The most promising prime is chosen JELIA’14, September 24, 2014 14/19

  15. Implementation without Structure Sharing § Normalization of a Ð 31 ď r b “ 13 , c “ 7 , . . . , not m “ 4 s § Sorters are implemented via merge-sorting § The result contains a 2 unnecessary repetition Merger 4,5 / 2 Merger 3,6 / 2 Merger 3,4 / 3 Merger 8,3 Merger 4,4 Merger 4,1 Merger 4,2 Merger 2,2 Merger 2,2 Merger 2,2 Merger 2,1 Merger 2,2 Merger 2,2 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 b c d e f g h not i not j not k not l not m JELIA’14, September 24, 2014 15/19

  16. Restructuring Merge-Sorters § Input can be arranged and divided freely § Different choices lead to different structure § With the right choices, shared input between sorters leads to common structure JELIA’14, September 24, 2014 16/19

  17. Structure Sharing Result We use a greedy algorithm to: § perform splits a § share intermediary results 2 Merger 4,5 / 2 Merger 3,6 / 2 Merger 3,4 / 3 Merger 5,6 Merger 3,3 Merger 2,3 Merger 3,3 Merger 1,2 Merger 1,2 Merger 1,2 Merger 2,2 Merger 1,2 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 Merger 1,1 b c d e f g h not i not j not k not l not m JELIA’14, September 24, 2014 17/19

  18. 5. Experiments § The translation is implemented in LP 2 NORMAL 2 with configurable choices of bases and sharing § For selected benchmarks, the proposed translation improves on the runtime of CLASP Mixed Binary Benchmark Native Shared Independent Shared Independent SWC Bayes-Find 202 30 164 246 165 1,721 Bayes-Prove 1,391 492 1,316 631 890 2,587 Markov-Find 2,426 2,770 1,845 2,682 2,966 5,224 Markov-Prove 2,251 3,294 3,428 3,255 3,229 5,402 Fastfood 10,277 12,843 14,156 13,756 13,479 17,867 Inc-Scheduling 257 1,340 1,330 1,481 1,581 Nomystery 4,907 4,236 3,332 4,290 3,512 4,739 Summary 21,715 25,009 25,576 26,345 25,827 JELIA’14, September 24, 2014 18/19

  19. 6. Conclusions We propose new ways to normalize weight rules, incorporating: § Mixed-radix bases for concise representation of weights § Tares for simplified bound checking § Efficient primitives for digit-wise operations Contributions: § Structure sharing algorithm § Base selection heuristic § Generalization of cardinality translations for weight rules § Selective and automated configuration of mergers JELIA’14, September 24, 2014 19/19

Recommend


More recommend