Download presentation
Presentation is loading. Please wait.
Published byTeodora Orsini Modified over 5 years ago
1
UMass Lowell Computer Science 91. 503 Analysis of Algorithms Prof
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 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 log2 n) Time given at UMass Lowell MATHEMATICAL SCIENCES COLLOQUIUM I joined the UMass Lowell Computer Science faculty this summer. This collection of slides is intended to familiarize the reader/viewer with my field of research (Computational Geometry), summarize my previous research results in this field and outline my plan for Computational Geometry research at UMass Lowell.
2
Context: Taxonomy of Problems Supporting Apparel Manufacturing
Maximum Rectangle Geometric Restriction Distance-Based Subdivision Containment Limited Gaps Ordered Containment Maximal Cover Minimal Enclosure Core Algorithms Application-Based Algorithms Column-Based Layout Two-Phase Layout Lattice Packing
3
A Common (sub)Problem Find a Good Approximation Outer Inner
4
What’s the Problem? 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?
5
Approach 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” n 1 2n n2 n3 n4 n5 increasing worst-case asymptotic running time as a function of n
6
Upper Bound First Attempt
7
Designing an Algorithm to Provide Upper Bound
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” Contacts reduce degrees of freedom
8
O(n5) LR Algorithm Find_LR(Polygon P) area0 Find_LR_0_RC(P)
return maximum(area0, area1, area2, area3, area4) Find_LR_0_RC(P) for i to n (for each edge of P) for j to n for k to n for l to n area area of LR for 0-RC determining set for (i,j,k,l) if LR is empty, then update maximum area return maximum area O(n) O(n5)
9
First Upper Bound: What can we really conclude?
Algorithm’s worst-case running time is in O(n5). Problem can be solved in O(n5) time, even for worst-case inputs. Note: there might exist algorithms for this problem that take more than n5 time, but they aren’t useful to us! If a worst-case input exists that causes algorithm to actually use time proportional to n5, then algorithm’s worst-case running time is also in W(n5). In this case, we can say algorithm’s worst-case running time is in Q(n5). An inefficient algorithm for the problem might exist that takes this much time, but would not help us. 1 n n2 n5 2n increasing worst-case asymptotic running time as a function of n
10
Lower Bound First Attempt 1 n n2 n5 2n
An inefficient algorithm for the problem might exist that takes this much time, but would not help us. 1 n n2 n5 2n increasing worst-case asymptotic running time as a function of n
11
First Attempt First attempt will most likely produce a “loose” lower bound that can be improved later. W(1) and W(n) are not hard to achieve: Rationale for W(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(n5) time, but if one exists it will not help us! n 1 2n n5 worst-case bounds 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! 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! n 1 2n n5 worst-case bounds 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 . Both the upper and lower bounds are probably loose (i.e. probably can be tightened later on).
13
Upper Bound Tightening It
14
Approach Think harder…
Design an algorithm that takes only O(n2) time for worst-case inputs tighter upper bound 1 n worst-case bounds on problem n2 n5 2n Now we no longer care about this one!
15
Approach (continued) 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! n 1 2n n5 worst-case bounds on problem n2
16
Some Related Problems n 1 n log(n) n log2(n) 2n n5 n a(n) log(n)
17
Some Related Problems (continued)
1 n log(n) n log2(n) 2n n5 n a(n) log(n) n a(n)
18
Approach (continued) Reduce the O(n2) bound to O(n log2 n):
Adapt a technique that worked for a similar problem in order to develop a general framework for the problematic case n 1 2n n5 worst-case bounds on problem n2 n log2 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] worst-case bounds on problem 1 n log2 n n2 n5 2n n
21
Lower Bounds for Related Problems
SmallestOuterRectangle: Q (n) SmallestOuterCircle: Q (n) point set, polygon LargestInnerRectangle: W (n) polygon LargestInnerCircle: Q (n log n) point set Largest circle containing no points of the set & whose center is in convex hull of the points LargestInnerRectangle: O (n log2(n)) polygon n 1 n log(n) n log2(n) 2n n5 worst-case bounds on our problem
22
Lower Bound of W(n log n) by Transforming a (seemingly unrelated) Problem
MAX-GAP instance: given n real numbers { x1, x2, ... xn } find the maximum difference between 2 consecutive numbers in the sorted list. O(n) time transformation Rectangle area is a solution to the MAX-GAP instance specialized polygon x2 x4 x3 x1 Rectangle algorithm must take as least as much time as MAX-GAP. MAX-GAP is known to be in W(n log n). Rectangle algorithm must take W(n log n) time for specialized polygons. [Transforming yet another different problem yields bound for unspecialized polygons.]
23
Summary First attempt: Tighten bounds to make an “algorithm sandwich”
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 log2 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 n 1 n log(n) n log2(n) 2n n5 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 n 1 n log(n) n log2(n) 2n n5 bounds on problem n 1 n log(n) n log2(n) 2n n5 Tight bound on problem
25
For More Information Computational Geometry: My research:
Graduate CS course in Computational Geometry offered at UMass Lowell in Spring ’01, Spring ’04, Spring ‘05 Introductory texts: Computational Geometry in C (O’Rourke) Computational Geometry: An Introduction (Preparata & Shamos) Bibliography: ftp://ftp.cs.usask.ca/pub/geometry/ Software: My research: 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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.