Introduction to NP-Completeness

1 / 12

# Introduction to NP-Completeness - PowerPoint PPT Presentation

Introduction to NP-Completeness. Tahir Azim. The Downside of Computers. Many problems can be solved in linear time or polynomial time But there are also problems that can’t be solved so easily… Moral: know thy problem!. P vs NP. P = Problems that can be solved in polynomial time

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## Introduction to NP-Completeness

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Introduction to NP-Completeness

Tahir Azim

The Downside of Computers
• Many problems can be solved in linear time or polynomial time
• But there are also problems that can’t be solved so easily…
• Moral: know thy problem!
P vs NP
• P = Problems that can be solved in polynomial time
• NP = Problems for which you can test the correctness of a solution in polynomial time
• Example?
• Solutions in P are also in NP
• But not necessarily vice versa
• Undecidable Problems: Cannot be solved by a computer.

Picture Courtesy: Wikipedia

Examples of hard problems
• Long simple paths: Given a graph G, vertices s and t, and a number k, does there exist a path from s to t with at least k edges and no cycles?
• In NP. Why?
• In P? No!
• RSA: In NP, but not in P!
• Chess-Playing: In NP, but not in P!
• Halting Problem

yes if Q(Q) halts

no otherwise

run forever if Q(Q) halts

halt if Q(Q) runs forever

Unsolvability of the halting problem
• Suppose P solves variant of halting problem
• On input Q, assume

P(Q) =

• Build program D
• D(Q) =
• Does this make sense? What can D(D) do?
• If D(D) halts, then D(D) runs forever.
• If D(D) runs forever, then D(D) halts.
• CONTRADICTION: program P must not exist.
How to solve such problems?
• Heuristics
• Approximation
• Use the exponential time solution anyway
• Add more assumptions to simplify it
Is P=NP?
• If it's always easy to check a solution, should it also be easy to find the solution?
• Most famous open problem in theoretical CS
• Most expect it to be false, but there is no proof
NP-Complete Problems (NPC)
• The hardest of all problems in NP
• NP-hard: A problem that is at least as hard as any problem in NP
• Does not necessarily have to be in NP, e.g. the Halting Problem
• A problem is said to be NP-complete if it is
• (i) in NP
• and (ii), it is NP-hard
How to prove if a problem Y is NP-hard
• By showing that an instance X of an NP-hard problem can be reduced to Y in polynomial time
• Informally, a problem A is reducible to B if A can be solved by using B as a sub-routine
• i.e. if B returns “yes”, then A also returns yes.
• The idea is the following:
• If Y was not NP-hard, then X could be solved “easily” by using Y
• Therefore, X would no longer be a hard problem
• X is NP-hard
• Therefore, Y is NP-hard.
More common method (slightly different)
• Generally, a slightly different approach is used
• A problem Y is said to be NP-complete if it is
• (i) in NP
• and, (ii) an instance of an NP-complete problem can be reduced to Y in polynomial time
• Notation: X <p Y, Ǝ X Ɛ NPC
• Where did the first NP-complete problem come from?
• Stephen Cook (1971) showed that SAT is an NP-complete problem from first principles