Competitive Sorter-based Encoding of PB-Constraints into SAT nski , - - PowerPoint PPT Presentation

competitive sorter based encoding of pb constraints into
SMART_READER_LITE
LIVE PREVIEW

Competitive Sorter-based Encoding of PB-Constraints into SAT nski , - - PowerPoint PPT Presentation

Competitive Sorter-based Encoding of PB-Constraints into SAT nski , Marek Piotr ow Micha l Karpi Institute of Computer Science University of Wroc law Poland 7 July, 2018 Outline 1 Definitions and motivation 2 Description of the


slide-1
SLIDE 1

Competitive Sorter-based Encoding of PB-Constraints into SAT

Micha l Karpi´ nski, Marek Piotr´

  • w

Institute of Computer Science University of Wroc law Poland

7 July, 2018

slide-2
SLIDE 2

Outline

1 Definitions and motivation 2 Description of the system 3 Experimental evaluation 4 Conclusions Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-3
SLIDE 3

Definitions and motivation

x1 + x2 + x3 < 3 y1 + 2y2 ≥ 1 z1 + 3z2 + 4z3 + 7z4 = 8

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-4
SLIDE 4

Definitions and motivation

x1 + x2 + x3 < 3 y1 + 2y2 ≥ 1 z1 + 3z2 + 4z3 + 7z4 = 8 x1, . . . , xn – literals, a1, . . . , an ∈ Z – coefficients, n, k ∈ N: a1x1 + . . . + anxn # k.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-5
SLIDE 5

Definitions and motivation

Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-6
SLIDE 6

Definitions and motivation

Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = max(a,b) d = min(a,b)

slide-7
SLIDE 7

Definitions and motivation

Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

slide-8
SLIDE 8

Definitions and motivation

Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

a ⇒ c, b ⇒ c, a ∧ b ⇒ d.

slide-9
SLIDE 9

Definitions and motivation

x1 + x2 + 2x3 + 4x4 < 3 Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

a ⇒ c, b ⇒ c, a ∧ b ⇒ d.

slide-10
SLIDE 10

Definitions and motivation

x1 + x2 + x3 + x3 + x4 + x4 + x4 + x4 < 3 Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

a ⇒ c, b ⇒ c, a ∧ b ⇒ d.

slide-11
SLIDE 11

Definitions and motivation

x1 + x2 + x3 + x3 + x4 + x4 + x4 + x4 < 3

x x x x x x x x y y y y y y y y

1 2 3 3 4 4 4 4 1 2 3 4 5 6 7 8

=0

Bather’s odd-even sorting network (1968)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

a ⇒ c, b ⇒ c, a ∧ b ⇒ d.

slide-12
SLIDE 12

Definitions and motivation

x1 + x2 + x3 + x3 + x4 + x4 + x4 + x4 < 3

x x x x x x x x y y y

1 2 3 3 4 4 4 4 1 2 3=0

Codish and Zazon-Ivry’s odd-even selection network (2012)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

a b c = a ∨ b d = a ∧ b

a ⇒ c, b ⇒ c, a ∧ b ⇒ d.

slide-13
SLIDE 13

Definitions and motivation

3x1 + 2x2 + 4x3 ≤ 5, 30001x1 + 19999x2 + 39998x3 ≤ 50007

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-14
SLIDE 14

Definitions and motivation

3x1 + 2x2 + 4x3 ≤ 5, 30001x1 + 19999x2 + 39998x3 ≤ 50007 (¯ x1 ∨ ¯ x3) ∧ (¯ x2 ∨ ¯ x3)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-15
SLIDE 15

Definitions and motivation

Mixed Radix Base Technique by Niklas E´ en and Niklas S¨

  • rensson (2006) – authors of MiniSat+.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-16
SLIDE 16

Definitions and motivation

Mixed Radix Base Technique by Niklas E´ en and Niklas S¨

  • rensson (2006) – authors of MiniSat+.

Positive integer d = d0, . . . , dm−1. Base B is a sequence of positive integers r0, . . . , rm−1. The value of d is v = d0w0 + d1w1 + d2w2 + · · · + dm−1wm−1 where w0 = 1 and for i ≥ 0, wi+1 = wiri.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-17
SLIDE 17

Definitions and motivation

Mixed Radix Base Technique by Niklas E´ en and Niklas S¨

  • rensson (2006) – authors of MiniSat+.

Positive integer d = d0, . . . , dm−1. Base B is a sequence of positive integers r0, . . . , rm−1. The value of d is v = d0w0 + d1w1 + d2w2 + · · · + dm−1wm−1 where w0 = 1 and for i ≥ 0, wi+1 = wiri. Example: The number 2, 4, 10B in base B = 3, 5 is interpreted as: 2 × 1 + 4 × 3 + 10 × 15 = 164 (values of wi’s in boldface).

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-18
SLIDE 18

Definitions and motivation

For PB-constraint with coefficients {a1, . . . , an} do:

1 Find a ”suitable” finite base B for the set of coefficients. 2 For each element ri of B construct a sorting network where

the inputs to i-th sorter will be those digits d (from the coefficients) where di is non-zero, plus the potential carry bits from the (i − 1)-th sorter.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-19
SLIDE 19

Description of the system

PB-solver KP-MiniSat+ based on MiniSat+ with the following modifications: 4-Odd-Even Selection Network (based on Multiway Merging Network of Lee and Batcher (1995)). Simplifying inequality assertions (from NaPS by Sakai et al. (2015)). Optimal base algorithm by Codish et al. (2011). Binary minimization strategy (from NaPS). ROBDDs instead of BDDs (by Ab´ ıo et al. (2012)). Merging carry bits. COMiniSatPS instead of MiniSat.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-20
SLIDE 20

Description of the system

Assume k ≤ n, ¯ x = x1, . . . , xn – sequence of Boolean literals. If k = 0, there is nothing to do. If k = 1, use a direct network (x1 ⇒ y1, . . . , xn ⇒ y1). If k > 1:

Split the input into subsequences of either the same literals (of length at least 2) or sorted 5 singletons. Sort subsequences by length, in a non-increasing order. In loop: merge each 4 (or less) consecutive subsequences into

  • ne (using 4-Odd-Even Merging Network as a sub-procedure)

and select at most k largest items until one subsequence remains.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-21
SLIDE 21

Description of the system

  • e_4merge11

5

  • e_4merge7

3

  • e_4combine8 6

6

  • e_4merge18

6

1 1 1

sort5

1 1 1 1

sort5

1 1

sort5

1 1

sort3

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-22
SLIDE 22

Description of the system

  • e 4combine on x0, x1, . . . and y0, y1, . . .:

1 Performs a zip operation: x0, y0, x1, y1, x2, y2, . . .. 2 Compare [yi : xi+2], for i = 0, 1, . . . , resulting in

x′

0, y′ 0, x′ 1, y′ 1, . . ..

3 Compare [y′

i : x′ i+1], for i = 0, 1, . . . , to get

x′′

0 , y′′ 0 , x′′ 1 , y′′ 1 , . . ..

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-23
SLIDE 23

Description of the system

  • e 4combine on x0, x1, . . . and y0, y1, . . .:

1 Performs a zip operation: x0, y0, x1, y1, x2, y2, . . .. 2 Compare [yi : xi+2], for i = 0, 1, . . . , resulting in

x′

0, y′ 0, x′ 1, y′ 1, . . ..

3 Compare [y′

i : x′ i+1], for i = 0, 1, . . . , to get

x′′

0 , y′′ 0 , x′′ 1 , y′′ 1 , . . ..

1

x y

1 1

x y

2 2

x x

3 4

x y

1 1 1 1 1 1 1 1 1 1 1

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-24
SLIDE 24

Description of the system

y′

i = max(yi, xi+2) ≡ yi ∨ xi+2

i = 0, 1, . . . x′

i = min(yi−2, xi) ≡ yi−2 ∧ xi

i = 2, 3, . . . y′′

i = max(y′ i , x′ i+1) = y′ i ∨ x′ i+1 = yi ∨ xi+2 ∨ (yi−1 ∧ xi+1),

x′′

i = min(y′ i−1, x′ i ) = y′ i−1 ∧ x′ i = (yi−1 ∨ xi+1) ∧ yi−2 ∧ xi

= (yi−1 ∧ yi−2 ∧ xi) ∨ (yi−2 ∧ xi ∧ xi+1) = (yi−1 ∧ xi) ∨ (yi−2 ∧ xi+1)

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-25
SLIDE 25

Description of the system

Propagating 1’s from inputs to outputs: yi ⇒ y′′

i , xi+2 ⇒ y′′ i , yi−1 ∧ xi+1 ⇒ y′′ i , yi−1 ∧ xi ⇒ x′′ i ,

yi−2 ∧ xi+1 ⇒ x′′

i ,

  • therwise:

y′′

i ⇒ yi−1 ∨ xi+2, y′′ i ⇒ yi ∨ xi+1, x′′ i ⇒ xi, x′′ i ⇒ yi−2,

x′′

i ⇒ yi−1 ∨ xi+1.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-26
SLIDE 26

Description of the system

K., P.: Encoding Cardinality Constraints using Multiway Merge Selection Networks, CP 2018. Theorem Let n, k ∈ N such that 1 ≤ k ≤ n/4 and n and k are both powers

  • f 4. Then:

dsVk(n) =V (oe 2seln

k ) − V (oe 4seln k ) ≥

(n − k)(5k + 2) 3k log k 2

  • + 3

n k − 1

  • .

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-27
SLIDE 27

Experimental evaluation

Instances from Pseudo-Boolean Competition 2016: DEC-SMALLINT-LIN - 1783 instances of decision problems with small coefficients in the constraints (no constraint with sum of coefficients greater than 220). No objective function to

  • ptimize. The solver must simply find a solution.

OPT-BIGINT-LIN - 1109 instances of optimization problems with big coefficients in the constraints (at least one constraint with a sum of coefficients greater than 220). An objective function is present. The solver must find a solution with the best possible value of the objective function. OPT-SMALLINT-LIN - 1600 instances of optimization

  • problems. Similar to OPT-BIGINT-LIN but with small

coefficients (as in DEC-SMALLINT-LIN) in the constraints.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-28
SLIDE 28

Experimental evaluation

KP-MS+ – KP-MiniSat+ PBLib – pbSolver from PBLib ver. 1.2.1, by Tobias Philipp and Peter Steinke. NaPS – NaPS ver. 1.02b by Masahiko Sakai and Hidetomo Nabeshima. MS+ – MiniSat+ with MiniSat. MS+COM – MiniSat+ with COMiniSatPS.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-29
SLIDE 29

Experimental evaluation

Machines: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz. Timeout limit: 1800 seconds. Memory limit: 15 GB.

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-30
SLIDE 30

Experimental evaluation

DEC-SMALLINT-LIN:

1080 1100 1120 1140 1160 1180 1200 1220 1240 1260 1280 1300 1320 1340 1360 1380 1400 1420 1440 1460 1480 100 300 500 700 900 1100 1300 1500 1700 KP-MS+ NaPS PBLib MS+ MS+COM

Number of solved instances Time in seconds

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-31
SLIDE 31

Experimental evaluation

OPT-BIGINT-LIN:

130 150 170 190 210 230 250 270 290 310 330 350 370 390 410 430 100 300 500 700 900 1100 1300 1500 1700 KP-MS+ NaPS MS+ MS+COM

Number of solved instances Time in seconds

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-32
SLIDE 32

Experimental evaluation

OPT-SMALLINT-LIN:

600 620 640 660 680 700 720 740 760 780 800 820 840 860 880 900 50 250 450 650 850 1050 1250 1450 1650 KP-MS+ NaPS PBLib MS+ MS+COM

Number of solved instances Time in seconds

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT

slide-33
SLIDE 33

The end

Thank You!

Micha l Karpi´ nski, Marek Piotr´

  • w

Competitive Sorter-based Encoding of PB-Constraints into SAT