Be Skeptical of Greedy Algorithms

  • Often for optimization problems (minimize/maximize)
  • Hard to argue for correctness
  • Works well for approximating optimal solutions
    • When the correct algorithm is intractable (), then often the greedy solution that is is useful (=tractable)
  • Gradient descent is a greedy optimization algorithm.
    • Linear optimization algorithms are “analytical” and correct, but take lots of time.
    • Gradient descent algorithms (all of ML) is greedy, but not the global optimum solution. They’re “good enough” and “tractable”

Proof of Correctness

  1. Feasibility: there is an algorithm that gives a solution that obeys the constraints of the problem
  2. Optimality: the algorithm’s solution is the best possible. Use either:
    1. Proof by Contradiction
      1. Let solution by greedy algorithm solution .
      2. Assume there is a more optimal solution
      3. Then derive a contradiction
    2. Exchange Argument
      1. Let solution by greedy algorithm solution
      2. Assume there is a optimal solution
      3. By exchanging individual elements which don’t reduce optimality, slowly show is at least as good as
    3. Staying Ahead
      1. At every stage of the greedy algorithm, show that it is at least as good as the optimal solution

Examples