Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV - - PowerPoint PPT Presentation

slides for cis 675
SMART_READER_LITE
LIVE PREVIEW

Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV - - PowerPoint PPT Presentation

Slides for CIS 675 NP-Complete Problems, Part 2 Jim Royer DPV Chapter 8 April 15, 2019 Uncredited diagrams are from DPV or homemade. NP-Completeness (DPV Chapter 8) April 15, 2019 1 / 35 The Plan of 8.3 All of NP S AT 3S AT I NDEPENDENT


slide-1
SLIDE 1

Slides for CIS 675

NP-Complete Problems, Part 2

Jim Royer

DPV Chapter 8

April 15, 2019

Uncredited diagrams are from DPV or homemade. NP-Completeness (DPV Chapter 8) April 15, 2019 1 / 35

slide-2
SLIDE 2

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 2 / 35

slide-3
SLIDE 3

Warm up: Rudrata (s, t)-Path Rudrata Cycle

Rudrata (s, t)-Path

Given: G = (V, E) and s, t ∈ V. Find: A path from s to t in G passing through each vertex once.

Rudrata Cycle

Given: G = (V, E). Find: A cycle in G passing through each vertex

  • nce.

Rudrata (s, t)-Path Rudrata Cycle:

Given an instance of Rudrata (s, t)-Path, (G, s, t), construct G′ by adding an new vertex x and new edges (x, s) and (x, t). If P is a Rudrata-cyclc in G′, then leaving x, (x, s) and (x, t) out of P gives an (s, t)-Rudrata path in G. If G has a (s, t)-Rudrata path P, then adding (x, s) and (x, t) to P yields a Rudrata cycle in G′.

∴ If G′ has no Rudrata cycle, then G has no (s, t)-Rudrata path.

NP-Completeness (DPV Chapter 8) April 15, 2019 3 / 35

slide-4
SLIDE 4

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 4 / 35

slide-5
SLIDE 5

3SAT Independent Set, 1

3SAT

Given: A CNF formula θ in which each clause has at most 3 literals. Find: A satisfying assignment for θ.

Independent Set Problem

Given: G = (V, E) and b. Find: An independent set for G of size ≥ b. I.e., Find U ⊆ V with |U| ≥ b and (∀u, v ∈ U)[(u, v) / ∈ E]. Puzzle: These are very different looking problems. How to we get a reduction?

NP-Completeness (DPV Chapter 8) April 15, 2019 5 / 35

slide-6
SLIDE 6

3SAT Independent Set, 1

3SAT

Given: A CNF formula θ in which each clause has at most 3 literals. Find: A satisfying assignment for θ.

Independent Set Problem

Given: G = (V, E) and b. Find: An independent set for G of size ≥ b. I.e., Find U ⊆ V with |U| ≥ b and (∀u, v ∈ U)[(u, v) / ∈ E]. Puzzle: These are very different looking problems. How to we get a reduction? Think circuits, but not too literally.

NP-Completeness (DPV Chapter 8) April 15, 2019 5 / 35

slide-7
SLIDE 7

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently!

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-8
SLIDE 8

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-9
SLIDE 9

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). A clause (ℓ1 ∨ ℓ2 ∨ ℓ3) is represented by a triangle with verts labeled: ℓ1, ℓ2, & ℓ3. y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-10
SLIDE 10

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). A clause (ℓ1 ∨ ℓ2 ∨ ℓ3) is represented by a triangle with verts labeled: ℓ1, ℓ2, & ℓ3. Idea: If v ∈ U an indep. set and v has label ℓ, then the truth assignment corresponding to U sets ℓ to TRUE. y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-11
SLIDE 11

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). A clause (ℓ1 ∨ ℓ2 ∨ ℓ3) is represented by a triangle with verts labeled: ℓ1, ℓ2, & ℓ3. Idea: If v ∈ U an indep. set and v has label ℓ, then the truth assignment corresponding to U sets ℓ to TRUE. Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-12
SLIDE 12

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). A clause (ℓ1 ∨ ℓ2 ∨ ℓ3) is represented by a triangle with verts labeled: ℓ1, ℓ2, & ℓ3. Idea: If v ∈ U an indep. set and v has label ℓ, then the truth assignment corresponding to U sets ℓ to TRUE. Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) But we have to have consistency checks. We don’t want to set x and x to TRUE. y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-13
SLIDE 13

3SAT Independent Set, 2

To build a satisfying assignment of an instance of 3SAT, we have to pick out at least one literal per clause to be TRUE — consistently! Consider: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y). A clause (ℓ1 ∨ ℓ2 ∨ ℓ3) is represented by a triangle with verts labeled: ℓ1, ℓ2, & ℓ3. Idea: If v ∈ U an indep. set and v has label ℓ, then the truth assignment corresponding to U sets ℓ to TRUE. Set g = # of clauses. So any indep. set must have one vertex from each triangle. (Why?) But we have to have consistency checks. We don’t want to set x and x to TRUE. So put an edge between each occurrence of a variable x and each occurrence of x. This enforces consistency. (Why?) y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 6 / 35

slide-14
SLIDE 14

3SAT Independent Set, 3

Construction: 3SAT instance → IS instance Given an instance of 3SAT C1, . . . , Ck. For each clause Ci = (ℓ1, ℓ2, ℓ3), build a triangle with vertices labeled ℓ1, ℓ2, & ℓ3. Add an edge between each literal and all of its opposites. Set g = k. Construction: IS solution → 3SAT solution Given an independent set U: for each v ∈ U with label ℓ, set ℓ to TRUE. For each variable that does not yet have a truth value, set it to TRUE. (x ∨ y ∨ z)∧ (x ∨ y ∨ z)∧ (x ∨ y ∨ z)∧ (x ∨ y)

y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 7 / 35

slide-15
SLIDE 15

3SAT Independent Set, 3

Construction: 3SAT instance → IS instance Given an instance of 3SAT C1, . . . , Ck. For each clause Ci = (ℓ1, ℓ2, ℓ3), build a triangle with vertices labeled ℓ1, ℓ2, & ℓ3. Add an edge between each literal and all of its opposites. Set g = k. Construction: IS solution → 3SAT solution Given an independent set U: for each v ∈ U with label ℓ, set ℓ to TRUE. For each variable that does not yet have a truth value, set it to TRUE. Claim 1: Both constructions are poly-time. Claim 2: Given an indep. set, we can construct a satisfying assignment for C1, . . . , Ck. Claim 3′: If C1, . . . , Ck has an satisfying assignment, then there is size g indep. set. (x ∨ y ∨ z)∧ (x ∨ y ∨ z)∧ (x ∨ y ∨ z)∧ (x ∨ y)

y y y x z x z x z x y

NP-Completeness (DPV Chapter 8) April 15, 2019 7 / 35

slide-16
SLIDE 16

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 8 / 35

slide-17
SLIDE 17

SAT 3SAT

Construction: SAT instance → 3SAT instance Translate each clause to sequence of clauses. (ℓ1 ∨ ℓ2 ∨ · · · ∨ ℓk) → (ℓ1 ∨ ℓ2 ∨ y1) ( y1 ∨ ℓ3 ∨ y2) · · · ( yk−3 ∨ ℓk−1 ∨ ℓk) where k > 3 and y1, . . . , yk−3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution → SAT solution

Take the truth assignment for the 3SAT formula & restrict it to the original vars.

NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

slide-18
SLIDE 18

SAT 3SAT

Construction: SAT instance → 3SAT instance Translate each clause to sequence of clauses. (ℓ1 ∨ ℓ2 ∨ · · · ∨ ℓk) → (ℓ1 ∨ ℓ2 ∨ y1) ( y1 ∨ ℓ3 ∨ y2) · · · ( yk−3 ∨ ℓk−1 ∨ ℓk) where k > 3 and y1, . . . , yk−3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution → SAT solution

Take the truth assignment for the 3SAT formula & restrict it to the original vars.

Claim 1: Both constructions are poly-time.

NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

slide-19
SLIDE 19

SAT 3SAT

Construction: SAT instance → 3SAT instance Translate each clause to sequence of clauses. (ℓ1 ∨ ℓ2 ∨ · · · ∨ ℓk) → (ℓ1 ∨ ℓ2 ∨ y1) ( y1 ∨ ℓ3 ∨ y2) · · · ( yk−3 ∨ ℓk−1 ∨ ℓk) where k > 3 and y1, . . . , yk−3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution → SAT solution

Take the truth assignment for the 3SAT formula & restrict it to the original vars.

Claim 1: Both constructions are poly-time. Claim 2: If the 3SAT formula has satisfying assignment, then restriction satisfies the SAT formula.

NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

slide-20
SLIDE 20

SAT 3SAT

Construction: SAT instance → 3SAT instance Translate each clause to sequence of clauses. (ℓ1 ∨ ℓ2 ∨ · · · ∨ ℓk) → (ℓ1 ∨ ℓ2 ∨ y1) ( y1 ∨ ℓ3 ∨ y2) · · · ( yk−3 ∨ ℓk−1 ∨ ℓk) where k > 3 and y1, . . . , yk−3 are new vars. Clauses with ≤ 3 literals translate to themselves. Construction: 3SAT solution → SAT solution

Take the truth assignment for the 3SAT formula & restrict it to the original vars.

Claim 1: Both constructions are poly-time. Claim 2: If the 3SAT formula has satisfying assignment, then restriction satisfies the SAT formula. Claim 3′: If the SAT formula is satisfiable, so is the 3SAT formula.

NP-Completeness (DPV Chapter 8) April 15, 2019 9 / 35

slide-21
SLIDE 21

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 10 / 35

slide-22
SLIDE 22

Independent-Set Vertex Cover

Definition

Suppose G = (V, E) is an undirected graph and S ⊆ V.

(a)

S is independent when for each u, v ∈ S, (u, v) / ∈ E.

(b)

S is a vertex cover when each edge of E has at least one endpoint in S.

− S

Independent Set Problem

Given: G and b. Find: An indep. set for G of size ≥ b.

Vertex Cover Problem

Given: G and b. Find: A vertex cover for G of size ≤ b. Reduction: f((V, E), b) = ((V, E), |V| − b). h(S) = V − S.

Claims

1.

Both constructions are poly-time.

2.

If U is a vertex cover for G with |U| ≤ |V| − b, then V − U is an indep. set with |V − U| ≥ b.

3.

If G has a indep. set of size ≥ b, then G has a vertex cover of size |V| − b.

NP-Completeness (DPV Chapter 8) April 15, 2019 11 / 35

slide-23
SLIDE 23

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 12 / 35

slide-24
SLIDE 24

Independent-Set Clique

Definition

Suppose G = (V, E) is an undirected graph and S ⊆ V.

(a)

S is independent when for each u, v ∈ S, (u, v) / ∈ E.

(b)

U is a clique when for each distinct u, v ∈ U, (u, v) ∈ E.

(c)

G = (V, E) where E = { (u, v) : (u, v) / ∈ E }.

Lemma

S is an independent set in G ⇐ ⇒ S is a clique in G.

Independent Set Problem

Given: G and b. Find: An indep. set for G of size ≥ b.

Clique Problem

Given: G and b. Find: A clique in G of size ≥ b. f( (V, E), b ) = ?? h(S) = ??

NP-Completeness (DPV Chapter 8) April 15, 2019 13 / 35

slide-25
SLIDE 25

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 14 / 35

slide-26
SLIDE 26

Recall: Three-dimensional matching

3D Matching

Given: R ⊆ A × B × C where |A| = |B| = |C| = n. Find: A subset M ⊆ R of n many triples such that if (a, b, c) and (a′, b′, c′) are distinct elements of M, then a = a′, b = b′, and c = c′. 2D matching is poly-time (via Ford-Fulkerson). The only known algorithms for 3D Matching are exponential time.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

R = {(Al, Alice, Armadilo), (Bob, Alice, Armadilo), (Bob, Carol, Bobcat), (Chet, Beatrice, Canary), (Chet, Carol, Bobcat) }

NP-Completeness (DPV Chapter 8) April 15, 2019 15 / 35

slide-27
SLIDE 27

3SAT 3D Matching, 1

3D Matching

Given: R ⊆ B × G × P with |B| = |G| = |P| = n. Find: A size-n subset M ⊆ R such that if (b, g, p) and (b′, g′, p′) are distinct elements of M, then b = b′, g = g′, and p = p′. Notes: B = boys, G = girls, P = pets. Exactly one of each Boy, Girl, Pet is chosen in the matching. Four triples: (b0, g1, p0), (b1, g0, p2), (b0, g0, p1), (b1, g1, p3) b0, b1, g0, g1 appear only in these triples. Any 3DM has to take either

◮ (b0, g1, p0), (b1, g0, p2)

can represent True

◮ (b0, g0, p1), (b1, g1, p3)

can represent False

For each variable (from the 3SAT instance) x, create a copy of this gadget where bx

0, bx 1 ∈ B, gx 0, gx 1 ∈ G, and

px

0, px 1 ∈ P

NP-Completeness (DPV Chapter 8) April 15, 2019 16 / 35

slide-28
SLIDE 28

3SAT 3D Matching, 2

Assumption: Preprocessing the 3SAT Instance

Without loss of generality, we assume no literal in the 3SAT instance has more than two

  • ccurrences.

(See the bottom of Page 251 in the text—at the end of the SAT 3SAT subsection.) For a clause c = (x ∨ y ∨ z) add bc ∈ B and gc ∈ G and add triples

◮ (bc, gc, px

1) (or else (bc, gc, px 3))

(if x is true, then px

1 and px 3 are available)

◮ (bc, gc, py

0) (or else (bc, gc, py 2))

(if y is false, then py

0 and py 2 are available)

◮ (bc, gc, pz

1) (or else (bc, gc, pz 3))

(if z is true, then pz

1 and pz 3 are available)

Similarly, for the other clauses. Make sure each literal in clause has has a different pi to match with bc and gc. (Here is where the above assumption comes in.) Clean-up: Suppose the 3SAT instance has n variables and m clauses. For j = 1, . . . , 2n − m, add b∗

i ∈ B, g∗ i ∈ G and the set of triples

{ (b∗

i , g∗ i , pv j ) : v ∈ V, j = 0, . . . , 3 }. I.e., b∗ i and g∗ i like any P.

NP-Completeness (DPV Chapter 8) April 15, 2019 17 / 35

slide-29
SLIDE 29

3SAT 3D Matching, 3

Claim

The construction is poly-time. If the instance of 3SAT is satisfiable, then there is a 3D matching in the set of triples constructed. If there is a 3D matching in the set of triples constructed, then the instance of 3SAT is satisfiable.

NP-Completeness (DPV Chapter 8) April 15, 2019 18 / 35

slide-30
SLIDE 30

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 19 / 35

slide-31
SLIDE 31

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-32
SLIDE 32

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-33
SLIDE 33

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-34
SLIDE 34

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-35
SLIDE 35

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used. (Ai,j) is 3m × n

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-36
SLIDE 36

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used. (Ai,j) is 3m × n Ai,j = 1 ⇐ ⇒ the j-th elm. of U is used in the i-th triple.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-37
SLIDE 37

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used. (Ai,j) is 3m × n Ai,j = 1 ⇐ ⇒ the j-th elm. of U is used in the i-th triple. Am+i,j = 1 ⇐ ⇒ the i-th elm. of V is used in the j-th triple.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-38
SLIDE 38

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used. (Ai,j) is 3m × n Ai,j = 1 ⇐ ⇒ the j-th elm. of U is used in the i-th triple. Am+i,j = 1 ⇐ ⇒ the i-th elm. of V is used in the j-th triple. A2m+i,j = 1 ⇐ ⇒ the i-th elm. of W is used in the j-th triple.

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-39
SLIDE 39

3D Matching ZOE, 1

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = m. Find: A size-m subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction Suppose n = |R|. xj variable for the j-th triple. xj = 1 ⇐ ⇒ j-th triple is used. (Ai,j) is 3m × n Ai,j = 1 ⇐ ⇒ the j-th elm. of U is used in the i-th triple. Am+i,j = 1 ⇐ ⇒ the i-th elm. of V is used in the j-th triple. A2m+i,j = 1 ⇐ ⇒ the i-th elm. of W is used in the j-th triple. So A

  • x =

1 means . . .

NP-Completeness (DPV Chapter 8) April 15, 2019 20 / 35

slide-40
SLIDE 40

3D Matching ZOE, 2

3D Matching

Given: R ⊆ U × V × W with |U| = |V| = |W| = n. Find: A size-n subset M ⊆ R such that if (u, v, w) and (u′, v′, w′) are distinct elements

  • f M, then u = u′, v = v′, and w = w′.

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vector of 0’s and 1’s such that A

  • x =

1.

Armadillo Bobcat Carol Beatrice Alice Chet Bob Al Canary

A =               1 1 1 1 1 1 1 1 1 1 1 1 1 1 1              

Construction: Example R = { t1, . . . , t5 } where t1 = (Al,Alice,Armadilo) t2 = (Chet,Beatrice,Canary) t3 = (Chet,Carol,Bobcat) t4 = (Bob,Carol,Bobcat) t5 = (Bob,Alice,Armadilo)

t1 t2 t3 t4 t5 Al 1 Bob 1 1 Chet 1 1 Alice 1 1 Beatrice 1 Carol 1 1 Armadilo 1 1 Bobcat 1 1 Canary 1 A × (1, 1, 1, 0, 0) = (1, 0, 2, 1, 1, 1, 1, 1, 1) A × (1, 1, 0, 1, 0) = (1, 1, 1, 1, 1, 1, 1, 1, 1)

NP-Completeness (DPV Chapter 8) April 15, 2019 21 / 35

slide-41
SLIDE 41

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 22 / 35

slide-42
SLIDE 42

ZOE Subset Sum

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vec. of 0’s and 1’s ∋ A

  • x =

1.

Subset Sum

Given: A multiset M and goal G, all ints. Find: An M′ ⊆ M such that G = ∑x∈M′ x.

A Sample Reduction A =       1 1 1 1 1 1      

  • M = { 100105, 001015, 001005, 010005 }

G = 111115 111115 = 1 ∗ 54 + 1 ∗ 53 + 1 ∗ 52 + 1 ∗ 51 + 1 ∗ 50, etc.

NP-Completeness (DPV Chapter 8) April 15, 2019 23 / 35

slide-43
SLIDE 43

ZOE ILP

Zero-One Equations (ZOE)

Given: A, an m × n matrix of 0’s and 1’s Find: x, a n-vec. of 0’s and 1’s ∋ A

  • x =

1.

  • Int. Linear Programming (ILP)

Given: constraints A

  • x ≤

b Find: A vector of integers x ∋ A

  • x ≤

b.

Reduction: Each ZOE equation: a · x = 1 is rewritten to two inequalities: a · x ≤ 1 and −

  • a ·

x ≤ −1 Each ZOE variable xi gets two additional constraints: xi ≤ 1 and −xi ≤ 0.

NP-Completeness (DPV Chapter 8) April 15, 2019 24 / 35

slide-44
SLIDE 44

ZOE Rudrata Cycle

See the text for this one. It’s proof is epic.

NP-Completeness (DPV Chapter 8) April 15, 2019 25 / 35

slide-45
SLIDE 45

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 26 / 35

slide-46
SLIDE 46

Rudrata/Hamiltonian Cycle TSP

Rudrata/Hamiltonian Cycle Problem

Given: G = (V, E), an undirected graph. Find: A simple cycle that visits each vertex of G.

Traveling Salesman Problem (TSP)

Given: V′, n vertices; all n·(n−1)

2

  • many distances between them; and b, a budget

Find: π, an ordering of 1, . . . , n, such that ∑n

i=1 dπ(i),π(1+(i mod n)) ≤ b

Construction Pick α ≥ 1. Given (V, E), define V′ = V di,j =

  • 1,

if (i, j) ∈ E; 1 + α,

  • therwise.

b = |V| Claim: (V, E) has a R/H cycle ⇐ ⇒ (V′, d) has tour of cost ≤ b. Note: If α = 1: Distances satisfy the triangle inequality: dij + djk ≥ dik. These instance of TSP are approximatable (Chap. 9). Note: If α ≫ 1: Gap: either a solution of cost b,

  • r solutions with costs ≥ b + α, but none in-between.

NP-Completeness (DPV Chapter 8) April 15, 2019 27 / 35

slide-47
SLIDE 47

The Plan of §8.3

3D MATCHING RUDRATA CYCLE SUBSET SUM TSP ILP ZOE All of NP SAT 3SAT VERTEX COVER INDEPENDENT SET CLIQUE

NP-Completeness (DPV Chapter 8) April 15, 2019 28 / 35

slide-48
SLIDE 48

All of NP Circuit SAT, 1

Circuit SAT

Given: A Boolean circuit, a dag with five types of gates

1.

AND gates and OR gates (indegree 2)

2.

NOT gates (indegree 1)

3.

Known input gates (indegree 0) labeled True or False.

4.

Unknown inputs gates (indgree 0) labeled “?”.

5.

An output gate (a particular sink) Find: A truth assignment to the unknown input gates so that the circuit evaluates to True.

true AND NOT AND OR OR ? ?

  • utput

? AND

An instance of Circuit SAT

NP-Completeness (DPV Chapter 8) April 15, 2019 29 / 35

slide-49
SLIDE 49

All of NP Circuit SAT, 2

Circuit SAT

Given: A Boolean circuit, a dag with five types of gates

1.

AND gates and OR gates (indegree 2)

2.

NOT gates (indegree 1)

3.

Known input gates (indegree 0) labeled True or False.

4.

Unknown inputs gates (indgree 0) labeled “?”.

5.

An output gate (a particular sink) Find: A truth assignment to the unknown input gates so that the circuit evaluates to True.

Claim 1

SAT Circuit SAT

Proof sketch: Given an instance of SAT, just translate it to the corresponding instance of Circuit SAT. Example, translate: (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y ∨ z) ∧ (x ∨ y)

NP-Completeness (DPV Chapter 8) April 15, 2019 30 / 35

slide-50
SLIDE 50

All of NP Circuit SAT, 3

Circuit SAT

Given: A Boolean circuit, a dag with five types of gates

1.

AND gates and OR gates (indegree 2)

2.

NOT gates (indegree 1)

3.

Known input gates (indegree 0) labeled True or False.

4.

Unknown inputs gates (indgree 0) labeled “?”.

5.

An output gate (a particular sink) Find: A truth assignment to the unknown input gates so that the circuit evaluates to True.

Claim 2

Circuit SAT SAT

Proof sketch: Given an instance of Circuit SAT, translate it to an instance of Circuit SAT as follows.

1

Assign each gate a unique variable.

2

For each gate g, build the following set

  • f clauses

Case: g = ? . Translates to: { (g) }. Case: g = true . Translates to: { (g) }. Case: g = false . Translates to: { (g) }.

Continued . . .

NP-Completeness (DPV Chapter 8) April 15, 2019 31 / 35

slide-51
SLIDE 51

All of NP Circuit SAT, 4 [Draw the pictures]

Case: g = a NOT-gate with input h. Translates to: { (g ∨ h), (g ∨ h) }. Case: g = an OR-gate with inputs h1 and h2. Translates to: { (g ∨ h1), (g ∨ h2), (g ∨ h1 ∨ h2) }. Case: g = an AND-gate with inputs h1 and h2. Translates to: { (g ∨ h1), (g ∨ h2), (g ∨ h1 ∨ h2) }. Moreover: If g is the output gate, we add the clause: (g). What is going on?

NP-Completeness (DPV Chapter 8) April 15, 2019 32 / 35

slide-52
SLIDE 52

All of NP Circuit SAT, 5

Circuit SAT

Given: A Boolean circuit, a dag with five types of gates

1.

AND gates and OR gates (indegree 2)

2.

NOT gates (indegree 1)

3.

Known input gates (indegree 0) labeled True or False.

4.

Unknown inputs gates (indgree 0) labeled “?”.

5.

An output gate (a particular sink) Find: A truth assignment to the unknown input gates so that the circuit evaluates to True.

Recall from Chapter 7: Any polytime algorithm can be expressed as a boolean circuit (scaled to the input size). Dirty trick warning!!!

NP-Completeness (DPV Chapter 8) April 15, 2019 33 / 35

slide-53
SLIDE 53

All of NP Circuit SAT, 6

Circuit SAT

Given: A Boolean circuit, a dag with five types of gates

1.

AND gates and OR gates (indegree 2)

2.

NOT gates (indegree 1)

3.

Known input gates (indegree 0) labeled True or False.

4.

Unknown inputs gates (indgree 0) labeled “?”.

5.

An output gate (a particular sink) Find: A truth assignment to the unknown input gates so that the circuit evaluates to True.

Given an NP-problem Q with polytime checking function C. For instance I, build the boolean circuit B that checks I, with “?” labeling the “solution input gates.” Then I has a Q-solution ⇐ ⇒ B has a satisfying assignment.

∴ . . .

NP-Completeness (DPV Chapter 8) April 15, 2019 34 / 35

slide-54
SLIDE 54

All of NP Circuit SAT, 7

Theorem (The Cook-Levin Theorem)

SAT is NP-complete. Next: Dealing with NP-completeness

NP-Completeness (DPV Chapter 8) April 15, 2019 35 / 35