Beruflich Dokumente
Kultur Dokumente
11/7/2012
NP-Complete Problems - I
Exponential Growth
colonies of bacteria, cells in a fetus, transistor density in chips, the computer speed (Moores Law)
11/7/2012
Moores Law
Looks like providing a disincentive for developing polynomial algorithms ?
if an algorithm is exponential, why not wait it out until Moore's law makes it feasible NOT Really!!!
Claim:
Moores Law
Claim: a huge incentive for developing polynomial algorithms Why?
Boolean Satisfiability (SAT) complexity is O(2n) Sorting complexity is O(n logn)
Year 1975 1985 1995 2005 Variables (SAT) 25 31 38 45 Sorting 100 100 100 100
11/7/2012
The progress will depend on algorithmic ingenuity, or some other new idea
Problem Solving
Shortest paths, MSTs, LCS, MCM, and many others
We know that we can solve them efficiently, though we are searching for a solution (path, tree, matching, etc.) from among an exponential population of possibilities
11/7/2012
So far So Good!
Algorithmic techniques that defeat the specter of exponentiality:
Greedy algorithms, Dynamic programming, Divide and conquer, Linear Programming
Now, the time has come to meet the quest's most embarrassing and persistent failures
For some other search problems, the fastest algorithms we know for them are all exponential
Difficult Problems
If a problem has an O(nk) time algorithm (where n being the input size and k is a constant), then we class it as having polynomial time complexity and as being efficiently solvable If there is no known polynomial time algorithm, then the problem is classed as intractable, or difficult, or Hard Problem.
11/7/2012
11/7/2012
Eulerian Tour
Euler showed that an Eulerian Tour existed iff
1. it is possible to go from any vertex to any other by following the edges (the graph must be connected), and 2. every vertex must have an even number of edges connected to it, with at most two exceptions (which constitute the starting and ending points).
11/7/2012
11/7/2012
Class P and NP
Euler's problem lies in the class P: problems solvable in Polynomial time Hamilton's problem is believed to lie in class NP (Non-deterministic Polynomial)
11/7/2012
Class P and NP
What is a Search Problem?
any proposed solution can be quickly checked for correctness (in Polynomial Time) A search problem is specified by an algorithm C that takes two inputs, an instance I and a proposed solution S, and runs in time polynomial in (I), i.e. We say S is a solution to I if and only if C (I, S) = true
All search problems are NP The class of all search problems that can be solved in polynomial time is denoted P
However, NO PROOF!
11/7/2012
NP Complete Problems
If P NP then we know that P is GOOD! What about the problems on the left side of the table?
all, in some sense, exactly the same problem we show that these problems are the hardest search problems in NP, so that if even one of them has a polynomial time algorithm, then every problem in NP has a polynomial time algorithm
10
11/7/2012
NP-Complete Problems
There is a special class of problems in NP: the NP-complete problems. All the problems in NP are efficiently reducible to them. By efficiently, we mean in polynomial time, so the term polynomially reducible provides a more precise definition
Reduction
11
11/7/2012
Reduction
A B (A is Polynomial Time Reducible to B)
Efficient Problems: If B is efficient then C is also efficient Hard Search Problems (NP Complete): If A is hard then B is also hard
So if A is NP-complete,
a new search problem B is also NP-complete, simply by reducing A to B This is how the set of NP-Complete problems has grown since then
12
11/7/2012
Satisfiability (SAT)
A Problem of great importance
chip testing computer design image analysis software engineering, and others
Satisfiability
An Example
a collection of clauses, each consisting of the disjunction of several literals, a literal is either a Boolean variable (such as x) or the negation of one
13
11/7/2012
Satisfiability
Interestingly
1-SAT and 2-SAT are in P 3-SAT is NP-Complete A generalized SAT can be reduced to 3-SAT
14
11/7/2012
TSP
A DP Solution
Sub-Problems? let C (S, j) be the length of the shortest path visiting each node in S exactly once, starting at 1 and ending at j For |S| > 1, we define
Time Complexity?
15
11/7/2012
Reductions Again
RUDRATA (s, t) PATH RUDRATA CYCLE ? RUDRATA CYCLE problem: given a graph, is there a cycle that passes through each vertex exactly once? RUDRATA (s, t)- PATH problem: given a graph with two vertices s and t, and we want a path starting at s and ending at t that goes through each vertex exactly once
RUDRATA PATH
RUDRATA CYCLE
16
11/7/2012
RUDRATA PATH
RUDRATA CYCLE
More on NP-Completeness
See the next lecture
17
11/7/2012
Summary
Polynomial Time Complexity Problems which have solutions with time complexity O(nk) where k is a constant are said to have polynomial time complexity. Class P Set of problems which have solutions with polynomial time complexity. Non-deterministic Polynomial (NP) A problem which can be solved by a series of guessing (non-deterministic) steps but whose solution can be verified as correct in polynomial time is said to lie in class NP. Eulerian Path Path which traverses each arc of a graph exactly once A P-time problem Hamiltonian Path Path which passes through each node of a graph exactly once An NP-Complete problem NP-Complete Problems Set of problems which are all related to each other in the sense that if any one of them can be shown to be in class P, all the others are also in class P.
References
Chapter 8, Algorithms by S. Dasgupta, C.H. Papadimitriou, and U.V. Vazirani
18