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

1 / 25
About This Presentation
Title:

UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Spring, 2005

Description:

... more than this amount of time may exist, but won't help us. ... Graduate CS course in Computational Geometry offered at UMass Lowell in ... Geometry in ... – PowerPoint PPT presentation

Number of Views:27
Avg rating:3.0/5.0
Slides: 26
Provided by: murrayd
Learn more at: http://www.cs.uml.edu
Category:

less

Transcript and Presenter's Notes

Title: UMass Lowell Computer Science 91.503 Analysis of Algorithms Prof. Karen Daniels Spring, 2005


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 log2 n) Time
  • given at UMass Lowell MATHEMATICAL SCIENCES
    COLLOQUIUM

2
Context Taxonomy of ProblemsSupporting Apparel
Manufacturing
3

4

Whats 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 wont help us.
  • Establish worst-case lower bound on the problem
  • Tighten each bound to form a worst-case
    sandwich

increasing worst-case asymptotic running time as
a function of n
6
Upper Bound
  • First Attempt

7
Designing an Algorithmto 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)
  • area1 Find_LR_1_RC(P)
  • area2 Find_LR_2_RC(P)
  • area3 Find_LR_3_RC(P)
  • area4 Find_LR_4_RC(P)
  • 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 k 1 to n
  • for l 1 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

9
First Upper Bound What can we really conclude?
  • Algorithms 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
    arent useful to us!
  • If a worst-case input exists that causes
    algorithm to actually use time proportional to
    n5, then algorithms worst-case running time is
    also in W(n5).
  • In this case, we can say algorithms 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.
n
2n
1
n5
n2
increasing worst-case asymptotic running time as
a function of n
10
Lower Bound
  • First Attempt

An inefficient algorithm for the problem might
exist that takes this much time, but would not
help us.
n
1
2n
n5
n2
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!

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 problems 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 dont 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

Approach
  • Think harder
  • Design an algorithm that takes only O(n2) time
    for worst-case inputs

tighter upper bound
2n
1
n5
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!

16

Some Related Problems
17

Some Related Problems (continued)
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 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
n5
2n
1
n2
n log2 n
n
21
Lower Bounds for Related Problems
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
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
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
  • 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

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

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 (ORourke)
  • Computational Geometry An Introduction
    (Preparata Shamos)
  • Bibliography ftp//ftp.cs.usask.ca/pub/geometry/
  • Softwarehttp//www.geom.umn.edu/software/cglist/
  • My research
  • 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
Write a Comment
User Comments (0)
About PowerShow.com