Friedhelm Meyer auf der Heide 1
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity
Welcome to the course
Algorithm Design
Summer Term 2011
Friedhelm Meyer auf der Heide
Lecture 6, 20.5.2011
Friedhelm Meyer auf der Heide 2
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Topics
- Divide & conquer
- Dynamic programming
- Greedy Algorithms
- Approximation Algorithms
- Randomized Algorithms
- Online Algorithms
Friedhelm Meyer auf der Heide 3
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity
For which problems are Greedy-Algorithms
optimal?
Consider a finite set E and a system U of subsets of E. (E,U) is called a
subset-system, if the following holds:
(i) ? 2 U
(ii) For each B 2 U, also each subset of B is in U.
B2 U is called maximal, if no proper superset of B is in U.
The Optimization problem corresponding to (E,U) is :
Given a weight function w:E Q+ ,compute a maximal set B 2 U with
maximizes w(B) = §e2 B w(e).
(Minimization problems are described analogously.)
Friedhelm Meyer auf der Heide 4
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity
Subset-Systems and the
Canonical Greedy-Algorithm
Canonical Greedy ((E,U))
(1) Sort E such that w(e1) ¸ … ¸ w(en).
(2) B ?.
(3) For k=1 to n
if B [ {ek} 2 U then B B [ {ek}
(4) Return B
Friedhelm Meyer auf der Heide 5
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Greedy-Algorithms und Matroids
A system of subsets (E,U) is a matroid, if in addition, the following
exchange property holds:
(iii) For all A,B 2 U with |A|<|B|, there is x2 B-A such that A[{x} 2 U.
Remark: All maximal sets of a matroid have the same size. (homework)
Theorem: Consider a system of subsets (E,U). Canonical Greedy is optimal
for (E,U) for every weight function w, if and only if (E,U) is a matroid.
Friedhelm Meyer auf der Heide 6
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Matroids and the canonical Greedy Algorithm
Theorem: Consider a system of subsets (E,U). Canonical Greedy is optimal
for (E,U) for every weight function w, if and only if (E,U) is a matroid.
Proof:
“(”: Consider a matroid (E,U) and a weight function w.
Let w(e1)¸ …¸ w(en).
- Consider an optimal solution T’={ei1, …, eik
}.
- Assume the solution T={ej1, …, ejk
} found by Canonical Greedy were not
optimal, i.e. w(T’)> w(T).
- Then there is an index p with w(eip) > w(ejp
). Let p be minimal with this
property. Note that ip < jp, because the items are sorted w.r.t weight.
- Apply the exchange property to A = {ej1, …,ejp-1
} and B ={ei1, …, eip
} :
As |A| < |B|, there is eiq 2 B-A with A [ {eiq
} 2 U.
- As w(eiq ) ¸ w(eip
) > w(ejp), Canonical Greedy would have chosen eiq
before
ejp , a contradiction.
Friedhelm Meyer auf der Heide 7
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Matroids and the canonical Greedy Algorithm
Theorem: Consider a system of subsets (E,U). Canonical Greedy is optimal for (E,U) for every weight function w, if and only if (E,U) is a matroid.
Proof:
“)”: Assume that, for some A,B 2 U with |A|<|B|, it holds that A[{e} is not in U, for every e2B-A.
Let |B|=r and consider the weight function w with
- w(e) = r+1 for e2A
- w(e) = r for e2B-A
- w(e) = 0 else
Then, Canonical Greedy would select a solution T with T µ A and T Å (B-A) =?.
As w(T)=|A|(r+1) · (r-1)(r+1)· r2 -1, T is not optimal, because B is a solution with larger weight |B|r = r2.
Friedhelm Meyer auf der Heide 8
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Topics
- Divide & conquer
- Dynamic programming
- Greedy Algorithms
- Approximation Algorithms
- Randomized Algorithms
- Online Algorithms
23.05.2011 9
23.05.2011 10
Approximation Algorithms
• Greedy Techniques – Load-Balancing Problem
– Center Selection Problem
• Pricing Method – Vertex Cover Problem
• Linear Programming and Rounding – Vertex Cover Problem
– Generalized Load-Balancing Problem
• Polynomial Time Approximation Scheme – Knapsack Problem
23.05.2011 11
23.05.2011 12
Load Balancing: List Scheduling
A D
F
B C E
Machine 3
Machine 2
Time 0
Machine 1
I H J
G
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
D
F
B C E
Time 0
I H J
G
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
D
F
B
C E
Time 0
I H J
G
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
D
F
B
C
E
Time 0
I H J
G
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
E
Time 0
I H J
G
D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
E
Time 0
I H J
G
D
G
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
E
Time 0
I H J
D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
E
Time 0
I H J
G D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
E
Time 0
I
H
J
G D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
G
E
Time 0
I H
J
G D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
F
B
C
G
E
Time 0
I H
J
D
Machine 3
Machine 2
Machine 1
Load Balancing: List Scheduling
A
D
F
B
C
G
E
0
I H
J
Machine 3
Machine 2
Machine 1
A
D
F
B C
G
E
0
I
H
J
Optimal Schedule
List schedule
23.05.2011 25
1.
2.
23.05.2011 26
23.05.2011 27
23.05.2011 28
23.05.2011 29
23.05.2011 30
23.05.2011 31
23.05.2011 32
23.05.2011 33
Approximation Algorithms
• Greedy Techniques – Load-Balancing Problem
– Center Selection Problem
• Pricing Method – Vertex Cover Problem
• Linear Programming and Rounding – Vertex Cover Problem
– Generalized Load-Balancing Problem
• Polynomial Time Approximation Scheme – Knapsack Problem
23.05.2011 34
23.05.2011 35
23.05.2011 36
23.05.2011 37
23.05.2011 38
23.05.2011 39
23.05.2011 40
Approximation Algorithms
• Greedy Techniques – Load-Balancing Problem
– Center Selection Problem
• Pricing Method – Vertex Cover Problem
• Linear Programming and Rounding – Vertex Cover Problem
– Generalized Load-Balancing Problem
• Polynomial Time Approximation Scheme – Knapsack Problem
23.05.2011 41
23.05.2011 42
23.05.2011 43
23.05.2011 44
23.05.2011 45
Friedhelm Meyer auf der Heide 46
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity
Friedhelm Meyer auf der Heide
Heinz Nixdorf Institute
& Computer Science Department
University of Paderborn
Fürstenallee 11
33102 Paderborn, Germany
Tel.: +49 (0) 52 51/60 64 80
Fax: +49 (0) 52 51/62 64 82
E-Mail: [email protected]
http://www.upb.de/cs/ag-madh
Thank you for
your attention!