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

improving the normalization of weight rules in answer set
SMART_READER_LITE
LIVE PREVIEW

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,


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

slide-2
SLIDE 2

JELIA’14, September 24, 2014 2/19

Background

§ Answer set programming (ASP) features a rule-based

syntax subject to answer-set semantics. Problem

Solve

Ý Ý Ý Ñ Solution(s)

Formalize Ó

Ò Extract Set of rules

Ground & Search

Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ý Ñ Answer set(s)

slide-3
SLIDE 3

JELIA’14, September 24, 2014 3/19

Different Types of Rules

We consider propositional answer set programs containing:

§ Normal rules:

a Ð b, c, not d, not e

§ Cardinality rules:

a Ð 3 ď tb, c, d, not e, not fu

§ Weight rules:

a Ð 6 ď rb “ 2, c “ 4, d “ 3, e “ 3, f “ 1, g “ 4s Objectives:

§ Rewrite weight rules using normal rules § Complement back-ends lacking weight rule support § Improve efficiency of nogood recording

slide-4
SLIDE 4

JELIA’14, September 24, 2014 4/19

Example of Normalization

a Ð 3 ď tb, c, d, not e, not fu ÞÝ Ñ 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.

slide-5
SLIDE 5

JELIA’14, September 24, 2014 5/19

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

slide-6
SLIDE 6

JELIA’14, September 24, 2014 6/19

Outline

  • 1. Primitives: Merging and Sorting Programs
  • 2. Arithmetics Behind the Translation
  • 3. Encoding the Summation
  • 4. Enhancements
  • 5. Experiments
  • 6. Conclusions
slide-7
SLIDE 7

JELIA’14, September 24, 2014 7/19

  • 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

s1s2s3s4s5s6s7s8s9s10s11 a b c d e f g h i j k Sorter6 Sorter5 Merger6,5 2 4 3 3 1 4

“ “ “ “ “ “

Sorter17 b c d e f g a

slide-8
SLIDE 8

JELIA’14, September 24, 2014 8/19

  • 2. Arithmetics Behind the Translation

§ Suppose we have a weight rule of the form

a Ð 31 ď xb “ 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 “ 4y

§ ... and an answer set M “ ta, 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?

slide-9
SLIDE 9

JELIA’14, September 24, 2014 9/19

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

slide-10
SLIDE 10

JELIA’14, September 24, 2014 10/19

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

slide-11
SLIDE 11

JELIA’14, September 24, 2014 11/19

Digit-wise Summing

Normalization of a Ð 31 ď rb “ 13, c “ 7, . . . , not m “ 4s

13 7 1 11 19 19 10 13 6 13 3 4 0 ˆ 12 3 ˆ 6 3 ˆ 3 5 ˆ 1

“ “ “ “ “ “ “ “ “ “ “ “

not not not not not Sorter5 Sorter6 Sorter4 Sorter11 b c d e f g h i j k l m 1001B 101B 1B 112B 1101B 1101B 111B 1001B 100B 1001B 10B 11B

Base B “ 3, 2, 2, 8 and answer set M “ ta, c, d, e, i, k, . . .u

slide-12
SLIDE 12

JELIA’14, September 24, 2014 12/19

Carry Propagation

Merger6,3 Merger4,3 Merger5,4 0 ˆ 12 3 ˆ 6 3 ˆ 3 1 ˆ 3 2 ˆ 6 5 ˆ 1 2 ˆ 12 4 ˆ 3 5 ˆ 6 2 ˆ 12

§ The most significant digit

  • f the sum is computed

§ Divisions by base radices

3, 2, 2 give carries

§ The representation of the

  • utcome becomes unique
slide-13
SLIDE 13

JELIA’14, September 24, 2014 13/19

  • 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

slide-14
SLIDE 14

JELIA’14, September 24, 2014 14/19

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 ‚ Effects on translation size are heuristically estimated ‚ The most promising prime is chosen

repeat

slide-15
SLIDE 15

JELIA’14, September 24, 2014 15/19

Implementation without Structure Sharing

§ Normalization of a Ð 31 ď rb “ 13, c “ 7, . . . , not m “ 4s

Merger 8,3

Merger 3,4

/ 3

Merger 2,2

Merger 4,2

Merger 3,6

Merger 4,1

Merger 4,5

not i not j Merger 1,1 Merger 1,1 not k Merger 1,1 not l not m Merger 1,1 Merger 1,1 b c Merger 1,1 d Merger 1,1 e f Merger 1,1 Merger 1,1 Merger 1,1 g Merger 1,1 h Merger 1,1

Merger 2,1 Merger 2,2 Merger 2,2

Merger 4,4

Merger 2,2 Merger 2,2

/ 2 / 2 a

2

§ Sorters are implemented

via merge-sorting

§ The result contains

unnecessary repetition

slide-16
SLIDE 16

JELIA’14, September 24, 2014 16/19

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

slide-17
SLIDE 17

JELIA’14, September 24, 2014 17/19

Structure Sharing Result

Merger 5,6

Merger 3,4

/ 3

Merger 2,2

Merger 3,3

Merger 3,6

Merger 2,3

Merger 4,5

not i not j

Merger 1,1

not k

Merger 1,2

not l not m

Merger 1,1 Merger 1,1

b c

Merger 1,2

d

Merger 1,2

e

Merger 1,2

f

Merger 1,1

g

Merger 1,1

h

Merger 3,3

/ 2 / 2 a

2

We use a greedy algorithm to:

§ perform splits § share intermediary results

slide-18
SLIDE 18

JELIA’14, September 24, 2014 18/19

  • 5. Experiments

§ The translation is implemented in LP2NORMAL2 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

slide-19
SLIDE 19

JELIA’14, September 24, 2014 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