Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Approximation Algorithms

Similar presentations


Presentation on theme: "Introduction to Approximation Algorithms"— Presentation transcript:

1 Introduction to Approximation Algorithms
Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA

2 Polynomial solution algorithms
Solution quality Computation time Optimal Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming …… Hybrid algorithms Column generation without complete branch-and-price Meta heuristics: Local search Genetic algorithms I borrowed this slide from Marjan van den Akker.

3 Polynomial solution algorithms
Solution quality Computation time Optimal Bound on quality Good solution, no quality guarantee Polynomial Polynomial solution algorithms Approximation algorithms Construction heuristics Super polynomial and/or no guarantee Exact algorithms: Tree search Dynamic programming Integer linear programming …… Hybrid algorithms Column generation without complete branch-and-price Meta heuristics: Local search Genetic algorithms Algorithms and networks Algorithms and networks

4 What to do if a problem is NP-complete?
We have already seen many options to deal with NP-complete problems. Earlier in this course: FTP and exact exponential-time algorithms. Later in this course: Treewidth. In other courses: local search, ILP, constraint programming, … Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee. We consider polynomial-time approximation algorithms. Non-optimal solutions, but with some performance guarantee compared to the optimal solution. Also useful as a starting point for other approaches: Local search, branch and bound.

5 What is a polynomial-time approximation algorithm?
An algorithm that... ‘Solves’ (applies to) an optimisation problem. A minimisation problem or a maximisation problem. E.g., independent set, vertex cover, knapsack, max-SAT. Not: SAT, 3-SAT, etc. Runs in polynomial time. It has a bound on the quality of the solution. This is called the approximation ratio. E.g.: value of algorithm result / optimal solution value · c. We call such an algorithm a c-approximation.

6 Approximation ratio For an instance I of an optimisation problem, let
OPT(I) be the value of the optimal solution to I. ALG(I) be the value computed by the approximation algorithm. An algorithm for a minimisation problem has an approximation ratio c, if for all instances I: An algorithm for a maximisation problem has an approximation ratio c, if for all instances I: Approximation ratio always strictly bigger than 1. Question: what would be a 1-approximation?

7 Class of approximation algorithms
Class of problems with approximation algorithms whose approximation ratio is a constant: APX. Subclass of NP. We only consider optimisation problems in NP. Other notions of approximability also exist. We see some of them the next lecture. And, one at the end of this lecture. Notions of APX-completeness also exist. As NP-completeness. We will see this at the end of the lectures on approximation algorithms.

8 This lecture Approximation algorithms for a series of problems:
Travelling Salesman Problem. Minimum (Weight) Vertex Cover. Max Satisfiability.

9 Maximum Satisfiability
Approximation algorithms - Algorithms and Networks Maximum Satisfiability

10 Max satisfiability (decision version)
Maximum Satisfiability (Max SAT). Instance: A set of clauses C containing literals of variables from a set X and an integer k. Question: Does there exist a truth assignment to the variables in X such that at least k clauses in C are satisfied? k-Satisfiability (k-SAT): Instance: set of clauses C (logical formula in CNF format) where each clause contains at most k literals. Question: does there exist a satisfying assignment to the variables in C, i.e., a truth assignment such that each clause has at least one literal set to true. Defined similarly: Maximum k-Satisfiability (Max k-SAT)

11 Approximating Max Satisfiability
Algorithm: Take any truth assignment a to the variables X. Let :a be the assignment a with all variables negated. Return from {a,:a} the assignment that satisfies most clauses. This is a 2-approximation. ALG ¸ |C|/2, OPT · |C|. Why? Can you also give approximation algorithms for max k-Satisfiability?

12 Travelling salesman problem
Approximation algorithms - Algorithms and Networks Travelling salesman problem

13 The travelling salesman problem with triangle inequality
Instance: n vertices (cities), distance between every pair of vertices. Question: Find shortest (simple) cycle that visits every city? Restriction on distances: Triangle inequality: for all x, y, z: w(x,y) + w(y,z) ³ w(x,z) 1 2 3 4 4 4 1 2 1 2 3 2 3 2 4 4 Also: symmetric distances 2 2 3 4 3 4 2 2 11 12

14 A simple algorithm Consider the Travelling Salesman Problem with triangle inequality. Algorithm: Find a minimum spanning tree. Output vertices of tree in preorder. Preorder: visit a node before its children. Take a tour following the MST This algorithm has approximation ratio 2: OPT ≥ MST. 2 MST ≥ ALG. ALG / OPT ≤ 2MST / MST = 2. Ratio: show example on the blackboard.

15 Can we do better? Yes: Christofides’ algorithm
Construct a Minimum Spanning Tree T. Set W = {v | v has odd degree in tree T}. Compute a minimum weight matching M in the graph G[W]. Look at the graph T+M. Note that T+M is Eulerian! Compute an Euler tour C’ in T+M. Add shortcuts to C’ to get a TSP-tour. This is a 3/2-approximation. Proof on the blackboard. Question: Euler tour, can we remember what that was, and when it existed?

16 Proving approximation ratios
We just saw two algorithms for TSP with triangle inequality. We proved approximation ratios in the following way: Use a quantity x that relates to both the optimal solution and the result of the algorithm A minimum spanning tree in both cases. Prove that OPT ¸ c1 x. Prove that ALG · c2 x Combine both inequalities for a bound on ALG / OPT. Next, we consider some more problems.

17 MINIMUM (weight) VERTEX COVER
Approximation algorithms - Algorithms and Networks MINIMUM (weight) VERTEX COVER

18 Approximation for minimum vertex cover
Algorithm: Let E’ = E, C = ;. While E’  ;. Let {u,v} be any edge from E’. C := C [ {u,v}. Remove every edge incident to u or v from E’. Return C. Approximation algorithm? Runs in polynomial time. Returns a vertex cover. How good is this vertex cover?

19 2-approximation for vertex cover
Theorem: The algorithm on the previous slide is a 2-approximation. Proof: Let A be the set of edges which endpoints we picked. OPT ¸ |A|, because every edge in A must be covered. ALG = 2|A| · 2OPT, hence ALG/OPT · 2. Vraag bewijs aan studenten. Na de TSP voorbeelden moeten ze deze zelf kunnen.

20 Minimum weight vertex cover
Vertex cover where each vertex has a weight. We look for the minimum weight vertex cover. 2-approximation for vertex cover no longer works. We may select very heavy vertices using that algorithm. Next, we will give a 2-approximation for minimum weights vertex cover using LP rounding.

21 An ILP formulation of the problem
Consider the following ILP: In the LP relaxation of this problem, the last constraint isreplaced by: 0 · xv · 1. Linear programming can be solved in polynomial time. Not by the simplex algorithm!! Ellipsoid method / interior point methods.

22 2-Approximation algorithm for minimum weight vertex cover
Compute the optimal solution to the LP relaxation. Output all v with xv ¸ ½. This algorithm returns a vertex cover. For every edge, sum of incident vertices at least 1. Hence at least one of the vertex variables at least ½. Approximation algorithm? Runs in polynomial time and produces a vertex cover. How good is this vertex cover? Proof of 2-approximation on the blackboard! Before click 1: does this algorithm return a vertex cover?

23 Approximation algorithms - Algorithms and Networks
CONCLUSION

24 Conclusion We have seen several different approximation algorithms for different problems: 2-approximations for Max Satisfiability (and Max k-SAT) 1.5- and 2-approximations for TSP. 2-approximations for vertex cover and weighted vertex cover. c-approximations, for a constant c, are called constant factor approximation algorithms. There are more different types of approximations. These we will see after the break.

25 The Landscape of Approximation Algorithms
Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA

26 What is a polynomial-time approximation algorithm?
An algorithm that... Solves an optimisation problem. Runs in polynomial time. It has a bound on the quality of the solution. Approximation ratio c: ALG/OPT · c for minimisation problems. OPT/ALG · c for maximisation problems. Ratio always bigger or equal to 1.

27 Different forms of approximation algorithms (outline of two lectures)
Qualities of polynomial-time approximation algorithms: Absolute constant difference. |OPT – ALG| · c FPTAS: Fully polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/². PTAS: Polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ². APX: Constant-factor approximation. Approximation ratio: ALG/OPT · c for minimisation problems. Approximation ratio: OPT/ALG · c for maximisation problems. f(n)-APX: Approximation by a factor of f(n). f(n) depends only on the size of the input. From top to bottom: best approximation to worst approximation. We have seen several examples of constant factor approximation in the last lecture.

28 Absolute constant difference
Qualities of poly-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Approximation algorithms - Algorithms and Networks Absolute constant difference

29 Absolute constant difference
Algorithms that run in worst-case polynomial time, with: |OPT – ALG| · c Example: Planar graph colouring. Algorithm that tests 1 and 2-colourability and if no solution is found outputs 4. Algorithm has an error of at most 1, because of the four colour theorem. Four colour theorem: Any planar graph G can be coloured with at most four colours.

30 Absolute constant difference for edge colouring
Vizings Theorem: Any graph G can be edge coloured with at most ¢(G)+1 colours, where ¢(G) is the maximum degree of G. Note that any edge colouring of a graph G requires at least ¢(G) colours. Corollary: Edge colouring is approximable with an absolute constant error of one. Algorithm: Return ¢(G)+1. Still, these examples of approximation with additive constant difference are very rare!

31 Absolute constant difference: very rare
Suppose we could approximate maximum independent set within an additive integer constant c > 0. Then, we can solve an NP-complete problem in polynomial time (proof on the blackboard). Similar construction exist for many more problems. Answer: make multiple disjoint copies – if we can approximate within additive factor k, then with more than k copies, we can solve at least one of the disjoint copies.

32 Fully polynomial-time approximation scheme
Qualities of poly-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Approximation algorithms - Algorithms and Networks Fully polynomial-time approximation scheme

33 Knapsack We will introduce the FPTAS (Fully Polynomial-Time Approximation Scheme) using an example first. Knapsack: Given: n items each with a positive integer weight w(i) and integer value v(i) (1 ≤ i ≤ n), and an integer W. Question: select items with total weight at most W such that the total value is as large as possible.

34 Dynamic programming for knapsack
Let P be the maximum value of any item. We can solve the problem in O(n2P) time with dynamic programming: Tabulate M(i,Q): minimum total weight of a subset of items 1,…,i with total value Q for Q at most nP. M(0,0) = 0 M(0,Q) = ∞, if Q>0 M(i+1,Q) = min{ M(i,Q), M(i,Q-v(i+1)) + w(i+1) } This algorithm is clearly correct and runs in the given time. This is a pseudo-polynomial-time algorithm. Pseudo polynomial: polynomial in n and the weights P (or W). Super-polynomial running time if P is (exponentially) large compared to n.

35 Scaling for knapsack We will turn the pseudo-polynomial time algorithm into an approximation algorithm. Algorithm for knapsack: Throw away all items that have weight larger than W (they are never used). Build a new instance: Let c be some positive constant. Do not change weights, but set new values v’(i) = ëv(i) / cû. Solve scaled instance with DP optimally. Output this solution: approximate solution to the original instance.

36 The question is…. As we scale values, not weights, the output is always feasible. The question is: how do we set c, such that… Approximation ratio good enough? Polynomial time? Approximation quality (blackboard): ALG ¸ OPT – nc. Running time: O(n2P/c).

37 A different kind of approximation algorithm
For any constant ² > 0, we use c = eP/(2n). Largest value of an item is at most P/c = P / (eP/(2n)) = 2n/e . Running time is O(n2 * 2n/e) = O(n3/e). Approximation ratio (on blackboard): 1+e. Arbitrary good approximation. For fixed epsilon, these run in polynomial time. Running time grows exponentially in number of bits precision. This is a Polynomial Time Approximation Scheme (PTAS). That is, an algorithm, that gets two inputs: the “usual” input X, and a real value e>0. And, for each fixed e>0, the algorithm is a (1+e)-approximation algorithm.

38 PTAS and FPTAS For any constant ² > 0, we have an algorithm with:
Running time is O(n3/e). Approximation ratio: 1+e. Actually, this is a Fully Polynomial Time Approximation Scheme (FPTAS). That is, an algorithm, that gets two inputs: the “usual” input X, and a real value e>0. And, for each fixed e>0, the algorithm is a (1+e)-approximation algorithm. And, the algorithm uses polynomial time in both n and 1/e.

39 Polynomial-time approximation scheme
Qualities of poly-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Approximation algorithms - Algorithms and Networks Polynomial-time approximation scheme

40 PTAS and FPTAS A Polynomial Time Approximation Scheme is an algorithm, that gets two inputs: the “usual” input X, and a positive real value e>0. For each fixed e>0, the algorithm: Is an (1+e)-approximation algorithm. Uses polynomial time. A Fully Polynomial Time Approximation Scheme is an algorithm, that gets two inputs: the “usual” input X, and a positive real value e>0. The algorithm uses polynomial time in the size of X and in 1/e.

41 PTAS that are not an FPTAS
It is not always possible to construct an FPTAS (even if we have a PTAS). Example: maximum independent set has no FPTAS. Suppose that it has, for each fixed e>0, some algorithm: Is an (1+e)-approximation algorithm. Uses polynomial time in the size of X and in 1/e. Let ² = 1/n and run the algorithm. The algorithm uses polynomial time. The algorithm solves the problem optimally as: Hence, no such algorithm exists unless P=NP.

42 PTAS that are not FPTAS are often found in a geometric setting
Proof that no FPTAS exists also works if we restrict the class of graphs. The only property of max independent set that we have used is that the optimum is bounded by n. The same proof works for any problem with a polynomial bound p(n) on the size/quality of an optimal solution. Use ² = 1/p(n). That’s why we call this the ‘polynomial-bound technique’. There exists a PTAS for maximum independent set restricted to: Planar graphs (next!). Unit-disk graphs (we will not consider these in the lectures).

43 Planar graphs and k-outerplanar graphs
Given a planar embedding of a graph G, we define the level of a vertex as follows: All nodes that lie on the exterior face have level 1. For any i, if we remove from the embedding all nodes of level smaller than i, then all nodes that lie on the border of the exterior face have level i. A k-outerplanar graph is a graph that allows a planar embedding consisting of at most k levels. Lemma (that we will not prove in this lecture): For any k, maximum independent set restricted to k-outerplanar graphs can be solved optimally in O(8kn) time. Voorbeeld van graaf op bord zetten!

44 PTAS for maximum independent set on planar graphs
Algorithm (input: graph G, approximation ratio r>1) Let k = d1/(r-1)e. Compute a planar embedding of G. Compute the level numbers for all vertices in G. For i = 0 to k: Let Vi be V with all nodes that modulo k+1 have level i removed. Let Gi be the graph induced by Vi (note: it is k-outerplanar). Compute a maximal independent set in Gi using the lemma. Return the largest independent set found over all k tries. Consider the maximum independent set I in G. At least one Vi has |Vi Å I| · |I|/(k+1). Thus the resulting sets is of size at least: |I| k/(k+1). Approximation ratio r.

45 PTAS for maximum independent set on planar graphs
Algorithm (input: graph G, approximation ratio r>1) Let k = d1/(r-1)e. Compute a planar embedding of G. Compute the level numbers for all vertices in G. For i = 0 to k: Let Vi be V with all nodes that modulo k+1 have level i removed. Let Gi be the graph induced by Vi (note: it is k-outerplanar). Compute a maximal independent set in Gi using the lemma. Return the largest independent set found over all k tries. Running time: O(8kkn). Since k = d1/(r-1)e, this is polynomial for a fixed approximation ratio r. Other PTASses in a geometric setting often use the same principle: divide the graph into smaller parts on which we can solve it optimally fast.

46 Approximation algorithms - Algorithms and Networks
CONCLUSION

47 Conclusion Absolute constant difference.
|OPT – ALG| · c Examples: Planar graph colouring, edge colouring. Negative example: maximum independent set. FPTAS: Fully polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/². Example: knapsack (scaling). PTAS: Polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ². Example: maximum independent set on planar graphs.

48 The Landscape of Approximation Algorithms Part 2
Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender Intro: 5 min ABS: 5 min PTAS/FPTAS: 15 min APX: 5 min F(n)-APX: 15 min TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA

49 Different forms of approximation algorithms (outline of two lectures)
Qualities of polynomial-time approximation algorithms: Absolute constant difference. |OPT – ALG| · c FPTAS: Fully polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/². PTAS: Polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ². APX: Constant-factor approximation. Approximation ratio: ALG/OPT · c for minimisation problems. Approximation ratio: OPT/ALG · c for maximisation problems. f(n)-APX: Approximation by a factor of f(n). f(n) depends only on the size of the input. From top to bottom: best approximation to worst approximation. We have seen an example of an FPTAS (and thus PTAS) last lecture, and several examples of constant factor approximation.

50 What we have seen already
Absolute constant difference. |OPT – ALG| · c Examples: Planar graph colouring, edge colouring. Negative example: maximum independent set. FPTAS: Fully polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/². Example: knapsack (scaling). PTAS: Polynomial-time approximation scheme. Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ². Example: maximum independent set on planar graphs.

51 APX Approximation algorithms - Algorithms and Networks
Qualities of poly-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Approximation algorithms - Algorithms and Networks APX

52 APX: constant factor approximation
APX: class of problems for which approximation algorithms exists with a constant approximation ratio. This is different from the PTAS / FPTAS setting where we can get arbitrarily good approximations. Problems with an (F)PTAS are in APX. We have seen enough examples of this last week. 2-approximation for Max Satisfiability (and Max k-SAT) 1.5- and 2-approximations for TSP. 2-approximations for vertex cover and weighted vertex cover. Negative examples, after first considering the last class of approximation algorithms.

53 F(n)-APX Approximation algorithms - Algorithms and Networks
Qualities of poly-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Approximation algorithms - Algorithms and Networks F(n)-APX

54 Approximation by a factor of f(n)
Approximation ratio of f(n). Approximation ratio depends on the size of the input (and can be very bad) Set Cover Given: finite set U and a family F of subsets of U. Question: Does there exists a subset C of F of size at most k such that [S2C S = U? Greedy algorithm: While U  ;: Select S 2 F that maximises |S Å U|. Add S to C and let U := U \ S.

55 An (ln(n)+1)-approximation algorithm for set cover
Theorem: The greedy set cover algorithm is an (ln(n)+1)-approximation. Proof: The algorithm runs in polynomial time and returns a set cover. Let Si be the ith set from F picked by the algorithm. We assign cost cx to elements from U: Let x be firstly covered by set Si while running the algorithm. And, let Xi = Si \ (S1 [ S2 [ ... [ Si-1) Define: cx = 1 / |Xi|. Now we have: ... Write main points on blackboard!

56 Proof of the (ln(n)+1)-approximation algorithm for set cover
The nth Harmonic number H(n) is defined as: From mathematics (bounding using integrals): On the blackboard, we will prove that for any S 2 F: From this we derive our approximation ratio: Where C* is the optimal set cover.

57 Conclusion approx. algorithms
Approximation algorithms - Algorithms and Networks Conclusion approx. algorithms

58 Conclusion Qualities of polynomial-time approximation algorithms:
Absolute constant difference. Planar graph colouring. FPTAS: Fully polynomial-time approximation scheme. Scaling for Knapsack. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. TSP with triangle inequality. (Weighted) vertex cover. f(n)-APX: Approximation by a factor of f(n). Set cover.

59 Introduction to Approximation Complexity
Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender This is not a break signal!! TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA

60 Approximation complexity
We know how to prove that a problem can be solved in polynomial time. Give a polynomial-time algorithm and prove correctness. We also know how to prove that a problem ‘most likely’ cannot be solved in polynomial time. Prove NP-hardness: give a polynomial-time reduction from a known NP-compete / NP-hard problem. NP-complete: in NP and NP-hard. How does this work for approximation algorithms? Positive results: give algorithm and prove that it is the appropriate type of approximation algorithm. Negative results?? Well... we have seen some of them already.

61 How to prove that an algorithm from one of the categories does not exist?
Qualities of polynomial-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). We have already proved that ‘most likely’: Absolute constant difference approximation is not possible for maximum independent set. There is no FPTAS for maximum independent set. But can we do more?

62 How to prove that an algorithm from one of the categories does not exist?
We have already proved that ‘most likely’: Absolute constant difference approximation is not possible for maximum independent set. There is no FPTAS for maximum independent set. But can we do more? We will briefly review: The gap technique. The polynomial-bound technique. Both already seen in earlier lectures.

63 Approximation algorithms - Algorithms and Networks
THE GAP TECHNIQUE

64 The gap technique The gap technique: Example:
An NP-hardness proof that creates a (wide) gap between YES-instance and NO-instances. Example: There is no polynomial time algorithm A for TSP without triangle inequality that approximates within a ratio c, for any constant c>1. Reduction: Take instance G=(V,E) of Hamiltonian Circuit. Build instance of TSP: A city for each v 2 V. If (v,w) 2 E, then d(v,w) = 1, otherwise d(v,w) = nc+1. A finds a tour with distance at most nc, if and only if, G has a Hamiltonian circuit.

65 Using the gap technique
The gap technique can (sometimes) be used to prove: Absolute constant difference approximation is not possible. Constant-factor approximation is not possible. PTAS is not possible. We have seen two examples of the gap technique: One to prove non-existence of absolute constant difference approximation of independent set (second lecture) One to prove non-existence of constant-factor approximation of TSP without triangle inequality.

66 Another example: knapsack
We know there exists an FPTAS for knapsack. If we can rule out an absolute constant difference approximation, then we know how difficult knapsack is from the viewpoint of approximation. Knapsack: Given: n items each with a positive integer weight w(i) and integer value v(i) (1 ≤ i ≤ n), and an integer W. Question: select items with total weight at most W such that the total value is as large as possible.

67 Another example: knapsack
We know there exists an FPTAS for knapsack. If we can rule out an absolute constant difference approximation, then we know how difficult knapsack is from the viewpoint of approximation. Suppose there is an absolute constant difference approximation algorithm for knapsack with absolute integer error c¸1: Take an instance of knapsack. Multiply the value of all items by c+1. This does not change the set of feasible solutions. However, the only solution with a difference in value of at most c from the optimal solution, is the optimal solution itself. An absolute constant difference approximation will thus solve this knapsack instance optimally, contradicting the assumption P  NP.

68 THE polynomial-bound technique
Approximation algorithms - Algorithms and Networks THE polynomial-bound technique

69 The polynomial bound technique
Prove that there is no FTPAS by using the a problem has a bound of p(n) on any optimal solution. Example (from earlier lecture): maximum independent set. Use p(n) = n. Suppose that the problem has an FPTAS, then for each fixed e>0, there is some algorithm that: Is a (1+e)-approximation algorithm. Uses polynomial time in the size of X and in 1/e. Let ² = 1/p(n) and run the algorithm. The algorithm uses polynomial time. The algorithm solves the problem optimally as: Hence, no such algorithm exists unless P=NP. OPT * p(n)/(p(n)+1) = OPT – opt/(p(n)+1) by adding +1 and -1 to the numerator of the first fraction.

70 Approximation Complexity
Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender Let op: binnen 10 minuten wil je het over APX-completeness hebben! TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA

71 How to prove that an algorithm from one of the categories does not exist?
Qualities of polynomial-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Previous lecture: The gap technique. The polynomial-bound technique.

72 How to prove that an algorithm from one of the categories does not exist?
Qualities of polynomial-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). This lecture: Proving that no PTAS exists for some problems by proving APX-completeness. Proving that a problem does not belong to APX.

73 This lecture Recap on NP-completeness.
The complexity class APX and APX-completeness. Inapproximability of maximum independent set. Maximum independent set is not in APX. Note: All cases proving that some algorithm ‘most likely’ does not exists are based on the ‘likely’ assumption PNP.

74 A RECAP ON NP-completeness
Approximation algorithms - Algorithms and Networks A RECAP ON NP-completeness

75 P and NP A decision problem belongs to the class P if:
There is an algorithm solving the problem with a running time that is polynomial in the input size. A decision problem belongs to the class NP if: Any solution y (called a certificate) can be encoded in polynomial space with respect to the size of the input x. Checking whether a given certificate y resembles a `yes’-instance can be done in polynomial time with respect to the size of x and y. Clearly P is contained in NP. We can ignore the certificate y. When checking y, just solve x in polynomial time.

76 Reducibility Definition:
Problem P1 is polynomial-time reducible to problem P2 (or: P1 £P P2 ), if there exists a polynomial time computable function f mapping instances I1 of P1 to instances I2 of P2 such that: I1 is a ‘yes’-instance, if and only if, I2 is a ‘yes’-instance. Lemma: If P1 £P P2 then: if P2 Î P, then P1 Î P. Run an algorithm for P2 on f(I) for instance I for problem P1. If P1 £P P2 and P2 £P P3 then: P1 £P P3. Reductions can be composed together.

77 NP-completeness A problem P is NP-complete if:
The problem belongs to NP. All problems in NP are polynomial-time reducible to P. From a viewpoint of polynomial-time computability, NP-complete problems are the hardest problems in NP. If one of them can be solved in polynomial time, all problems in NP can be solved in polynomial time. A problem P is NP-hard if:

78 Proving that ‘most likely’ no polynomial-time algorithms exist
NP-complete/NP-hard problems ‘most likely’ have no polynomial-time algorithms. We often assume PNP. Proving NP-completeness for problem P: Take a known NP-complete problem Q. Show that their exists a polynomial-time reduction from Q to P. This implies that all problems in NP can be reduced to P. Cook-Levin theorem: Satisfiability is NP-complete. This was the ‘first known’ NP-complete problem. Stop here for a moment for questions: does everyone remember this?

79 APX and APX-completeness
Approximation algorithms - Algorithms and Networks APX and APX-completeness

80 APX and APX-completeness
APX: class of problems for which approximation algorithms exists with a constant approximation ratio. Thus, problems with an (F)PTAS are also in APX. APX-completeness: Hardest problems in APX with respect to having a PTAS. If one APX-complete has a PTAS, then all APX-complete problems have a PTAS. Max-3SAT is APX-complete. Consequence of the famous PCP theorem, that we will not discuss further. Corollary: any APX-complete problem has no PTAS unless P=NP. PCP theorem: every decision problem in the NP complexity class has probabilistically checkable proofs (proofs that can be checked by a randomized algorithm with high probability of correctness) of constant query complexity and logarithmic randomness complexity (uses a logarithmic number of random bits).

81 L-reduction P1 is L-reducible to P2 (P1 £L P2) if there exist: Lemma:
a function f mapping instances x of P1 to instances f(x) of P2, a function g mapping solutions of f(x) to solutions of x, two constants a and b such that: f and g are computable in polynomial-time computable. For any instance x of P1: OPT( f(x) ) · a ¢ OPT(x). For any instance x of P1 and any solution y of f(x): |OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|. Lemma: If P1 £L P2 then: if P2 has a PTAS, then P1 has a PTAS. Run an algorithm for P2 on f(x) for instance x for problem P1. L-Reduction preserves approximation. For a minimisation problem (absolute value symbols exist to work for both max en min problems): VAL(g(y)) - OPT(x) \leq b ( VAL(y) - OPT(f(x)) ) [by def part 3] \leq b ( (1+epsilon) OPT f(x) - OPT(f(x)) ) [by def (1+epsilon)-approx of PTAS] \leq b epsilon OPT f(x) [simplify] \leq b epsilon a OPT(x) [by def part 2] Thus a (1 + b epsilon a)-approximation

82 L-reduction P1 is L-reducible to P2 (P1 £L P2) if there exist: Lemma:
a function f mapping instances x of P1 to instances f(x) of P2, a function g mapping solutions of f(x) to solutions of x, two constants a and b such that: f and g are computable in polynomial-time computable. For any instance x of P1: OPT( f(x) ) · a ¢ OPT(x). For any instance x of P1 and any solution y of f(x): |OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|. Lemma: If P1 £L P2 and P2 £L P3 then: P1 £L P3. Reductions can be composed together. Copy to blackboard

83 Proving APX-completeness
Proving APX-completeness of problem P: Give a c-approximation (prove that P is in APX). Give an L-reduction from an APX-complete problem to P. Proving APX-hardness of problem P: Give an L-reduction from an APX-hard problem to P. Similar to NP-completeness. PNP implies PTAS  APX.

84 NP-completeness and APX-completeness
NP-complete: if one problem is polynomial-time solvable, then all are. Polynomial-time reductions. Cook’s theorem: SAT is NP-complete. APX-complete: if one problem has a PTAS, then all have. L-reductions. PCP theorem implies Max 3-SAT is APX-complete.

85 Example L-reduction Theorem: Max 3-SAT £L Max 2-SAT. Proof:
Transformation f: replace any clause (x,y,z) by: (x), (y), (z), (v), (:x,:y), (:x,:z), (:y,:z), (x,:v), (y,:v), (z, :v). Here v is a new variable (each clause gets a different one). Transformation g: restrict the truth assignment to the original variables. a=13, b=1. To prove: For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I). For any instance x of P1 and any solution y of f(x): |OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|. Truth table on blackbord: (x,y,z) all false -> new clauses 6 true, otherwise new clauses 7 true.

86 APX-completeness of Max 2-SAT
Corollary: Max 2-SAT is APX-complete. APX-hard by the L-reduction from Max 3-SAT. There is a 2-approximation for MaxSat that we have seen in an earlier lecture. Hence, there also is a 2-approximation for Max 2-SAT, i.e., Max 2-SAT is in APX.

87 INAPPROXIMABILITY OF MAX INDEPENDENT SET
Approximation algorithms - Algorithms and Networks INAPPROXIMABILITY OF MAX INDEPENDENT SET

88 Inapproximability of maximum independent set
We have seen that max independent set does not allow absolute constant difference approximation, nor an FPTAS. Next, we show that there also is no PTAS, by proving APX-hardness. L-reduction from Max 2-SAT: No, we will not prove APX-completeness. Max independent set also not in APX as we will conclude thereafter.

89 L-reduction from max 2-SAT to maximum independent set
L-Reduction: Max 2-SAT £L Maximum Independent Set. Transformation f: Replace any clause (x,y) by two vertices x and y connected by an edge. For all variables x: connect all pairs (x,:x) by an edge. Transformation g: Set x to true if any x vertex in the solution, to false if any :x vertex in the solution. Choose arbitrarily otherwise. a=1, b=1. To prove: For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I). For any instance x of P1 and any solution y of f(x): |OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|. Op blackbord voorbeeld geven.

90 No PTAS for maximum independent set
Corollary: There is no approximation algorithm for maximum independent set that, for each fixed e>0: Is an (1+e)-approximation algorithm. Uses polynomial time. Next step is to prove that we cannot find a c-approximation for maximum independent set. We will use a self reduction.

91 Self reduction for maximum independent set
Lemma: If independent set can be approximated with approximation ratio c, then it can be approximated with ratio √c. Proof: Given a graph G, we construct G x G: It has nodes (u,v) corresponding to tuples of vertices from G. It has edge (u,v)-(u’,v’) iff: u = u’, and (v,v’) an edge in G. (u,u’) an edge in G. Claim G has an independent set of size k, if and only if, G x G has an independent set of size k2. Run the c-approximation on G x G with result J: The result in G x G has OPT2 · c |J|. Thus in G: √OPT · √c √|J| Example again on the blackboard.

92 No PTAS for maximum independent set
If independent set can be approximated with approximation ratio c, then it can be approximated with ratio √c. Corollary: If independent set can be approximated with approximation ratio c, then it can be approximated with ratio 1 + ² (it has a PTAS). For fixed ², we can repeat the square root trick often enough (but a fixed number of times) until the ratio is good enough. Maximum independent set is not in APX. It has no PTAS assuming PNP, hence also no c-approximation.

93 Concluding remarks on independent set
Maximum independent set is in f(n)-APX, where: Things can be even worse: TSP without triangle inequality cannot be approximated by any polynomial-time approximation algorithm with an approximation ratio p(n) for any polynomial p(n) unless P=NP.

94 Approximation algorithms - Algorithms and Networks
CONCLUSION

95 Conclusion on approximation
Qualities of polynomial-time approximation algorithms: Absolute constant difference. FPTAS: Fully polynomial-time approximation scheme. PTAS: Polynomial-time approximation scheme. APX: Constant-factor approximation. f(n)-APX: Approximation by a factor of f(n). Proving that a quality of approximation algorithm ‘most likely’ does not exist: Gap technique. Polynomial-bound technique. APX-completeness / APX-hardness. Self reduction.


Download ppt "Introduction to Approximation Algorithms"

Similar presentations


Ads by Google