104
1 Introduction to Approximation Algorithms Algorithms and Networks 2017/2018 Johan M. M. van Rooij Hans L. Bodlaender

Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

  • Upload
    others

  • View
    20

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

1

Introduction to

Approximation Algorithms

Algorithms and Networks 2017/2018

Johan M. M. van Rooij

Hans L. Bodlaender

Page 2: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

2

Solutionquality

Computationtime

Optimal Bound on quality

Goodsolution, no qualityguarantee

PolynomialPolynomial

solution algorithms

Approximationalgorithms

Constructionheuristics

Super polynomialand/or no guarantee

Exact algorithms:• Tree search• Dynamic

programming• Integer linear

programming• ……

Hybridalgorithms• Column

generationwithout complete branch-and-price

Meta heuristics:• Local

search • Genetic

algorithms

Page 3: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

3

Solutionquality

Computationtime

Optimal Bound on quality

Goodsolution, no qualityguarantee

PolynomialPolynomial

solution algorithms

Approximationalgorithms

Constructionheuristics

Super polynomialand/or no guarantee

Exact algorithms:• Tree search• Dynamic

programming• Integer linear

programming• ……

Hybridalgorithms• Column

generationwithout complete branch-and-price

Meta heuristics:• Local

search • Genetic

algorithms

Algorithmsand networks

Algorithmsand networks

Page 4: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

4

What to do if a problem isNP-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.

Page 5: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

5

What is a polynomial-time approximation algorithm?

An algorithm that...

1. ‘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.

2. Runs in polynomial time.

3. 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.

Page 6: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

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:

Page 7: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

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.

Page 8: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

8

This lecture

Approximation algorithms for a series of problems:

Travelling Salesman Problem.

Minimum (Weight) Vertex Cover.

Max Satisfiability.

Page 9: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

9

Further reading and additional practice

For the design and analysis of approximation algorithms.

Introduction to Algorithms, Cormen et al., 3th Edition, Chapter 35.

Answers to exercises can be found here:

http://sites.math.rutgers.edu/~ajl213/CLRS/CLRS.html

I do not guarantee that this source is correct, but a quick glance over the solutions gives me a good feeling about them.

For the landscape of approximation algorithms.

Complexity and Approximation. Ausiello et al., Chapter 3.

I do not know of a place to find answers to the exercises.

If you do, please send me an e-mail and I will update this slide

Page 10: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

10

MAXIMUM SATISFIABILITY

Approximation algorithms - Algorithms and Networks

Page 11: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

11

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)

Page 12: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

12

Approximating Max Satisfiability

Algorithm:

1. Take any truth assignment a to the variables X.

2. Let :a be the assignment a with all variables negated.

3. 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?

Page 13: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

13

TRAVELLING SALESMAN PROBLEM

Approximation algorithms - Algorithms and Networks

Page 14: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

14

The symmetric 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:

Symmetric: for all x,y:

w(x,y)=w(y,a)

Triangle inequality:for all x, y, z:

w(x,y) + w(y,z) w(x,z)

1 2

3 4

4

4

2

2 3

2

1 2

3 4

4

4

2

2 3

2

1 2

3 4

4

4

2

2 3

2

12 11

Page 15: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

15

A simple algorithm

Consider the symmetric Travelling Salesman Problem with triangle inequality.

Algorithm:

1. Find a minimum spanning tree.

2. 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.

Page 16: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

16

Can we do better?Yes: Christofides’ algorithm

Christofides’ Algorithm:

1. Construct a Minimum Spanning Tree T.

2. Set W = {v | v has odd degree in tree T}.

3. Compute a minimum weight matching M in the graph G[W].

4. Look at the graph T+M.

Note that T+M is Eulerian!

5. Compute an Euler tour C’ in T+M.

6. Add shortcuts to C’ to get a TSP-tour.

This is a 3/2-approximation.

Proof on the blackboard.

Page 17: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

17

Ratio 1.5

Total length edges in T: at most OPT

Total length edges in matching M: at most OPT/2.

T+M has length at most 3/2 OPT.

Use triangle inequality.

Page 18: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

18

Proving approximation ratios

We just saw two algorithms for TSP with triangle inequality.

We proved approximation ratios in the following way:

1. Use a quantity x that relates to both the optimal solution and the result of the algorithm

A minimum spanning tree in both cases.

2. Prove that OPT ¸ c1 x.

3. Prove that ALG · c2 x

4. Combine both inequalities for a bound on ALG / OPT.

Next, we consider some more problems.

Page 19: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

19

MINIMUM (WEIGHT) VERTEX COVER

Approximation algorithms - Algorithms and Networks

Page 20: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

20

Approximation for minimum vertex cover

Algorithm:

1. Let E’ = E, C = ;.

2. While E’ ;.

1. Let {u,v} be any edge from E’.

2. C := C [ {u,v}.

3. Remove every edge incident to u or v from E’.

3. Return C.

Approximation algorithm?

Runs in polynomial time.

Returns a vertex cover.

How good is this vertex cover?

Page 21: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

21

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.

Page 22: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

22

Minimum weight vertex cover

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.

Page 23: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

23

An ILP formulation of the problem

Consider the following ILP:

In the LP relaxation of this problem, the last constraint is replaced by:

0 · xv · 1.

Linear programming can be solved in polynomial time.

Not by the simplex algorithm!!

Ellipsoid method / interior point methods.

minimise:X

v2Vwvxv

subject to: xu + xv ¸ 1 for each (u; v) 2 E

xv 2 f0; 1g for each v 2 V

Page 24: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

24

2-Approximation algorithmfor minimum weight vertex cover

Algorithm:

1. Compute the optimal solution to the LP relaxation.

2. 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!

Page 25: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

25

Proof of 2-approximation algorithmfor minimum weight vertex cover

Let z* be the solution to the LP.

Because any vertex cover is a solution to the LP we have:

Also, we can bound ALG in terms of z*:

Hence, ALG · 2z*, and:

QED

Page 26: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

26

CONCLUSION

Approximation algorithms - Algorithms and Networks

Page 27: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

27

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.

Page 28: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

28

The Landscape of

Approximation Algorithms

Algorithms and Networks 2017/2018

Johan M. M. van Rooij

Hans L. Bodlaender

Page 29: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

29

What is a polynomial-time approximation algorithm?

An algorithm that...

1. Solves an optimisation problem.

2. Runs in polynomial time.

3. 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.

But there is much more…

Page 30: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

30

Different forms of approximation algorithms (outline of two lectures)

Qualities of polynomial-time approximation algorithms:

1. Absolute constant difference.

|OPT – ALG| · c

2. FPTAS: Fully polynomial-time approximation scheme.

Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/².

3. PTAS: Polynomial-time approximation scheme.

Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ².

4. APX: Constant-factor approximation.

Approximation ratio: ALG/OPT · c for minimisation problems.

Approximation ratio: OPT/ALG · c for maximisation problems.

5. f(n)-APX: Approximation by a factor of f(n).

f(n) depends only on the size of the input.

Page 31: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

31

ABSOLUTE CONSTANT DIFFERENCE

Approximation algorithms - Algorithms and Networks

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 32: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

32

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.

Page 33: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

33

Absolute constant difference foredge 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!

Page 34: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

34

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.

Page 35: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

35

Absolute constant difference: very rare

Suppose we could approximate maximum independent set within an additive integer constant c > 0.

1. Take an instance of maximum independent set: a graph G, where we look for an independent set of size at least k.

2. Make c + 1 disjoint copies of G.

3. Run the approximation algorithm on the new graph.

4. If an independent set of size at least k exists in G, then the algorithm returns a solution of size ¸ (c+1)k - c.

5. This means that it must be of size ¸ k on at least one disjoint

copy.

6. If the independent set does not exits, then the algorithm returns a solution of size · (c+1)(k-1).

7. This way, we can solve an NP-complete problem using this polynomial-time algorithm. That should not be possible.

Similar construction exist for many more problems.

Page 36: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

36

FULLY POLYNOMIAL-TIME APPROXIMATION SCHEME

Approximation algorithms - Algorithms and Networks

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 37: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

37

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.

Page 38: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

38

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,…,iwith 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.

Page 39: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

39

Scaling for knapsack

We will turn the pseudo-polynomial time algorithm into an approximation algorithm.

Algorithm for knapsack:

1. Throw away all items that have weight larger than W (they are never used).

2. Build a new instance:

1. Let c be some positive constant (used to set the approx. ratio).

2. Do not change weights, but set new values v’(i) = v(i) / c.

3. Solve scaled instance with DP optimally.

4. Output this solution: approximate solution to the original instance.

Page 40: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

40

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).

Next: how to choose c so that we have an FPTAS?

Page 41: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

41

Approximation ratio

Consider optimal solution Y for original problem.

Let Y have value OPT.

Solution value scaled instance:

At most n items, for each v(i)/c - v(i)/c <1

So, DP finds a solution of value at least OPT/c – n for scaled problem instance.

Value of approximate solution for original instance is at least c*(OPT/c –n) = OPT – nc.

Page 42: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

42

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.

Page 43: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

43

(1+e)-approximation

OPT ≥ P.

Each single-item set is a solution in itself, as we removed items with weight more than W.

Algorithm gives solution of value at least:

OPT – nc = OPT – n(e P / (2n) ) = OPT – eP/2

OPT / (OPT – eP/2) ≤ OPT / (OPT – e/2 OPT)

= 1 / (1 - e/2) ≤ 1+e.

Where the last inequality is true if e ≤ 1.

QED.

Page 44: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

44

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.

Page 45: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

45

The Landscape of Approximation

Algorithms Part 2

Algorithms and Networks 2017/2018

Johan M. M. van Rooij

Hans L. Bodlaender

Page 46: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

46

Different forms of approximation algorithms (outline of two lectures)

Qualities of polynomial-time approximation algorithms:

1. Absolute constant difference.

|OPT – ALG| · c

2. FPTAS: Fully polynomial-time approximation scheme.

Approximation ratio 1+² for any ² > 0, while the algorithm runs in time polynomial in n and 1/².

3. PTAS: Polynomial-time approximation scheme.

Approximation ratio 1+² for any ² > 0, while the algorithm runs in polynomial time for any fixed ².

4. APX: Constant-factor approximation.

Approximation ratio: ALG/OPT · c for minimisation problems.

Approximation ratio: OPT/ALG · c for maximisation problems.

5. f(n)-APX: Approximation by a factor of f(n).

f(n) depends only on the size of the input.

Page 47: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

47

POLYNOMIAL-TIME APPROXIMATION SCHEME

Approximation algorithms - Algorithms and Networks

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 48: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

48

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.

For each fixed e>0, the algorithm:

Is an (1+e)-approximation algorithm.

The algorithm uses polynomial time in the size of X and in 1/e.

Page 49: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

49

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.

1. 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.

2. Let ² = 1/n and run the algorithm.

The algorithm uses polynomial time.

The algorithm solves the problem optimally as:

3. Hence, no such algorithm exists unless P=NP.

Page 50: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

50

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).

Page 51: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

51

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.

Page 52: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

52

PTAS for maximum independent seton planar graphs

Algorithm (input: graph G, approximation ratio r>1)

1. Let k = d1/(r-1)e.

2. Compute a planar embedding of G.

3. Compute the level numbers for all vertices in G.

4. For i = 0 to k:

1. Let Vi be V with all nodes that modulo k+1 have level i removed.

2. Let Gi be the graph induced by Vi (note: it is k-outerplanar).

3. Compute a maximal independent set in Gi using the lemma.

5. 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.

Page 53: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

53

PTAS for maximum independent seton planar graphs

Algorithm (input: graph G, approximation ratio r>1)

1. Let k = d1/(r-1)e.

2. Compute a planar embedding of G.

3. Compute the level numbers for all vertices in G.

4. For i = 0 to k:

1. Let Vi be V with all nodes that modulo k+1 have level i removed.

2. Let Gi be the graph induced by Vi (note: it is k-outerplanar).

3. Compute a maximal independent set in Gi using the lemma.

5. 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.

Page 54: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

54

APX

Approximation algorithms - Algorithms and Networks

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 55: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

55

What we have seen already

1. Absolute constant difference.

|OPT – ALG| · c

Examples: Planar graph colouring, edge colouring.

Negative example: maximum independent set.

2. 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).

Negative example: maximum independent set.

3. 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.

Page 56: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

56

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 also.

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.

Page 57: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

57

F(N)-APX

Approximation algorithms - Algorithms and Networks

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 58: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

58

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.

Page 59: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

59

An (ln(n)+1)-approximation algorithm for set cover

Theorem:

The greedy set cover algorithm is an (ln(n)+1)-approximation.

Proof:

1. The algorithm runs in polynomial time and returns a set cover.

2. Let Si be the ith set from F picked by the algorithm.

3. 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:

4. ...

Page 60: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

60

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.

Page 61: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

61

Bounding the cost of any set S

What remains is to prove that for any S 2 F:

Remind:

If x firstly covered by Si, then cx = 1/|Xi|

Where: Xi = Si \ (S1 [ S2 [ ... [ Si-1)

For any S 2 F, let ui be the number of uncovered items in S

when the algorithm selects Si.

Take the smallest value k s.t. uk = 0.

With the last equality due to the selection by the algorithm.

Then...

Page 62: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

62

Bounding the cost of any set S

To prove:

Last slide:

Thus:

Remind:

Q.E.D.

Page 63: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

63

CONCLUSIONAPPROX. ALGORITHMS

Approximation algorithms - Algorithms and Networks

Page 64: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

64

Conclusion

Qualities of polynomial-time approximation algorithms:

1. Absolute constant difference.

Planar graph colouring.

2. FPTAS: Fully polynomial-time approximation scheme.

Scaling for Knapsack.

3. PTAS: Polynomial-time approximation scheme.

4. APX: Constant-factor approximation.

TSP with triangle inequality.

(Weighted) vertex cover.

5. f(n)-APX: Approximation by a factor of f(n).

Set cover.

Page 65: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

65

Approximation Complexity

Algorithms and Networks 2017/2018

Johan M. M. van Rooij

Hans L. Bodlaender

Page 66: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

66

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.

Page 67: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

67

How to prove that an algorithm from one of the categories does not exist?

Qualities of polynomial-time approximation algorithms:

1. Absolute constant difference.

2. FPTAS: Fully polynomial-time approximation scheme.

3. PTAS: Polynomial-time approximation scheme.

4. APX: Constant-factor approximation.

5. 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?

Page 68: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

68

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.

Thereafter:

A recap on NP-Completeness.

APX and APX-Completeness.

And, some more in maximum independent set.

Page 69: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

69

THE GAP TECHNIQUE

Approximation algorithms - Algorithms and Networks

Page 70: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

70

The gap technique

The gap technique:

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:

1. Take instance G=(V,E) of Hamiltonian Circuit.

2. 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.

3. A finds a tour with distance at most nc, if and only if, G has a Hamiltonian circuit.

Page 71: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

71

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:

1. One to prove non-existence of absolute constant difference approximation of independent set (second lecture)

2. One to prove non-existence of constant-factor approximation of TSP without triangle inequality.

Page 72: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

72

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.

Page 73: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

73

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:

1. Take an instance of knapsack.

2. Multiply the value of all items by c+1.

3. This does not change the set of feasible solutions.

4. However, the only solution with a difference in value of at most c from the optimal solution, is the optimal solution itself.

5. An absolute constant difference approximation will thus solve this knapsack instance optimally, contradicting the assumption P NP.

Page 74: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

74

THE POLYNOMIAL-BOUND TECHNIQUE

Approximation algorithms - Algorithms and Networks

Page 75: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

75

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.

1. 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.

2. Let ² = 1/p(n) and run the algorithm.

The algorithm uses polynomial time.

The algorithm solves the problem optimally as:

3. Hence, no such algorithm exists unless P=NP.

Page 76: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

76

THE ROAD TO APX-COMPLETENESS

Approximation algorithms - Algorithms and Networks

Page 77: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

77

How to prove that an algorithm from one of the categories does not exist?

What we have seen:

The gap technique.

The polynomial-bound technique.

The rest of this lecture:

Proving that no PTAS exists for some problems by proving APX-completeness.

Proving that a problem does not belong to APX.

Qualities of poly-time approximation algorithms:

1. Absolute constant difference.

2.FPTAS: Fully polynomial-time approximation scheme.

3.PTAS: Polynomial-time approximation scheme.

4.APX: Constant-factor approximation.

5.f(n)-APX: Approximation by a factor of f(n).

Page 78: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

78

The remaining topics for 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 PNP.

Page 79: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

79

A RECAP ONNP-COMPLETENESS

Approximation algorithms - Algorithms and Networks

Page 80: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

80

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.

Page 81: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

81

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.

Lemma:

If P1 P P2 and P2 P P3 then: P1 P P3.

Reductions can be composed together.

Page 82: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

82

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:

All problems in NP are polynomial-time reducible to P.

Page 83: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

83

Proving that ‘most likely’ no polynomial-time algorithms exist

NP-complete/NP-hard problems ‘most likely’ have no polynomial-time algorithms.

We often assume PNP.

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.

Page 84: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

84

APX ANDAPX-COMPLETENESS

Approximation algorithms - Algorithms and Networks

Page 85: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

85

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 problem 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.

Page 86: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

86

L-reduction

P1 is L-reducible to P2 (P1 L P2) if there exist:

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:

1. f and g are computable in polynomial-time computable.

2. For any instance x of P1: OPT( f(x) ) · a ¢ OPT(x).

3. 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.

Page 87: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

87

L-reduction

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 make it work for max en min problems:

1. VAL(g(y)) - OPT(x) · b ( VAL(y) - OPT(f(x)) )[by def part 3]

2. · b ( (1+epsilon) OPT f(x) - OPT(f(x)) ) [by def PTAS]

3. · b epsilon OPT f(x) [simplify]

4. · b epsilon a OPT(x) [by def part 2]

Thus a (1 + b epsilon a)-approximation as:

VAL(g(y)) - OPT(x) · b epsilon a OPT(x)

VAL(g(y)) · ( 1 + b epsilon a ) OPT(x)

Page 88: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

88

L-reduction

P1 is L-reducible to P2 (P1 L P2) if there exist:

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:

1. f and g are computable in polynomial-time computable.

2. For any instance x of P1: OPT( f(x) ) · a ¢ OPT(x).

3. 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.

Page 89: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

89

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.

PNP implies PTAS APX.

Page 90: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

90

NP-completeness and APX-completeness

NP-completeness

1. NP-complete: if one problem is polynomial-time solvable, then all are.

2. Polynomial-time reductions.

3. Cook’s theorem: SAT is NP-complete.

APX-completeness

1. APX-complete: if one problem has a PTAS, then all have.

2. L-reductions.

3. PCP theorem implies Max 3-SAT is APX-complete.

Page 91: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

91

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:

1. For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I).

2. For any instance x of P1 and any solution y of f(x):|OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|.

Page 92: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

92

Example L-reduction

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).

Transformation g: restrict the truth assignment to the original variables.

a=13, b=1.

1. For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I).

OPT(f(I)) = 6|C| + OPT(I) · 12 OPT(I) + OPT(I) = 13 OPT(I)

1. OPT(f(I)) = 6|C| + OPT(I) follows from truth tables.

2. 6|C| · 12 OPT(I) because the optimum always satisfies half the

clauses.

2. For any instance x of P1 and any solution y of f(x):|OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|.

|OPT(x) – VAL(g(y))| = |OPT(f(x)) – VAL(y)|, the transformation goes from 1 true clause to 7 or from 0 to 6 (truth tables)

Page 93: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

93

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.

Page 94: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

94

INAPPROXIMABILITY OF MAX INDEPENDENT SET

Approximation algorithms - Algorithms and Networks

Page 95: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

95

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.

Page 96: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

96

L-reduction from max 2-SAT tomaximum 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:

1. For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I).

2. For any instance x of P1 and any solution y of f(x):|OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|.

Page 97: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

97

L-reduction from max 2-SAT tomaximum independent set

Transformation f:

Replace clause (x,y) by 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.

1. For any instance I of P1: OPT( f(I) ) · a ¢ OPT(I).

In f(I) we can choose vertices corresponding to a truth assignment, or choose less vertices, never more.

2. For any instance x of P1 and any solution y of f(x):|OPT(x) – VAL(g(y))| · b ¢ |OPT(f(x)) – VAL(y)|.

OPT(x) = OPT(f(x)).

VAL(g(y)) ¸ VAL(y), as we may have some unassigned variables.

Page 98: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

98

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.

Page 99: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

99

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:

1. Given a graph G, we construct G x G:

1. It has nodes (u,v) corresponding to tuples of vertices from G.

2. It has edge (u,v)-(u’,v’) iff:

• u = u’, and (v,v’) an edge in G.

• (u,u’) an edge in G.

2. Claim G has an independent set of size k, if and only if, G x G has an independent set of size k2.

3. Run the c-approximation on G x G with result J:

1. The result in G x G has OPT2 · c |J|.

2. Thus in G: √OPT · √c √|J|

Page 100: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

100

Proof of claim

Claim:

G has an independent set of size ¸ k, if and only if, G x G has an independent set of size ¸ k2.

Proof:

1. Given an independent set I in G of size k, we construct one in G x G of size k2 by taking all (v,u) for v 2 I and u 2 I.

2. Let J be an independent set in G x G of size ¸ k2.

1. Consider all u with (u,v) 2 J.

2. If these vertices form an independent set of size ¸ k in G then

we are done.

3. Otherwise, there are less than k different such u.

4. So for at lease one fixed u, there must be more than k different (u,v) 2 J.

5. These vertices v form an independent set in G of size ¸ k.

Page 101: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

101

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.

Corollary:

Maximum independent set is not in APX.

It has no PTAS assuming PNP, hence also no c-approximation.

Page 102: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

102

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.

Page 103: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

103

CONCLUSION

Approximation algorithms - Algorithms and Networks

Page 104: Introduction to Approximation Algorithms - Utrecht University · Approximation algorithms are one of these options. An approximation algorithm is a heuristic with a performance guarantee

104

Conclusion on approximation

Qualities of polynomial-time approximation algorithms:

1. Absolute constant difference.

2. FPTAS: Fully polynomial-time approximation scheme.

3. PTAS: Polynomial-time approximation scheme.

4. APX: Constant-factor approximation.

5. 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.