Lecture8_Approximation-Algorithms
Lecture8_Approximation-Algorithms
FACULTY OF ENGINEERING
COMPUTER ENGINEERING DEPARTMENT
ZPP algorithms are also Las Vegas algorithms that do not make false statements, but that can
also stop without making a decision - with the output "?" ("No idea").
A simple example:
The language 𝐿 ⊆ Σ ∗ belongs to the class BPP if and only if there exists a polynomial,
#
randomized algorithm 𝐴 and an 𝜖, 0 < 𝜖 < $, with
#
(1) for all 𝑤 ∉ 𝐿: Prob [𝐴(𝑤) = 0] ≥ $ + 𝜖,
#
(2) for all 𝑤 ∈ 𝐿 : Prob [𝐴(𝑤) = 1] ≥ $ + 𝜖,
(3) for all 𝑤 ∈ Σ ∗ : time " (𝑤) = O( poly (|𝑤|)).
Approximation Algorithms
1) 𝐴% : Problem instances
𝑉 = {1,2,3, … , 𝑛}, 𝑛 ≥ 0
𝐸 ⊆ 𝑉 𝑥 𝑉 {𝑥, 𝑦} ∈ 𝐸, 𝑥 → 𝑦
Example: 𝑃: The graph coloring problem with the constraint that no adjacent nodes have the
same color. Determine the minimum number of colors!
1) 𝐴% is the set of all undirected graphs 𝐺 = (𝑉, 𝐸) as well 𝑙(𝐺) = |𝑉|.
2) 𝑆% (𝐺) is the set of all valid coloring solutions 𝑓 of 𝐺.
3) 𝑚%) (𝑓) is the number of colors that 𝑓 assigns to the nodes.
4) It is a minimization problem.
Quality criteria:
Let 𝐴(𝑎) be the value of the solution that Algorithm 𝐴 delivers for problem instance a.
Furthermore, let 𝑂𝑃𝑇(𝑎) be the value of the optimal solution 𝑠 ∈ 𝑆% (𝑎).
|+%,(')/"(')|
+%,(')
≤ 𝜀, 𝜀 ≥ 0
(1) Fully approximable, i.e. there is a polynomial ε-approximation for 𝑃 for all ε > 0
(2) Partially approximable, i.e. polynomial ε-approximation is only possible for particular
𝜀-values
(3) Not approximable, i.e. no polynomial ε-approximation is possible => ∄ε
𝑈 ⊆ 𝑉, 𝐸2 ⊆ 𝐸
V1 V2
V1
V2
Example of a complete bipartite graph with 𝑛 = 5 and 𝑚 = 3
Graph Coloring
𝐺 = (𝑉, 𝐸) is k-colorable iff there is a mapping 𝑐: 𝑉 → {1, … , 𝑘 } with (𝑖, 𝑗) ∈ 𝐸 and 𝑐(𝑖) ≠
𝑐(𝑗)
c(𝐺) = 𝑚𝑖𝑛{𝑘 | 𝐺 𝑖𝑠 𝑘 − 𝑐𝑜𝑙𝑜𝑢𝑟𝑎𝑏𝑙𝑒}
ð c(𝐺) is the chromatic number of 𝐺
𝑛
≤ c(𝐺) ≤ 𝑛 − 𝛼(𝐺) + 1
𝛼(𝐺)
2𝑛
≤ c:𝐾6,6 ; ≤ 2𝑛 − 𝛼:𝐾6,6 ; + 1
𝛼:𝐾6,6 ;
2𝑛
≤ 2 ≤ 2𝑛 − 𝑛 + 1
𝑛
2≤2≤𝑛+1
𝐾6∗
𝛼(𝐾6∗ ) = 𝑛
c(𝐾6∗ ) = 𝑛
2𝑛
≤ n ≤ 2𝑛 − 𝑛 + 1
𝑛
2≤𝑛 ≤𝑛+1
Assuming the reverse of the theorem, i.e. 𝐏 ≠ 𝐍𝐏, it follows that there can be no
polynomial algorithm for approximating c(𝐺).
Instead of approximation algorithms, we must use heuristics and analyze them in terms of
their goodness.
è 2 well-known classical heuristic algorithms: Greedy and Johnson Coloring Algorithms
algorithm greedyC o l o r i n g ;
input G = (V, E) : Graph; //V = {1, 2, . . . , n}
output f : [1 . . . max] of int;
color : int;
var counter, color, i, j : int;
f := 0; color := 0; counter := 0;
E D
F G
A
I
H
B C
E D
F G
A
I
H
Example: The following figure illustrates an instance of Vertex Cover problem. An optimal
vertex cover is {b, c, e, i, g}.
Algorithm 1: Approx-Vertex-Cover(G)
C←∅
while E ¹ ∅
pick any {u, v} ∈ E
C ← C ∪ {u, v}
delete all eges incident to either u or v
return C
As it turns out, this is the best approximation algorithm known for vertex cover. It is an open
problem to either do better or prove that this is a lower bound.