a faster convex hull algorithm via bucketing
play

A Faster Convex-Hull Algorithm via Bucketing Ask Neve Gamby 1 Jyrki - PowerPoint PPT Presentation

Introduction Bucketing Competitors Experiments Reflections A Faster Convex-Hull Algorithm via Bucketing Ask Neve Gamby 1 Jyrki Katajainen 2 , 3 1 National Space Institute Technical University of Denmark 2 Department of Computer Science


  1. Introduction Bucketing Competitors Experiments Reflections A Faster Convex-Hull Algorithm via Bucketing Ask Neve Gamby 1 Jyrki Katajainen 2 , 3 1 National Space Institute Technical University of Denmark 2 Department of Computer Science University of Copenhagen 3 Jyrki Katajainen and Company 28th of June, 2019 Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  2. Introduction Bucketing Convex-hull problem Competitors Contributions Experiments Reflections Convex-hull problem in two dimensions Number of input points: n y 11 Number of output points: h • 3 • The convex hull of a multiset S is the 9 5 • • 10 smallest polygon containing all the 12 • • 8 x points in S • 7 • Worst-case time: Ω( n + sort ( h )) 4 • 1 and O ( n lg( h )) or O ( n lg( n )) • 6 0 • • 2 Average-case time: O ( n ) • 4 12 3 11 5 0 2 6 1 8 9 10 7 Research question: What is the fastest average-case algorithm in Z 2 ? Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  3. Introduction Bucketing Convex-hull problem Competitors Contributions Experiments Reflections Contributions We describe a space-efficient bucketing algorithm for the convex-hull problem We perform micro-benchmarks to show which operations are expensive and which are not We provide a few enhancements to most algorithms to speed up their straightforward implementations We perform experiments to investigate the state of the art of convex-hull algorithms We report the lessons learned while doing this study Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  4. Introduction Bucketing Convex-hull problem Competitors Contributions Experiments Reflections Contributions We describe a space-efficient bucketing algorithm for the convex-hull problem We perform micro-benchmarks to show which operations are expensive and which are not We provide a few enhancements to most algorithms to speed up their straightforward implementations We perform experiments to investigate the state of the art of convex-hull algorithms We report the lessons learned while doing this study Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  5. Introduction Bucketing Old algorithm Competitors Our improvement Experiments Reflections Bucketing 1 Determine a bounding rectangle of the n input points • 2 Divide the bounding rectangle into a grid • • � √ n � √ n • � � • of size , and distribute all × • • • • the points into it • • • • • • • • • • • • 3 Mark all outer-layer cells that may • • • • • • • • contain extreme points • • • • • 4 Collect the points in the marked cells and • • • remove the rest Work space: Θ( n ) 5 Use some other algorithm to compute the convex hull of the remaining points Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  6. Introduction Bucketing Old algorithm Competitors Our improvement Experiments Reflections Our improvement 1 Determine the west and east poles � √ n 2 Divide the x -axis into � slabs, and • find the minimum and maximum y -value • • • • of each slab • • • • • 3 Adjust the minimum and maximum • • • • • • • • • • • • y -values such that they form staircases • • • • • • • • • 4 Collect the points outside the adjusted • • • • minimum and maximum y -values in their • • slab and remove the rest Work space: Θ( √ n ) 5 Use some other algorithm to compute the convex hull of the remaining points Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  7. Introduction Bucketing Throw-away elimination Competitors Plane sweep Experiments Reflections Throw-away elimination Algorithm: 1 Find the extreme points in a few y x + y predetermined directions • • 2 Form a polygon of these extreme points • • • • 3 Remove all points inside the polygon x • 4 Use some other algorithm to compute the • • convex hull of the remaining points • Improvements: • • x − y • Used two left-turn tests per point Work space: Θ(1) Implemented in place Explored fast left-turn test, etc. Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  8. Introduction Bucketing Throw-away elimination Competitors Plane sweep Experiments Reflections Plane sweep Algorithm: 1 Find the west and east poles • 2 Separate into two candidate collections • 3 Sort the upper-hull candidates • • • • x 4 Walk through the upper-hull candidates • • and eliminate left turns (and no turns) • 5 Repeat 3 – 4 for the lower-hull candidates • • • • Improvements: Time: O ( n + sort ( n )) Implemented in situ Work space: O (lg( n )) Avoided in-place stable partitioning Explored fast left-turn test, sorting etc. Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  9. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Experimental set-up Square data set: Input data: Coordinates of type signed int (32 bits) � � 2 27 Each test is repeated times n Platform: E ( h ) = O (lg n ) Hardware: 2.6 GHz CPU; 8 GB RAM Disc data set: Compiler: g++ 8.2.0 Options: -O3 -std=c++2a -Wall -Wextra -fconcepts -DNDEBUG Source code: http://www.cphstl.dk/downloads.html √ n ) E ( h ) = O ( 3 Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  10. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Elimination efficiency It is easy to eliminate most of the points for reasonably large n Throw-away struggles with curvature Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  11. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Execution time Both preprocessing algorithms improve upon plane-sweep Bucketing is consistently the fastest Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  12. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Left-turn test ( q x , q y ) • ( p x , p y ) • • ( r x , r y ) Integer calculations need slightly more than double precision: ≈ 15 ns per test Floating-point filter: ≈ 8 ns per test ( q x − p x ) · ( r y − p y ) > ( r x − p x ) · ( q y − p y ) Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  13. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Bucket association Heavily sped up by floating-point numbers Floating-point numbers free us from specific ordering of multiplication and division m − 1 x max − x min precomputed � ( x − x min ) · ( m − 1) � i = x max − x min Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  14. Introduction Experimental set-up Bucketing Elimination efficiency Competitors Execution time Experiments Left-turn test Reflections Other benchmarks Other performance indicators Bucketing also does less coordinate comparisons and moves Based on micro-benchmarks, partitioning and sorting are the other expensive operations Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

  15. Introduction Bucketing Competitors Experiments Reflections Reflections Compiler options: Make sure you use full optimization Library facilities: They are usually good; no need to reinvent them Techniques: Keep bucketing in your toolbox Robustness: Implement your (geometric) primitives in a robust manner; it is easy with a multiple-precision library Floating-point acceleration: Use floating-point numbers wisely; often they speed up things on modern processors Space efficiency: Do not waste lots of space; O ( √ n ) work space is acceptable Correctness: Use an automated test framework and a verifier; they catch lots of bugs Quality assurance: Try several alternatives for the same task to be sure about the quality of the chosen alternative Ask Neve Gamby, Jyrki Katajainen A Faster Convex-Hull Algorithm via Bucketing

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend