r1 r2 r3 r4 r5 r6 r7 y1 y2 y3 y4 y5 y6 y7 b1 b2 b3 b4 b5 b6 b7 r1' r2' r3' r4'...

12
R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ?????? SATISFIABILITY Eric L. Frederich

Upload: valerie-dodge

Post on 14-Dec-2015

275 views

Category:

Documents


3 download

TRANSCRIPT

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

SATISFIABILITY

Eric L. Frederich

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

Overview

• Definitions• K-Satisfiability• 3-Satisfiability

– Three Colorable Problem• Transformation

– Davis – Putnam Algorithm

• 2-Satisfiability– Algorithm

• Summary• References

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

Definitions

• Satisfiability– An instance of the problem is defined by a Boolean expression written

using only AND, OR, NOT, variables, and parentheses. The question is: given the expression, is there some assignment of TRUE and FALSE values to the variables that will make the entire expression true?*

• Product of Sums– A way of arranging a boolean expression such that the final output is a

result of ‘AND’ing some ‘OR’ clauses where each term within an ‘OR’ clause may or may not be ‘NOT’ed.

• n– The number of boolean variables found in the expression (with or

without a NOT)• m

– The number of ‘OR’ clauses ‘AND’ed together in the boolean expression• K

– The maximum number of variables found within each OR clause

* Definition from http://en.wikipedia.org/wiki/Satisfiability

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

K-Satisfiability

• K is the maximum number of terms allowed per ‘OR’ clause.• For any K > 2, the problem lies in NP-Complete

– Solution of order 2n

• Special K’s– 3SAT

• 3 Colorable Graph problem• Still NP-Complete

– 2SAT• Polynomial time solution

• K = 5– (A + B’ + C)(B + C’ + E’)(A’ + B + C’+ D’ + E)(B + D)

• K = 3 (3SAT)– (X’ + Y)(X + Y’ + Z)(X’ + Z’)(Y + Z’)

• K = 2 (2SAT)– (X1 + X2)(X2’ + X3)(X1’ + X2’)(X3 + X4)(X3’ + X5)(X4’ + X5’)(X3’ + X4)

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

3 – Colorable Transformation

Procedure Transform(G)for each vertex vi in G

output(ri + yi + bi)for each edge (vi,vj) in G

output(ri’ + rj ’)(yi’ + yj’)(bi’ + bj’)

output : boolean expression with K = 3

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ?????? (R2 + Y2 + B2) (R3 + Y3 + B3) (R4 + Y4 + B4) (R5 + Y5 + B5) (R7 + Y7 + B7)(R1’ + R2’)(Y1’ + Y2’)(B1’ + B2’) (R1’ + R3’)(Y1’ + Y3’)(B1’ + B3’)(R1’ + R4’)(Y1’ + Y4’)(B1’ + B4’) (R1’ + R5’)(Y1’ + Y5’)(B1’ + B5’)(R2’ + R5’)(Y2’ + Y5’)(B2’ + B5’) (R2’ + R6’)(Y2’ + Y6’)(B2’ + B6’)(R3’ + R4’)(Y3’ + Y4’)(B3’ + B4’) (R4’ + R5’)(Y4’ + Y5’)(B4’ + B5’)(R5’ + R6’)(Y5’ + Y6’)(B5’ + B6’) (R7’ + R4’)(Y7’ + Y4’)(B7’ + B4’)(R7’ + R5’)(Y7’ + Y5’)(B7’ + B5’)

(R6 + Y6 + B6)

1 2

43 5

6

7

(R1 + Y1 + B1)( Y1 )( B2)(R3 )( B4)(R5 )( Y6 )( Y7 )(R1' + R2’)( + Y2’)(B1’ + )(R1’ + )( + Y3’)(B1’ + B3’)(R1' + R4’)( + Y4’)(B1’ + )(R1’ + )( + Y5’)(B1’ + B5’)(R2' + )(Y2’ + Y5’)( + B5’)(R2’ + R6’)(Y2’ + )( + B6’)( + R4’)(Y3’ + Y4’)(B3’ + )(R4’ + )(Y4’ + Y5’)( + B5’)( + R6’)(Y5’ + )(B5’ + B6’)(R7’ + R4’)( + Y4’)(B7’ + )(R7' + )( + Y5’)(B7’ + B5’)

2(21) = 2,097,152

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7

(R1 + Y1 + B1)(R2 + Y2 + B2)(R3 + Y3 + B3)(R4 + Y4 + B4)(R5 + Y5 + B5)(R6 + Y6 + B6)(R7 + Y7 + B7)(R1' + R2’)(Y1’ + Y2’)(B1’ + B2’)(R1’ + R3’)(Y1’ + Y3’)(B1’ + B3’)(R1' + R4’)(Y1’ + Y4’)(B1’ + B4’)(R1’ + R5’)(Y1’ + Y5’)(B1’ + B5’)(R2' + R5’)(Y2’ + Y5’)(B2’ + B5’)(R2’ + R6’)(Y2’ + Y6’)(B2’ + B6’)(R3’ + R4’)(Y3’ + Y4’)(B3’ + B4’)(R4’ + R5’)(Y4’ + Y5’)(B4’ + B5’)(R5’ + R6’)(Y5’ + Y6’)(B5’ + B6’)(R7’ + R4’)(Y7’ + Y4’)(B7’ + B4’)(R7' + R5’)(Y7’ + Y5’)(B7’ + B5’)

3-ColorableR1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7'

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

Davis - Putnam

• Recursive but still 2n

• Prunes off branches which will not yield a result.• Does not examine the entire expression at each

guess

Procedure split (E)1. if E has an empty clause, then return2. if E has no clauses, then exit with current partial assignment3. select next unassigned variable, xi, in E4. split ( E ( xi = 0 ) )5. split ( E ( xi = 1 ) )

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

Davis - Putnam(X1 + X3’ + X4)(X1’ + X2’ + X4’)(X2’ + X3)(X1’ + X2 + X4)

(X3’ + X4)(X2’ + X3) (X2’ + X4’)(X2’ + X3)(X2 + X4)

X1 = 0 X1 = 1

(X3’ + X4)

X2 = 0

(X3’ + X4)(X3)

X2 = 1

(X4) (X4’)(X3)

X2 = 0 X2 = 1

X3 = 0 X3 = 1X3 = 0

X3 = 1 X3 = 0X3 = 1 X3 = 0 X3 = 1

X4 = 0 X4 = 1

(X4)X4 = 0

(X4)

X4 = 0

X4 = 0

(X4)

X4 = 0

X4 = 0

(X4)

X4 = 0X4 = 0

(X4’)

X4 = 0

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

2- Satisfiability

Pick an assignment

Drop terms that become true

Make assignments based on initial assignment.

Repeat….

(X1 + X2)(X2’ + X3)(X1’ + X2’)(X3 + X4)(X3’ + X5)(X4’ + X5’)(X3’ + X4)

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

Summary

• For K-Satisfiability where K > 2 it is an NP-Complete Problem

• 2-Satisfiability is solvable in polynomial time• Davis-Putnam improves efficiency but does not

decrease order of complexity• 3-Colorable problem is synonymous to 3-

Satisfiability

R1 R2 R3 R4 R5 R6 R7 Y1 Y2 Y3 Y4 Y5 Y6 Y7 B1 B2 B3 B4 B5 B6 B7 R1' R2' R3' R4' R5' R6' R7' Y1' Y2' Y3' Y4' Y5' Y6' Y7' B1' B2' B3' B4' B5' B6' B7' ??????

References

• http://condor.stcloudstate.edu/~pkjha/CSCI504/2SAT.pdf

• http://en.wikipedia.org/wiki/Satisfiability

• "The New Turing Omnibus", by A.K. DewdneyA.W.H. Freeman/Owl Book, 2001 New York