UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2002 - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2002

Description:

At each decision point, do what looks best 'locally' ... Patriotic Tree. 404 review handout. Tree Vertex Cover. 91.503 midterm. Greedy Heuristic ... – PowerPoint PPT presentation

Number of Views:61
Avg rating:3.0/5.0
Slides: 23
Provided by: murrayd
Learn more at: https://www.cs.uml.edu
Category:

less

Transcript and Presenter's Notes

Title: UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Fall, 2002


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
Minimum Spanning Tree
Time O(ElgE) given fast FIND-SET, UNION
Produces minimum weight tree of edges that
includes every vertex.
Time O(ElgV) O(ElgE) slightly faster
with fast priority queue
for Undirected, Connected, Weighted Graph
G(V,E)
source 91.503 textbook Cormen et al.
8
  • Dijkstra Shortest Path

9
Single Source Shortest Paths Dijkstras
Algorithm
for (nonnegative) weighted, directed graph G(V,E)
source 91.503 textbook Cormen et al.
10
  • Huffman Codes

11
Huffman Codes
12
  • Fractional Knapsack

13
Fractional Knapsack
50
Value 60 100 120
30
20
10
knapsack
item1
item2
item3
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 si
  • finish time fi
  • 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.
16
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
Greedy Algorithm
source 91.503 textbook Cormen, et al.
  • Algorithm
  • S presort activities in S by nondecreasing
    finish time
  • and renumber
  • GREEDY-ACTIVITY-SELECTOR(S)
  • n lengthS
  • A 1
  • j 1
  • for i 2 to n
  • do if
  • then
  • j i
  • return A

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

Upper Bound (heuristic)
Solution Values
Optimal (unknown value)
Lower Bound
21
New Research in Dynamic Channel Assignment
GLOBECOM 2001, IEEE VT submission
Joint work with Prof. Chandra, graduate students
S. Liu, S.Widhani
  • 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) gt B
  • Computation time limit
  • Minimize number of channels used
  • Minimize reassignments across time

Demand
Sample solution for 1 time period
Assignment
5 different channels are used
solution assumes no channel repetition within any
2 x 2 square
22
Homework
HW Assigned Due Content
  • 1 T 9/3 T 9/10 91.404 review
    Chapter 15
  • 2 T 9/10 T 9/17 Chapter 16
Write a Comment
User Comments (0)
About PowerShow.com