convex hull l
TRANSCRIPT
-
7/31/2019 Convex Hull l
1/17
2011
Cache-Oblivious Output-SensitiveTwo Dimensional Convex Hull
..: 344
Peyman Afshani Arash Farzan
-
7/31/2019 Convex Hull l
2/17
Contents1. Introduction
2. Cache-Oblivious Output-SensitiveTwo-Dimensional Convex Hull
3. The Algorithm
4. Conclusion
-
7/31/2019 Convex Hull l
3/17
Introduction[Convex Hull] Convex Hull:
Applications:
Pattern Recognition, Image Processing, Statistics, GIS
-
7/31/2019 Convex Hull l
4/17
Introduction[Convex Hull Algorithms] General Convex Hull Algorithms:
Complexity in terms of:
n (Number of Input Points)
Lower Bound: (nlogn)
Output-Sensitive Algorithms:
Complexity in terms of:
n (Number of Input Points)
h (Number of Points on the Convex Hull)
Lower Bound: (nlogh)
-
7/31/2019 Convex Hull l
5/17
Introduction[Convex Hull Algorithms] Gift Wrapping Algorithm (Jarvis March - 1973) Complexity: O(nh)
Graham Scan (Ronald Graham - 1972)
Complexity: O(nlogn)
Divide and Conquer (Preparata and Hong - 1977)
Complexity: O(nlogn)
The Ultimate Convex Hull Algorithm (Kirkpatrick and Seidel - 1986)
Complexity: O(nlogh)
Chans Algorithm (Ronald Graham - 1996)
Complexity: O(nlogh)
-
7/31/2019 Convex Hull l
6/17
Introduction[Cache Algorithms] Main Idea:
Avoid CacheMisses.
Cache Aware Algorithms: Two Levels of Memory.
Depends on Constant Parameters: Cache Size, Cache Line, etc.
Highly Processor Specific.
Cache Oblivious Algorithms: Multiple Levels of Memory.
Does Not Depend on Constant Parameters.
Behaves Similarly in All Levels of the Memory Hierarchy.
-
7/31/2019 Convex Hull l
7/17
Cache-Oblivious Output-SensitiveTwo-Dimensional Convex Hull[Introduction] Problem
Minimize the Number of Cache Faults Caused WhenComputing the Convex Hull of a Set of NPoints on a
Plane. Output-Sensitive Case
Number of Cache Misses are Analyzed on Both Nand H.
Problems Lower Bound O(N/BlogM/BH/B)
Algorithms Presented Lower Bound O (max{N/B loglogM/B, N/B logM/BH/B})
-
7/31/2019 Convex Hull l
8/17
Given N Points in Two Dimensions:
Complexity: O(NlogN)
First Optimal Output-Sensitive Convex Hull
Algorithm: Complexity: O(NlogH)
By Kirkpatrick and Seidel
Obtaining a Cache-Aware or Even a Cache-Oblivious Convex Hull Algorithm in TwoDimensions is not Hard: Use of Cache Oblivious/Aware Sorting Algorithm
Use of Grahams Scan
O(N/BlogM/BN/B) Cache Misses
Cache-Oblivious Output-SensitiveTwo-Dimensional Convex Hull[Preliminaries & Background]
-
7/31/2019 Convex Hull l
9/17
Goodrichs Output-Sensitive Convex Hull Algorithm:
Cache Misses: O(N/BlogM/BH/B)
Arge and Milterson Showed That in the Cache-AwareModel, These are as Best as One Can Do.
Any Lower Bound in the Cache-Aware Model AlsoHolds in the Cache-Oblivious Model.
Here we Present a Cache-Oblivious Algorithm for theOutput-Sensitive Convex Hull Problem that AlmostMatches the Lower Bound.
Cache-Oblivious Output-SensitiveTwo-Dimensional Convex Hull[Preliminaries & Background]
-
7/31/2019 Convex Hull l
10/17
The Algorithm[1/3] A Modification of Chans Output-Sensitive Algorithm.
Find the Upper Envelope of NLines in Plane
Lemma 1: For a set H of N lines in R2and a parameter H,one can find H upper hull edges in only O(max{n,nlogmh})cache misses.
Proof: Partition H into r = N/H groups of size H each.
For each group of H lines run the optimal algorithm to obtain the upper hull.
Cache Misses: O(hlogmh)
r Chains will be created of maximum size H
It is necessary to show that it is possible to merge these chains into afinal chain causing a small number of cache misses
Sis the set of all the segments constituting the chains
For a segment s E S, denote the x-coordinate of he left end point of swithxr(s)
Partition S into h sets G1,,GH, of size r such that:
For every i < j and every u E Gi , y E Gj we have xr(u)
-
7/31/2019 Convex Hull l
11/17
The Algorithm[2/3] Lemma 2: Given k numbers in a contiguous list can be distributed into T
buckets B1,,BT of roughly equal size such that an element in a bucketBi is less than any element in a bucket Bj with a larger index ( i.e. i < j )using O(k/B logmT/B)cache misses in the cache oblivious model underthe tall cache assumption.
Hence, the previous step takes O(nlogmh) under the cache oblivious
setting.
For every i the segments of Gi are stored sequentially but in arbitrary order.
xi and Xi are the minimum and maximum left x-coordinate in Gi.
We merge the chains in H iterations and at each iteration we process one set Gi, startingfrom G1.
At iteration i+1 the upper hull of all segments in S i to the left of the vertical line x = X i has
been found.
Let A be theset of all the segments in Siwhich cross the vertical line x = Xi.
We only need to look at A and Gi+1.
Make a linear search at these in order to find the next upper hull segment.
We repeat this search until we discover the upper hull segment at x = Xi+1 and update A.
Each Linear scan will cause O(r/B) cache misses, the discovery of ki upper hull edgesO(rki/B).
At each point if we discover the H-th edge, we break the algorithm and output all the edgesdiscovered by the algorithm.
-
7/31/2019 Convex Hull l
12/17
The Algorithm[3/3] Since at most Hedges will be discovered by the
convex hull algorithm, the total number of cachemisses sums up to:
For values H < m as we have to scan over theinput set the cache misses are O(n). Thus, theoverall number of cache misses is O(max {n ,nlogmh}).
-
7/31/2019 Convex Hull l
13/17
Theorem[1/2] For a set P of N points in R2, one can compute the convex hull of P
with at most
cache misses in which H is the size of the final convex hull.
Proof:
We run the algorithm of Lemma 1 with values of h chosen from a doublyexponential sequence.
We set Hi = c2i , starting from i = 0 until the time all the edges of the upper
hull have been discovered.
The total number of cache misses can be expressed as a geometricseries:
-
7/31/2019 Convex Hull l
14/17
Theorem[2/2] For smaller values of the sequence, since there is a scan
over the input for each such value, there are O(n) cachemisses in each run.
Hence, the total number of cache misses is:
-
7/31/2019 Convex Hull l
15/17
ConclusionWe considered the problem of output-sensitive
convex hull in the cache-oblivious model.
We presented an algorithm for it.
The algorithm almost matches the lower boundO(nlogmh) except for an additional termO(nloglogm).
O(nloglogm) is a small term and is negligible in anypractical application.
-
7/31/2019 Convex Hull l
16/17
References Cache-Oblivious Output-Sensitive Two-Dimensional Convex Hull Peyman
Afshani and Arash Farzan. In Proceedings of the 19th Annual CanadianConference on Computational Geometry, pages 153-155, 2007.
T. Chan. Optimal output-sensitive convex hull algorithms in two and threedimensions. Discrete and Computational Geometry, 16:361-368, 1996.
http://en.wikipedia.org/wiki/Convex_hull
http://en.wikipedia.org/wiki/Cache-oblivious_algorithm
-
7/31/2019 Convex Hull l
17/17
..!!