cse 421 algorithms richard anderson lecture 29 complexity theory np-complete p

19
CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP- Complete P

Upload: mark-fisher

Post on 19-Jan-2018

216 views

Category:

Documents


0 download

DESCRIPTION

NP Complete Problems 1.Circuit Satisfiability 2.Formula Satisfiability a.3-SAT 3.Graph Problems a.Independent Set b.Vertex Cover c.Clique 4.Path Problems a.Hamiltonian cycle b.Hamiltonian path 5.Partition Problems a.Three dimensional matching b.Exact cover 6.Graph Coloring 7.Number problems a.Subset sum 8.Integer linear programming 9.Scheduling with release times and deadlines

TRANSCRIPT

Page 1: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

CSE 421Algorithms

Richard AndersonLecture 29

Complexity Theory

NP-Complete

P

Page 2: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Announcements

• Final exam, – Monday, December 14, 2:30-4:20 pm– Comprehensive (2/3 post midterm, 1/3 pre

midterm)• Review session

– Friday, 3:30 – 5:00 pm. More 220• Online course evaluations available

Page 3: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

NP Complete Problems

1. Circuit Satisfiability2. Formula Satisfiability

a. 3-SAT3. Graph Problems

a. Independent Setb. Vertex Coverc. Clique

4. Path Problemsa. Hamiltonian cycleb. Hamiltonian path

5. Partition Problemsa. Three dimensional

matchingb. Exact cover

6. Graph Coloring7. Number problems

a. Subset sum8. Integer linear

programming9. Scheduling with release

times and deadlines

Page 4: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Karp’s 21 NP Complete Problems

Page 5: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

A final NP completeness result: Graph Coloring

• NP-Complete– Graph K-coloring– Graph 3-coloring

• Polynomial– Graph 2-Coloring

Page 6: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Z

3-SAT <P 3 Colorability

Y

T F

B

X Y

Z

X

Truth Setting Gadget Clause Testing Gadget

X T Z F

Y

Page 7: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

What we don’t know

• P vs. NP

NP-Complete

P

P = NP

Page 8: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

If P != NP, is there anything in between

• Yes, Ladner [1975]• Problems not known to be in P or NP Complete

– Factorization– Discrete Log– Graph Isomorphism Solve gk = b over a finite group

Page 9: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Coping with NP Completeness

• Approximation Algorithms– Christofides algorithm for TSP (Undirected

graphs satisfying triangle inequality)• Solution guarantees on greedy algorithms

– Bin packing

Page 10: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Coping with NP-Completeness

• Branch and Bound– Euclidean TSP

Page 11: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Coping with NP-Completeness

• Local Search– Modify solution until a local minimum is

reached• Interchange algorithm for TSP• Recoloring algorithms

– Simulated annealing

Page 12: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Complexity Theory

• Computational requirements to recognize languages

• Models of Computation• Resources• Hierarchies

Regular Languages

Context Free Languages

Decidable Languages

All Languages

Page 13: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Time complexity

• P: (Deterministic) Polynomial Time• NP: Non-deterministic Polynomial Time• EXP: Exponential Time

Page 14: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Space Complexity

• Amount of Space (Exclusive of Input) • L: Logspace, problems that can be solved

in O(log n) space for input of size n

• PSPACE, problems that can be required in a polynomial amount of space

Page 16: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

NP vs. Co-NP

• Given a Boolean formula, is it true for some choice of inputs

• Given a Boolean formula, is it true for all choices of inputs

Page 17: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Problems beyond NP

• Exact TSP, Given a graph with edge lengths and an integer K, does the minimum tour have length K

• Minimum circuit, Given a circuit C, is it true that there is no smaller circuit that computes the same function a C

Page 18: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Polynomial Hierarchy

• Level 1– X1 (X1), X1 (X1)

• Level 2– X1X2 (X1,X2), X1X2 (X1,X2)

• Level 3– X1X2X3 (X1,X2,X3), X1X2X3 (X1,X2,X3)

Page 19: CSE 421 Algorithms Richard Anderson Lecture 29 Complexity Theory NP-Complete P

Polynomial Space

• Quantified Boolean Expressions– X1X2X3...Xn-1Xn (X1,X2,X3…Xn-1Xn)

• Space bounded games– Competitive Facility Location Problem

• Counting problems– The number of Hamiltonian Circuits in a graph