lecture_16

# lecture_16 - NP-completenessMost recognized theoretical...

This preview shows pages 1–7. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: NP-completenessMost recognized theoretical aspect of CS 1Methodology for showing some hard problems can’t be solved efficiently.Reading: Dasgupta et al. Chapter 8Cormen et al’s book (not recommeded)No efficient algorithmsA simple search problem without efficient algorithms.• The Subset Sum Problem: Given a set A of n integers, find a partition of A into two subsets with equal sum. • Example 1: A = {3, 4, 5, 6}; Candidate solutions: {3,4} [A – {3,4}]; {3,5}; {3,6}; {3}; {3,4,6}; …Solution: {3,6} [A – {3,6} = {4,5} ]2• Example 2: A = { 2, 3, 6 }; Candidate solutions: {2}, {2,3}, {2,6}, {3,6}No solution.• Brute force algorithm: for every subset (candidate solution) S of A, check whether sum of B = sum of A – sum of B. Exponential time ! Note that A has 2ndifferent subsets.Polynomial time versus exponential time3• Processor speed: a million high-level instructions per second. • Very long = exceeds 1025years• Increase processor speed 1000 times, would it help? No.• When n = 100, 2n= 270seconds &gt;&gt; billions of yearsFrustrationFrustrationFrustrationFrustrationDifficult search problems exist everywhere, inlcuidng areas like database, scheduling, compilers, AI, operating research, biology, financial engineering, etc.• Traveling salesman problem: Given n cities and the cost of traveling from one city to another city, find a tourto visit every city within a given budget b.•Longest path: Given a weighted directed graph, find a “simple” path from s 4to t with total weight exceeding a given threshold.• Three dimensional matching: find a perfect matchingfor a tripartite graph.• Multiprocessor scheduling …• Consistency of database frequency tables …Typical characteristics: checking a candidate solution is easy; but there are just too many (exponential) candidate solutions.Brute force solution doesn’t work.NPNPNPNP-completenesscompletenesscompletenesscompletenessWhy don’t these problems have polynomial time algorithms? HKU’s professors &amp; student are too dumb !? Perhaps somebody else might be able to solve these problems. Not really. The theory of NP-completeness tells us that many such search problems are indeed inherently difficultand it 5is unlikely somebody (including those Turing Award winners) can solve them.What does it mean? When you can’t solve a problem efficiently, try to “prove” that it is NP-complete. Then you can convince everybody that you are not dumb.Search problems and NP Search problems and NP Search problems and NP Search problems and NP Dasgupta et al’s: An NP search problemis considered to have the x√x√xxxxChecking a solution takes polynomial time.A search problem: find a√• Complexity perspective• Algorithm perspective6following characteristics:• An instance I of X defines a set of candidate solutions, some of them are “real” solutions; the objective is to find one solution, or to report “no” if none exists....
View Full Document

## This note was uploaded on 03/01/2010 for the course CS 1234 taught by Professor Chan during the Spring '10 term at University of the Bío-Bío.

### Page1 / 25

lecture_16 - NP-completenessMost recognized theoretical...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online