Download presentation

Presentation is loading. Please wait.

1
UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2002 Lecture 2 Tuesday, 9/10/02 Design Patterns for Optimization Problems Greedy Algorithms

2
Algorithmic Paradigm Context

3
Greedy Algorithms

4
What is a Greedy Algorithm? ä Solves an optimization problem ä Optimal Substructure: ä optimal solution contains in it optimal solutions to subproblems ä Greedy Strategy: ä At each decision point, do what looks best “locally” ä Choice does not depend on evaluating potential future choices or solving subproblems ä Top-down algorithmic structure ä With each step, reduce problem to a smaller problem ä Greedy Choice Property: ä “locally best” = globally best

5
Examples ä Minimum Spanning Tree ä Dijkstra Shortest Path ä Huffman Codes ä Fractional Knapsack ä Activity Selection

6
Minimum Spanning Tree

7
A B C D E F G 2 2 1 1 3 4 4 5 6 6 8 7 source: 91.503 textbook Cormen et al. for Undirected, Connected, Weighted Graph G=(V,E) Produces minimum weight tree of edges that includes every vertex. Invariant: Minimum weight spanning forest Becomes single tree at end Invariant: Minimum weight tree Spans all vertices at end Time: O(|E|lg|E|) given fast FIND-SET, UNION Time: O(|E|lg|V|) = O(|E|lg|E|) slightly faster with fast priority queue

8
Dijkstra Shortest Path

9
Single Source Shortest Paths: Dijkstra’s Algorithm source: 91.503 textbook Cormen et al. for (nonnegative) weighted, directed graph G=(V,E) A B C D E F G 2 2 1 1 3 4 4 5 6 6 8 7

10
Huffman Codes

12
Fractional Knapsack

13
50 10 20 30 item1item2item3 “knapsack” Value: $60 $100$120

14
Activity Selection

15
Example Optimization Problem: Activity Selection ä Problem Instance: ä Set S = {1,2,...,n} of n activities ä Each activity i has: ä start time: s i ä finish time : f i ä Activities i, j are compatible iff non-overlapping: ä Objective: ä select a maximum-sized set of mutually compatible activities source: 91.503 textbook Cormen, et al.

17
Algorithmic Progression ä “Brute-Force” ä (board work) ä Dynamic Programming #1 ä Exponential number of subproblems ä (board work) ä Dynamic Programming #2 ä Quadratic number of subproblems ä (board work) ä Greedy Algorithm ä (board work)

18
Running time? Greedy Algorithm ä Algorithm: ä S’ = presort activities in S by nondecreasing finish time ä and renumber ä GREEDY-ACTIVITY-SELECTOR(S’) ä n length[S’] ä A {1} ä j1 ä for i 2 to n ä do if ä then ä j i ä return A source: 91.503 textbook Cormen, et al.

19
Additional Examples On course web site under Miscellaneous Docs ä Patriotic Tree ä 404 review handout ä Tree Vertex Cover ä 91.503 midterm

20
Greedy Heuristic ä If optimization problem does not have “greedy choice property”, greedy approach may still be useful as a heuristic in bounding the optimal solution ä Example: minimization problem Optimal (unknown value) Upper Bound (heuristic) Lower Bound Solution Values

21
New Research in Dynamic Channel Assignment [GLOBECOM 2001, IEEE VT submission] ä Input: ä Number of time periods ä 7 x 7 square cell grid ä Set of channels ä Co-channel interference threshold B = 27234 ä Demand for each time period ä Output: ä For each time period ä Feasible assignment of channels to cells satisfying: ä Demand model ä Co-channel interference constraints ä (SignalStrength/Interference) > B ä Computation time limit ä Minimize number of channels used ä Minimize reassignments across time solution assumes no channel repetition within any 2 x 2 square Sample solution for 1 time period Demand Assignment 5 different channels are used Joint work with Prof. Chandra, graduate students S. Liu, S.Widhani

22
Homework 1 T 9/3 T 9/10 91.404 review & Chapter 15 2 T 9/10 T 9/17 Chapter 16 HW# Assigned Due Content

Similar presentations

© 2021 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google