1 np-completeness objectives: at the end of the lesson, students should be able to: 1. differentiate...
Post on 20-Dec-2015
216 views
TRANSCRIPT
![Page 1: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/1.jpg)
1
NP-Completeness
Objectives:At the end of the lesson, students should be
able to:1. Differentiate between class P, NP, and NPC2. Reduce a known NPC problem into another
NPC problem3. Show a given problem is in NPC4. Solve a problem using an approximate
solution.
![Page 2: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/2.jpg)
2
Content
Informal introduction
- the classes P, NP and NP-complete
- the graph colouring polynomial reductions Approximation algorithms
- travelling salesman problem
![Page 3: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/3.jpg)
3
![Page 4: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/4.jpg)
4
![Page 5: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/5.jpg)
5
![Page 6: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/6.jpg)
6
Tractable vs intractableProblems that can be solved in poly time are called tractable
![Page 7: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/7.jpg)
7
Undecidable Problem
Decidable (P or NP) Undecidable problem – e.g Halting Problem
Given a computer program and input to it, determine whether the program will halt on that input or continue working indefinitely on it.
![Page 8: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/8.jpg)
8
A Problem in NPC
How to show that a problem is in NPC?
Prove that no efficient algorithm is likely to exist.
Three key concepts for showing whether a problem is in NPC
1.Decision problems vs optimisation problems
2.Polynomial reductions
3.An initial NPC-problem
![Page 9: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/9.jpg)
9
![Page 10: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/10.jpg)
10
![Page 11: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/11.jpg)
11
![Page 12: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/12.jpg)
12
![Page 13: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/13.jpg)
13
![Page 14: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/14.jpg)
14
![Page 15: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/15.jpg)
15
Graph colouring
This algorithm finds a k-colouring of G=(V,E), if there is one, and stores it in the array c.
Graph-colouring(G,k) { For each v in V c[v] = guess({1,2,…,k}) For each v in V For each w in N(v) if (c[w] ==c[v] return false return true}
![Page 16: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/16.jpg)
16
![Page 17: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/17.jpg)
17
Other complexity classes
There are many complexity classes that are much harder than NP.
PSPACE. Problems that can be solved using a reasonable amount of memory without regard to how much time the solution takes.
EXPTIME. Problems that can be solved in exponential time.
Undecidable. For some problems, we can prove that there is no algorithm that always solves them, no matter how much time or space is allowed.
![Page 18: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/18.jpg)
18
![Page 19: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/19.jpg)
19
![Page 20: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/20.jpg)
20
![Page 21: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/21.jpg)
21
![Page 22: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/22.jpg)
22
![Page 23: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/23.jpg)
23
Some NP-complete problems
Does a given undirected graph have a Hamiltonian cycle?
Traveling salesman problem (TSP) Graph coloring
![Page 24: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/24.jpg)
24
![Page 25: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/25.jpg)
25
![Page 26: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/26.jpg)
26
TSP is in NP
Given an instance to the TSP problem, use as “proposed solution” the sequence of n vertices in the tour e.g. ACDBA, ACDA.
Check that this sequence contains every vertex exactly once. ACDBA is yes, ACDA is no.
Sum up the edge costs and check whether this is at most k. Total cost for ACDBA = 35+12+10+20 = 77.
This can all be done in polynomial-time, ths TSP ε NP.
![Page 27: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/27.jpg)
27
Complete Graphs there is an edge “between” every possible
tuple of vertices. |e| = C(n,2) = n. (n-1)/2
![Page 28: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/28.jpg)
28
![Page 29: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/29.jpg)
29
Reduction of HC to TSP
G has a Hamiltonian cycle ↔ G’ has a tour of
cost at most 0
Suppose G has a Hamiltonian
cycle h. Then each edge in h
has cost 0 in G’.
Thus h is a tour of cost 0 in G’.
Suppose G’ has a tour h’ of cost at
most 0. As all edges in G’ have
cost 0 or 1, cost(h’) = 0, hence all edges in h’
have cost 0. Therefore, h’ is a hamiltonian cycle of G.
![Page 30: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/30.jpg)
30
![Page 31: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/31.jpg)
31
![Page 32: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/32.jpg)
32
TSP
![Page 33: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/33.jpg)
33
![Page 34: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/34.jpg)
34
![Page 35: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/35.jpg)
35
![Page 36: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/36.jpg)
36
![Page 37: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/37.jpg)
37
![Page 38: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/38.jpg)
38
Question
?????
![Page 39: 1 NP-Completeness Objectives: At the end of the lesson, students should be able to: 1. Differentiate between class P, NP, and NPC 2. Reduce a known NPC](https://reader030.vdocument.in/reader030/viewer/2022032704/56649d435503460f94a1fe92/html5/thumbnails/39.jpg)
39
Summary
1. Problems fall into class P, NP, and NPC.
2. Reduction of a known NPC problem into another NPC problem (Hcycle ≤p TSP)
3. Shown a given problem is in NPC (TSP)
4. Solved a problem using an approximate solution.
Last updated: 2/11/2010.