algorithm design - heinz nixdorf institut · –if the greedy algorithm stays ahead. show that...
TRANSCRIPT
![Page 1: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/1.jpg)
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 4, 6.5.2011
Lecture today given by Ulf-Peter Schröder
![Page 2: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/2.jpg)
Friedhelm Meyer auf der Heide 2
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Today:
Chapter 3:
Greedy Algorithms
![Page 3: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/3.jpg)
Friedhelm Meyer auf der Heide 3
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity The Greedy Paradigm
![Page 4: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/4.jpg)
Friedhelm Meyer auf der Heide 4
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Greedy is not always optimal
![Page 5: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/5.jpg)
Friedhelm Meyer auf der Heide 5
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity Greedy is not always optimal
![Page 6: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/6.jpg)
Friedhelm Meyer auf der Heide 6
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity …but sometimes
![Page 7: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/7.jpg)
Friedhelm Meyer auf der Heide 7
HEINZ NIXDORF INSTITUTE
University of Paderborn
Algorithms and Complexity …but sometimes
![Page 8: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/8.jpg)
Fundamental Questions
• When did a Greedy Algorithm succeeds in
solving a nontrivial problem optimally?
• How to prove that a Greedy Algorithm
produces an optimal solution to a problem?
06.05.2011 8
![Page 9: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/9.jpg)
06.05.2011 9
The Greedy Method • Greedy as Algorithmic technique can optimally solve an
optimization problem,
– if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other algorithm’s or
– if we can find an exchange argument. Gradually transform any solution to the one found by the greedy algorithm without hurting its quality or
– if the problem has the greedy-choice property. Prove that a globally-optimal solution can always be found by a series of local improvements from a starting configuration or
– if we can define an adequate Matroid for the problem.
![Page 10: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/10.jpg)
06.05.2011 10
Examples
• Activity Selection (or Intervall Scheduling) – Greedy stays ahead
• Scheduling to Minimize Lateness – Exchange Argument
• Theoretical Foundations of the Greedy Method – Matroid Theory
![Page 11: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/11.jpg)
06.05.2011 11
Activity Selection
![Page 12: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/12.jpg)
06.05.2011 12
![Page 13: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/13.jpg)
06.05.2011 13
![Page 14: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/14.jpg)
06.05.2011 14
![Page 15: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/15.jpg)
06.05.2011 15
![Page 16: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/16.jpg)
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
0 1 2 3 4 5 6 7 8 9 10 11
![Page 17: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/17.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 18: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/18.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B C
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 19: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/19.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B A
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 20: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/20.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B E
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 21: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/21.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B E D
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 22: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/22.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B E F
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 23: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/23.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B E G
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 24: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/24.jpg)
0 1 2 3 4 5 6 7 8 9 10 11
B E H
Time 0
A
C
F
B
D
G
E
1 2 3 4 5 6 7 8 9 10 11
H
![Page 25: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/25.jpg)
06.05.2011 25
![Page 26: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/26.jpg)
06.05.2011 26
![Page 27: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/27.jpg)
06.05.2011 27
If one measures the Greedy Algorithm’s progress in a step-by-step fashion, one sees that it does better than any other algorithm at each step (“greedy stays ahead”); it then follows that it produces an optimal solution!
What have we shown ?
![Page 28: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/28.jpg)
06.05.2011 28
Examples
• Activity Selection (or Intervall Scheduling) – Greedy stays ahead
• Scheduling to Minimize Lateness – Exchange Argument
• Theoretical Foundations of the Greedy Method – Matroid Theory
![Page 29: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/29.jpg)
06.05.2011 29
![Page 30: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/30.jpg)
06.05.2011 30
![Page 31: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/31.jpg)
06.05.2011 31
![Page 32: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/32.jpg)
06.05.2011 32
![Page 33: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/33.jpg)
06.05.2011 33
![Page 34: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/34.jpg)
06.05.2011 34
![Page 35: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/35.jpg)
06.05.2011 35
![Page 36: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/36.jpg)
06.05.2011 36
![Page 37: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/37.jpg)
06.05.2011 37
Any possible solution to the problem can be transformed (Exchange Property) into the solution found by the Greedy Algorithm without hurting its quality; it then follows that the greedy algorithm must have found a solution that is at least as good as any other solution!
What have we shown ?
![Page 38: Algorithm Design - Heinz Nixdorf Institut · –if the greedy algorithm stays ahead. Show that after each step of the greedy algorithm, its solution is at least as good as any other](https://reader036.vdocument.in/reader036/viewer/2022081405/5f0aefb77e708231d42e11f0/html5/thumbnails/38.jpg)
Friedhelm Meyer auf der Heide 38
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!