Lecture 9: Greedy Algorithms
Daniel Frances c
±
2012
Contents
1 Greedy Algorithms
2
1.1
The Set Covering problem .
. . . . . . . . . . . . . . . . . . . . . . . . . . .
2
1.1.1
An Integer Programming model .
. . . . . . . . . . . . . . . . . . . .
2
1.1.2
A Greedy Approach
. . . . . . . . . . . . . . . . . . . . . . . . . . .
3
1.1.3
How bad can the Greedy Approach be? .
. . . . . . . . . . . . . . . .
5
1.2
The Minimum Spanning Tree problem .
. . . . . . . . . . . . . . . . . . . .
6
1.2.1
Kruskall’s Greedy algorithm .
. . . . . . . . . . . . . . . . . . . . . .
7
1
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document1
Greedy Algorithms
You may recall in the Simplex method that the entering variable is the variable which, if
entered, will give the greatest boost to the objective function. This is called a greedy policy.
In real life we know that maximizing short term gains can be a very poor policy for long term
success. In the case of the LP, we also know that selecting the variable with the largest
z
j

c
j
coeﬃcient will not necessarily allow us to ﬁnd the optimal solution in the fastest possible
way, but it does yield the optimal solution. In general, the greedy approach sometimes
•
is totally useless, and even dangerous  like smoking, over eating, and drugs.
•
is the best polynomial time algorithm, e.g. for the minimal set covering problem.
•
yields the optimal solution, e.g. for solving the minimum spanning tree problem.
Since the downsides of greedy policies most often outweigh their upsides, these policies should
never be pursued blindly. At the same time, it is worth knowing about their successes so
they can be used when circumstances support it. We will illustrate its use in solving the Set
Covering problem.
1.1
The Set Covering problem
Suppose we have a number of towns located in a rural area, and that we are not satisﬁed
with the current locations of the schools serving the students in these towns. We want to
look at the problem from scratch, willing to close down and build new schools if need be.
We want to have the least number of schools to serve all the students in the towns shown in
Figure 10, located in towns such that there is school located within a 30Km radius of each
town. By overlaying the circle with the X in the middle over each town, we can see which
towns are entirely located within the circle and thus covered by the school. So for example
a schools at C would cover students in towns A, B, C and D.
Thus we wish to know the minimum number of schools and the towns where they should be
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '12
 Frances
 Linear Programming, Optimization, Greedy algorithm, C D E F G H I J K L M

Click to edit the document details