Download presentation
Presentation is loading. Please wait.
1
8.2: Strong NP-Completeness
By: Mandeep Kaur
2
Motivation No NP-complete problem is known to be solvable by a polynomial time algorithm. If we had a polynomial time algorithm for one of the NP-complete problems, we could obtain polynomial time algorithms for all the NP-complete problems. The NP-complete problems are considered computationally “intractable”. Certain NP-complete problems like Partition, knapsack and some scheduling problems can be solved by the dynamic programming algorithm. New class-Strongly NP-complete: cannot be solved at all for any instance.
3
Review: P and NP Summary
P= set of problems that can be solved in polynomial time. » Examples: Greatest common divisor, … NP= set of problems for which a solution can be verified in polynomial time or solvable in polynomial time on a non-deterministic Turing machine. » Examples: Knapsack,.., Hamiltonian Cycle, TSP,.., Clearly P ⊆ NP Open question: Does P = NP? » most suspect not
4
Review: NP-Hard NP – Hard NP – Hard NP
NP-hard is a class of problems informally "at least as hard as the hardest problems in NP”. OR A problem H is NP-hard if and only if there is an NP-Complete problem L that is polynomial-time reducible to H, i.e L ≤p H NP-Complete NP-hard P≠ NP P = NP NP – Hard NP – Hard NP Complete NP P = NP = NP-Complete P
5
NP-Complete A decision problem is NP-complete if it is complete for NP, meaning that: -it is in NP and -it is NP-hard, i.e. every other problem in NP is reducible to it. Cook’s theorem (1971): (Theo. 6.6) Satisfiability is NP-complete Any of a class of computational problems for which no efficient solution algorithm has been found. e.g., the traveling salesman problem, satisfiability problems, HC, and graph-covering problems. NP-complete problems are described as “hardest” problems in NP ("non-deterministic polynomial time")
6
Partition Problem Partition Problem:
Input: Finite set X=(x1, x2, …, xn} and a size s(x) (integer) for each xX. Question: Is there a subset X’X such that x X’ s(x) = x X –X’ s(x)? This problem can be solved by using dynamic programming: f(0,0) = 1 f(0,j) = 0 for j ≠ 0 f(i, M) = max ( f(i-1, M), f(i-1, M-s(xi) ) f(i,M)=true if and only if f(i-1,M)=true or f(i-1, M-s(xi))=true. i.e. for in and M N x X s(x) , define f(i, M) to be true if and only if there is a subset Xi of {x1, x2, …, xi} such that x Xi s(x) = M.
7
Partition Problem(cont.)
Algorithm Running time depend on the representation of s(x): Binary encoding for s(x): - Input size: O(n log N) - Algorithm runs in time: O(n.N2) (exponential in Input size) Unary Encoding for s(x): -Input size: O(n.N) -Algorithm run in quadratic time. -Algorithm O(n.N) for Partition is not polynomial-time algorithm but Pseudo-polynomial time algorithm. Change in behavior between unary and binary notation is not characteristic of all NP-complete problem. Example: Maximum cut problem (NP-complete) - remains NP-complete when coded in unary. - doesn’t exist a pseudo-polynomial time algorithm.
8
Polynomial Vs. Pseudo-polynomial
A pseudo-polynomial-time algorithm is one that runs in time polynomial in the dimension of the problem and the magnitudes of the data involved (provided these are given as integers). Or runs in time polynomial in the length of the input if input is encoded in unary. Example: Knapsack problem can be solved by a dynamic programming algorithm requiring a number of steps polynomial in the size of the knapsack and the number of items. A strongly polynomial-time algorithm is one whose running time is bounded polynomially by a function only of the inherent dimensions of the problem and independent of the sizes of the numerical data. Example: Most Sorting algorithms - Require a number of comparisons polynomial in the number of entries. -do not depend on the actual values being sorted.
9
Pseudo-polynomial time algorithm (cont.)
A pseudo-polynomial-time algorithm will display 'exponential behavior' only when confronted with instances containing 'exponentially large' numbers. A pseudo-polynomial algorithm is an algorithm which is fast if all numbers in the input are small. For instance I: len(I): length of Binary encoding max(I): length of Unary encoding Unary encoding are always at least as long as binary encodings, any polynomial-time algorithm is also a pseudo-polynomial time algorithm. A pseudo-polynomial time algorithm is an algorithm that runs in time bounded by a polynomial in the two variables len(l) and max(I).
10
Pseudo-polynomial time algorithm (cont.)
Under assumption P ≠ NP No NP-complete problem can be solved by a polynomial-time algorithm. Partition can be solved by a pseudo-polynomial time algorithm. -is tractable when restricted to instances with (polynomially) small element values. -Require presence of large numbers in description of its instances to be NP-complete. Examples: Subset Sum, Knapsack, Bin packing into two Bins and some scheduling problems.
11
Strongly NP-complete Def.- An NP-complete problem is strongly NP-complete if it cannot be solved in pseudo-polynomial time unless P equals NP. or Those problems that remain NP-complete even if the data are encoded in unary (that is, if the data are “small” relative to the overall input size). Problems where max(I) is not bounded by a polynomial in len(I) Example: Satisfiability, Vertex cover, Graph three color ability, Hamiltonian circuit, TSP, ……
12
Strongly NP-complete(cont.)
All those problems that remain complete when their “numbers” are restricted in small range, i.e. can be encoded reasonably in unary. Example: Transformation between HC and TSP produced instances of TSP where all distances equal 1 or 2 and where bound equals the number of cities. This Restricted version of TSP is NP-complete and it does not include large numbers in its description(can be encoded in unary). So TSP, is a Strongly NP complete problem.
13
Proposition 8.2 A problem ∏ є NP is strongly NP-complete if and only if there exist some polynomial p() such that the restriction of ∏ to those instances with max(I) ≤ p(len(I)) is itself NP-complete. unary encoding binary encoding In other words, if the set of instances containing only “small” numbers is itself NP-complete, then the problem is strongly-NP complete. By constructing a transformation that produces only small numbers, we can show that a problem is strongly NP-complete. Example: k-clustering, Steiner tree in graphs and various versions of spanning tree problems are strongly NP-complete.
14
K-Partition K-partition is strongly NP-complete problem. For k ≥ 3
Input: a set of kn elements, each with a positive integer size; sum of all sizes = Bn (multiple of n) and size s(x) of each element obeys the inequality B/k+1 < s(x) < B/(k-1) Question: Can partition the set into n subsets such that the sum of the sizes of the elements in each subset equals B.
15
Pseudo-polynomial transformation
A many-one reduction, f, from problem ∏ to problem ∏’ is a pseudo-polynomial transformation if there exist polynomials p(,), q1 (,) and q2 (,) , such that for an arbitrary instance I of ∏: 1. f(I) can be computed in p(len(I), max(I)) time; 2. len(I) ≤ q1 (len’(f(I))); and 3. max’(f(I)) ≤ q2 (len(I),max(I)). Difference lies in 1. for pseudo-polynomial and polynomial transformation. take time polynomial in both take time len(I) and max(I) polynomial in len(I) Condition 2. Forbids unusual transformation that shrink the instance too much. Condition 3. Prevent from creating exponentially large numbers during pseudo-polynomial transformation.
16
Proposition 8.3 If ∏ is strongly NP-complete, ∏’ belongs to NP, and ∏ reduces to ∏’ through a pseudo-polynomial transformation, then ∏’ is strongly NP-complete. Proof: Since ∏ is strongly NP-complete, there exist some polynomial r() such that ∏ restricted to instances I with max(I) ≤ r(len(I)) is NP-complete ,((∏r) is restricted version if ∏ ) i.e. ∏r is NP-complete. (proposition 8.2).
17
Proposition 8.3(cont.) Consider effect of f on ∏r : it runs in time polynomial in len(I) - in at most p(len(I), r(len(I))) time and it creates instances I’ of ∏’ that all obey inequality max(I’) ≤ q2 (r(q1 (len(I’))), q1 (len’(I’))). It’s a polynomial-time transformation between ∏r and ∏’r’ , where r’(x) is the polynomial q2(r(q1(x)), q1(x)). max(I’) ≤ r’(len(I’)) Hence ∏’r’ is NP-complete, so ∏’ is strongly NP-complete.
18
Summary Certain NP-complete problems like partition and knapsack involving numbers are solved by the pseudo-polynomial time algorithm. Those problems which can be proved NP-complete in strong sense have more forceful claim to intractability than those which are merely NP-complete; i.e. they cannot be solved by pseudo-polynomial time algorithms unless P=NP.
19
References The theory of computation by Moret, B.M.E. ,Chapter 8, section 8.2, Strong NP-completeness. "Strong" NP-Completeness Results: Motivation, Examples, and Implications by M. R. Garey and D.S. Johnson, Bell laboratories, New jersey. /Lecture10-NPcomplete.pdf
20
Complexity of Approximations
Donald Johnson
21
There are times when a solutions is required to a problem which is known to be NP complete
In this case it is best to seek an approximate solution, by using some heuristic.
22
Example Heuristics For fixed number of colors a randomly chosen graph will almost never be colorable by the set of color Almost all dense graphs contain a Hamilton circuit
23
Types of Approximation
Deterministic - The solution provided differs from the optimal solution by at most some measure. Probabilistic - The solution provided has some probability of being ideal A given approximation algorithm can be both Deterministic and Probabilistic.
24
Approximation and Decision
Decision problems can only be approximated probalisticly Yes is an infinitely bad approximation for no Approximation is usually used for optimization problems
25
NP Optimization Problem (NPO)
A collection of instance recognizable in constant time A polynomial p, such that each feasible solution has it length bounded by p and membership of a string in the set of feasible is bounded in time by p An objective function defined over the set of feasible solutions
26
NPO The goal of a NPO is to find the solution that minimizes or maximizes, depending on the problem, the value of the objective function Example: in the traveling salesman problem the list of feasible solutions is the set of all possible city orderings. The objective function is the distance traveled.
27
The decision version of a NPO is solvable in polynomial time whenever the NPO it self is solvable in polynomial time. As a result if the decision version of a problem is known to be NP-Complete the optimization version can not be solved in polynomial time unless P = NP.
28
Measures of Approximation Quality
Absolute Distance - the distance between the value of the optimal solution and the worst value returned by the approximation for any instance of the problem Absolute Ratio - the absolute distance for a approximation divided by the value of the ideal solution Asymptotic Ratio - the absolute ratio for only those instance of a problem such that the value of the ideal solution is greater than or equal N for some N
29
An optimal solution has a absolute distance and absolute ratio of 0
A ratio value of 1/2 indicates the approximation can err by 100% in either direction A ratio value of 1 indicates the approximation is arbitrarily bad
30
Determining te quality of an approximation is an exercise in algorithm analysis and not part of the complexity theory Complexity theory is concerned with wither or not NP hard optimization problems can be approximated in polynomial time to within a constant distance of ratio.
31
Approximation and Complexity Theory
Determination of the quality of an approximation is party of algorithm anyalisis, and not part of the Theory of Complexity. Complexity Theory is concerned with wither or not NP-Hard Optimization problems can be approximated in polynomial time.
32
If such approximations are possible in polynomial time, what if any guarantees can be made about the accuracy of the solutions. Finding guarantees with approximations is made more difficult because polynomial time reductions, from one problem type to another, do not preserve the quality of approximations
33
If a approximate solution for one problem is transformed into a solution for a problem that the original problem can be reduced to there are no guarantees on the quality of the solution. There are NP-Equivalent problems where one problem can be approximated to within one unit but the other can only be approximated to a constant ratio
34
Vertex Cover and Independent Set
A vertex cover problem is transformable into a independent set problem A simple algorithm can approximate a vertex cover and at worst gives an answer with twice the minimum cover. The ratio for this approximation is 1/2 The ratio of the approximation transformed into a independent set solution is n-1/n+1 which approaches 1 as n increases.
35
Constant-Distance Approximations
The approximation remains within constant distance of the optimal solution
36
Under such circumstances , the absolute ratio is bounded by a constant.
That ensuring such a guarantee can be any easier than finding optimal solution appears nearly impossible at a first sight. A little thought eventually reveals some completely trivial examples, in which the value of the optimal solution never exceeds some constant
37
Example Chromatic Number of Planar Graphs
38
Since all planar graphs are four –colorable, any planar graph can be colored with five colors in low polynomial time, yet deciding three-colorability is NP-Complete. Almost as trivial is the chromatic Index problem, which asks how many colors needed for a valid edge-coloring of a graph; the decision version is known to be NP complete
39
First nontrivial problem : Variation On Partition
An Instance of Maximum Two-Binpacking is given by a set S, A size function s:S->N, a bin capacity C, and a positive integer k. The question is “Does there exist a subset of S with at least k elements that can be partitioned in to two subsets each of which has total size not exceeding C?”
40
Is this problem NP-complete?
Yes Since it suffices to set k=|s| and l=1/2 In order to restrict it to the partition problem.
41
The simple distance-one approximation for Maximum Two-Binpacking
1 2 ……. K’ K’+1 K’+2 ………………. K”+1 K”+2 …….. C C
42
Let k’ be the largest index such that the sum of the k’ smallest elements does not exceed C and let k’’ be the largest index such that the sum of the k” smallest elements does not exceed 2C. We can pack the k’ smallest elements in one bin , ignore the (k’+1)st smallest element, and pack the next k”-k’-1 smallest elements in the second bin, there by packing a total of k”-1 elements in all. However the optimal solution cant exceed k” Same idea can be extended to the Maximum k-Binpacking problem.
43
Simple solution: Our second problem is more complex
44
An instance of safe Deposit Boxes is given by a collection of deposit boxes{B1,B, 2,……Bn} each containing a certain amount si,j 1≤ j ≤ m and 1≤ j ≤ n, of each of m currencies and by target currency amounts b=(bi), 0≤i≤m, and a target bound k>0. The question is “Does there exist a sub collection of at most k safe deposit boxes that among themselves contain sufficient currency to meet target b?”
45
This problem arises in resource allocation in OS’s, where each process requires a certain amount of each of a number of different resources in order to complete its execution and release these resources. Should a deadlock arise? We may want to break it by killing a subset of processes that among themselves hold sufficient resources to allow one of the remaining processes to complete .
46
What makes the problem difficult is that the currencies are not interchangeable
Is this problem NP-complete ? Yes, this problem is NP-complete for each fixed number of currencies larger than one but admits a constant distance approximation
47
Third problem: verify that the Bounded Degree Spanning Tree problem is NP-complete
The Minimum-Degree Spanning Tree prob. can be approximated within one from the minimum degree.
48
The approximation algorithm proceeds through successive iterations from an arbitrary initial spanning tree In general, however, NP hard optimization problems cannot be approximated to within a constant distance unless P equals NP.
49
(Remaining slides are repetition of Topic Constant Distance approximation which already have been covered by above slides) Constant Distance Approximation Generally possible only on problems where there is a known limit to the value of the ideal solution
50
Chromatic Number of Planar Graphs
All planar graphs are four - colorable Any planar graph can be trivially 5 colored in polynomial time The decision problem for 3 colorablity is NP complete
51
Chromatic Index Problem
How many colors are needed for valid edge coloring of a graph Vinzigs therom states that the chromatic index is ether the degree of the graph or the degree + 1
52
Maximum Two Bin Packing
Given a set S A size function s: S->N A bin capacity C And a positive integer bound k Find a subset of S that has at least k elements that can be partitioned into two subset each of which has a size less than C
53
Solution Define k’ as the largest index such that the sum of the k’ smallest elements does not exceed C Define k’’ as the largest index such that the sum of the k’’ smallest elements does not exceed 2C One is subset is the k’ smallest elements, the 2nd set is the elements with indices between k’’ and k’ + 1 This partition will have k’’ - 1 elements, which is one short of the optimal
54
Limit on Constant Distance Approximation
When there is no a know bound on the value of the optimal solution, NP hard optimization problems can not be approximated to within some constant unless P = NP Theorem 8.13 unless P = NP no polynomial time algorithm can find a vertex cover that never exceeds the size of the optimal cover by more than a fixed constant
55
Proof of Theorem Assume than an approximation algorithm to within k vertices exist G=(V,E) Assume the optimal cover has m vertices Create a new graph Gk+1 by making k+1 copies of G Gk+1 has (k+1)|V| vertices and (k+1)|E| edges
56
The optimal cover for Gk+1 has m(k+1) vertices
The approximation alg will give a cover with (k+1)m + k vertices Each copy of G must have at least m vertices in its cover however this means at least one copy has only m vertices as there are only (k+1)m + k vertices instead of (k+1)(m+1) vertices that would be required.
57
References Moret B.M., The Theory of Computation, pp ,
58
Thank you
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.