Download presentation

Presentation is loading. Please wait.

Published byStacy Abby Modified over 3 years ago

1
UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Spring, 2005 Lecture 1 (Part 2) “How to Make an Algorithm Sandwich” adapted from the fall, 2000 talk Finding the Largest Area Axis-Parallel Rectangle in a Polygon in O(n log 2 n) Time given at UMass Lowell MATHEMATICAL SCIENCES COLLOQUIUM

2
Context: Taxonomy of Problems Supporting Apparel Manufacturing OrderedContainment Geometric Restriction Distance-BasedSubdivision MaximumRectangle Limited Gaps MinimalEnclosure Column-Based Layout Two-Phase Layout LatticePacking Containment Maximal Cover

3
A Common (sub)Problem Find a Good Approximation Outer Inner

4
ä Given a 2D polygon that: ä does not intersect itself ä may have holes ä has n vertices ä Find the Largest-Area Axis-Parallel Rectangle ä How “hard” is it? ä How “fast” can we find it? What’s the Problem?

5
ä Explore the problem to gain intuition: ä Describe it: What are the assumptions? (model of computation, etc...) ä Has it already been solved? ä Have similar problems been solved? ( more on this later ) ä What does best-case input look like? ä What does worst-case input look like? ä Establish worst-case upper bound on the problem using an algorithm ä Design a (simple) algorithm and find an upper bound on its worst-case asymptotic running time; this tells us problem can be solved in a certain amount of time. Algorithms taking more than this amount of time may exist, but won’t help us. ä Establish worst-case lower bound on the problem ä Tighten each bound to form a worst-case “sandwich” Approach increasing worst-case asymptotic running time as a function of n n 1 2n2n2n2n n2n2n2n2 n3n3n3n3 n4n4n4n4 n5n5n5n5

6
Upper Bound First Attempt

7
Designing an Algorithm to Provide Upper Bound Contacts reduce degrees of freedom ä First attempt uses a straightforward approach: ä “brute-force” ä “naïve” ä Will most likely produce a “loose” upper bound ä Characterize rectangle based on how it can “grow”

8
O(n 5 ) LR Algorithm Find_LR(Polygon P) area0 Find_LR_0_RC(P) area0 Find_LR_0_RC(P) area1 Find_LR_1_RC(P) area1 Find_LR_1_RC(P) area2 Find_LR_2_RC(P) area2 Find_LR_2_RC(P) area3 Find_LR_3_RC(P) area3 Find_LR_3_RC(P) area4 Find_LR_4_RC(P) area4 Find_LR_4_RC(P) return maximum(area0, area1, area2, area3, area4) return maximum(area0, area1, area2, area3, area4)Find_LR_0_RC(P) for i 1 to n (for each edge of P) for j 1 to n for j 1 to n for k 1 to n for k 1 to n for l 1 to n for l 1 to n area area of LR for 0-RC determining set for (i,j,k,l) area area of LR for 0-RC determining set for (i,j,k,l) if LR is empty, then update maximum area if LR is empty, then update maximum area return maximum area return maximum area O(n) O(n 5 )

9
First Upper Bound: What can we really conclude? ä Algorithm’s worst-case running time is in O(n 5 ). ä Problem can be solved in O(n 5 ) time, even for worst-case inputs. ä Note: there might exist algorithms for this problem that take more than n 5 time, but they aren’t useful to us! If a worst-case input exists that causes algorithm to actually use time proportional to n 5, then algorithm’s worst-case running time is also in (n 5 ). In this case, we can say algorithm’s worst-case running time is in (n 5 ). n 1 n2n2n2n2 2n2n2n2n n5n5n5n5 increasing worst-case asymptotic running time as a function of n An inefficient algorithm for the problem might exist that takes this much time, but would not help us.

10
Lower Bound First Attempt n 1 n2n2n2n2 2n2n2n2n n5n5n5n5 increasing worst-case asymptotic running time as a function of n An inefficient algorithm for the problem might exist that takes this much time, but would not help us.

11
First Attempt ä First attempt will most likely produce a “loose” lower bound that can be improved later. (1) and (n) are not hard to achieve: Rationale for (n) is that we must examine every vertex at least once in order to solve the problem. This holds for every algorithm that solves the problem, so it gives us a lower bound on the problem in an even stronger sense than our upper bound. ä Remember that our upper bound does not guarantee that no algorithm exists for this problem that takes more than O(n 5 ) time, but if one exists it will not help us! n 1 2n2n2n2n n5n5n5n5 worst-case bounds on problem on problem An inefficient algorithm for the problem might exist that takes this much time, but would not help us. No algorithm for the problem exists that can solve it for worst-case inputs in less than linear time.

12
Know the Difference! n 1 2n2n2n2n n5n5n5n5 worst-case bounds on problem on problem An inefficient algorithm for the problem might exist that takes this much time, but would not help us. No algorithm for the problem exists that can solve it for worst-case inputs in less than linear time. Strong Bound: This worst-case lower bound on the problem holds for every algorithm that solves the problem and abides by our problem’s assumptions. Weak Bound: This worst-case upper bound on the problem comes from just considering one algorithm. Other, less efficient algorithms that solve this problem might exist, but we don’t care about them! Both the upper and lower bounds are probably loose (i.e. probably can be tightened later on).

13
Upper Bound Tightening It

14
ä Think harder… ä Design an algorithm that takes only O(n 2 ) time for worst-case inputs Approach 1 2n2n2n2n n5n5n5n5 n worst-case bounds on problem on problem n2n2n2n2 Now we no longer care about this one! tighter upper bound

15
ä Think even harder… ä Run into brick wall! ä Characterize the brick wall: this type of case ä Go around brick wall by looking at similar problems. ä This requires ability to compare functions! Approach (continued) n 1 2n2n2n2n n5n5n5n5 worst-case bounds on problem on problem n2n2n2n2

16
Some Related Problems n 1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 n (n) log(n) n (n)

17
Some Related Problems (continued) n 1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 n (n) log(n) n (n)

18
ä Reduce the O(n 2 ) bound to O(n log 2 n): ä Adapt a technique that worked for a similar problem in order to develop a general framework for the problematic case Approach (continued) n 1 2n2n2n2n n5n5n5n5 worst-case bounds on problem on problem n2n2n2n2 n log 2 n

19
Lower Bound Tightening It

20
Approach ä Go around lower bound brick wall by: ä examining strong lower bounds for some similar problems ä transforming a similar problem to our problem [this process is similar to what we do when we prove problems NP-complete] n 1 2n2n2n2n n5n5n5n5 worst-case bounds on problem on problem n2n2n2n2 n log 2 n

21
Lower Bounds for Related Problems n1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 SmallestOuterRectangle: (n) SmallestOuterCircle: (n) LargestInnerRectangle: (n) LargestInnerCircle: (n log n) point set, polygon point set polygon LargestInnerRectangle: (n log 2 (n))polygon worst-case bounds on our problem Largest circle containing no points of the set & whose center is in convex hull of the points

22
Lower Bound of (n log n) by Transforming a ( seemingly unrelated ) Problem MAX-GAP instance: given n real numbers { x 1, x 2,... x n } find the maximum difference between 2 consecutive numbers in the sorted list. O(n) time transformation specialized polygon x2x2x2x2 x4x4x4x4 x3x3x3x3 x1x1x1x1 Rectangle area is a solution to the MAX-GAP instance Rectangle algorithm must take as least as much time as MAX-GAP. MAX-GAP is known to be in (n log n). Rectangle algorithm must take (n log n) time for specialized polygons. [Transforming yet another different problem yields bound for unspecialized polygons.]

23
ä First attempt: ä Establish weak (and loose) worst-case upper bound on the problem using an algorithm ä Establish strong (and loose) worst-case lower bound on the problem ä Tighten bounds to make an “algorithm sandwich” ä Establish weak (but tighter) worst-case O(n log 2 n) upper bound on the problem using an algorithm ä Establish strong (and tighter) worst-case lower bound on the problem by transforming a problem with known lower bound Summary n1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 bounds on problem

24
Recent Improvement! ä “Finding the Largest Axis-Aligned Rectangle in a Polygon in O(n log n) Time” ä Ralph Boland, Jorge Urrutia ä Canadian Conference on Computational Geometry, August 13-15, 2001 n1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 bounds on problem n1 n log(n) n log 2 (n) 2n2n2n2n n5n5n5n5 Tight bound on problem

25
For More Information ä Computational Geometry: ä Graduate CS course in Computational Geometry offered at UMass Lowell in Spring ’01, Spring ‘04 ä Introductory texts: ä Computational Geometry in C (O’Rourke) ä Computational Geometry: An Introduction (Preparata & Shamos) ä Bibliography: ftp://ftp.cs.usask.ca/pub/geometry/ ä Software:http://www.geom.umn.edu/software/cglist/ ä My research: ä http://www.cs.uml.edu/~kdaniels http://www.cs.uml.edu/~kdaniels ä Journal paper: “Finding the largest area axis-parallel rectangle in a polygon” ä (Computational Geometry: Theory and Applications) ä Prof. Victor Milenkovic: Frequent co-author and former PhD advisor ä http://www.cs.miami.edu/~vjm http://www.cs.miami.edu/~vjm

Similar presentations

OK

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Spring, 2003 Review Lecture Tuesday, 5/6/03.

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Spring, 2003 Review Lecture Tuesday, 5/6/03.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on microcontroller based traffic light controller Ppt on eddy current drive Ppt on brain computer interface Ppt on entrepreneurship development cycle Ppt on religion and science Ppt on statistics in maths games Ppt on series and parallel combination of resistors in series Mp ppt online application form Ppt on cardiac arrest Ppt on next generation 2-stroke engine repair