convex hull
play

Convex hull 1 - 1 Convex hull 1 - 2 Convex hull 1 - 3 Convex - PowerPoint PPT Presentation

Convex hull 1 - 1 Convex hull 1 - 2 Convex hull 1 - 3 Convex hull Definition, extremal point Jarvis algorithm Orientation predicate Buggy degenerate example Real RAM model and general position hypothesis Graham


  1. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 3

  2. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = v if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 4

  3. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = v if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 5

  4. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w w 3 = (30 , 30 . 000001) n w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = v if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 6

  5. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) n w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = v if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 7

  6. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) n w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = v = w if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 8

  7. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) v w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 9

  8. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w w 2 = (24 , 24) v w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 10

  9. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w w 2 = (24 , 24) v w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; Incoherence S = S \ { v } While v � = u 8 - 11

  10. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w w 1 = (12 , 12) w 2 = (24 , 24) v w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 12

  11. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) n w 1 = (12 , 12) w 2 = (24 , 24) v w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) Do n = first in S ; For each w ∈ S = w u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 13

  12. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) v w 1 = (12 , 12) w 2 = (24 , 24) w w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 14

  13. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) v w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) n Do n = first in S ; For each w ∈ S u = w if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 15

  14. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w 4 = (23 , 36) u = w 5 = (0 . 5000029 , 0 . 5000027) Do n = first in S ; For each w ∈ S u if vwn positive then n = w ; v.next = n ; v = n ; S = S \ { v } While v � = u 8 - 16

  15. Teaser robustness lecture Convex hull Buggy degenerate example (single precision) w 1 = (12 , 12) w 2 = (24 , 24) w 3 = (30 , 30 . 000001) w 4 = (23 , 36) w 5 = (0 . 5000029 , 0 . 5000027) u Result is really wrong 8 - 17

  16. Real RAM model and Convex hull general position hypothesis Real Random Access Memory model Assume exact computation on real numbers constant time for single operations: + , − , √ , sin . . . 9 - 1

  17. Real RAM model and Convex hull general position hypothesis Real Random Access Memory model Assume exact computation on real numbers constant time for single operations: + , − , √ , sin . . . General position hypotheses Predicate: Input �− → {− 1 , 0 , 1 } 9 - 2

  18. Real RAM model and Convex hull general position hypothesis Real Random Access Memory model Assume exact computation on real numbers constant time for single operations: + , − , √ , sin . . . General position hypotheses Predicate: Input �− → {− 1 , 0 , 1 } 2D convex hull: no three points colinear 9 - 3

  19. Real RAM model and Convex hull general position hypothesis Real Random Access Memory model Assume exact computation on real numbers constant time for single operations: + , − , √ , sin . . . General position hypotheses Predicate: Input �− → {− 1 , 0 , 1 } 2D convex hull: no three points colinear possibly: no 2 points with same x 9 - 4

  20. Convex hull Graham algorithm 10 - 1

  21. Convex hull Graham algorithm sort around a point (e.g. lowest point) 10 - 2

  22. Convex hull Graham algorithm sort around a point (e.g. lowest point) 10 - 3

  23. Convex hull Graham algorithm leftturn OK 10 - 4

  24. Convex hull Graham algorithm rightturn remove and go back 10 - 5

  25. Convex hull Graham algorithm leftturn OK 10 - 6

  26. Convex hull Graham algorithm leftturn OK 10 - 7

  27. Convex hull Graham algorithm leftturn OK 10 - 8

  28. Convex hull Graham algorithm rightturn remove and go back 10 - 9

  29. Convex hull Graham algorithm rightturn remove and go back 10 - 10

  30. Convex hull Graham algorithm leftturn OK 10 - 11

  31. Convex hull Graham algorithm leftturn OK 10 - 12

  32. Convex hull Graham algorithm rightturn remove and go back 10 - 13

  33. Convex hull Graham algorithm leftturn OK 10 - 14

  34. Convex hull Graham algorithm leftturn OK 10 - 15

  35. Convex hull Graham algorithm 10 - 16

  36. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; 11 - 1

  37. Complexity Convex hull Graham algorithm Input: point set S O ( n ) u lowest point of S ; sort S around u in a circular list including u ; v = u ; while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; 11 - 2

  38. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; O ( n log n ) sort S around u in a circular list including u ; v = u ; while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; 11 - 3

  39. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; 11 - 4

  40. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; delete one point at most n times 11 - 5

  41. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; distance to u decreases at most n times while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; delete one point at most n times 11 - 6

  42. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; distance to u decreases O ( n ) at most n times while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; delete one point at most n times 11 - 7

  43. Complexity Convex hull Graham algorithm Input: point set S u lowest point of S ; sort S around u in a circular list including u ; v = u ; O ( n log n ) while v.next � = u if ( v, v.next, v.next.next ) ccw v = v.next ; else v.next = v.next.next ; v.next.previous = v ; if v � = u v = v.previous ; 11 - 8

  44. Convex hull Lower bound Problem lower bound is Ω( f ( n )) Iff there is NO algorithm solving all size n problems using less than Cf ( n ) operations ∀ n C constant independent of n 12

  45. Sorting Lower bound Input: n real (positive) numbers 13 - 1

  46. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation 13 - 2

  47. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Monitoring execution 13 - 3

  48. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution 13 - 4

  49. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution 13 - 5

  50. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution 13 - 6

  51. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution ♯ leaves ≥ ♯ permutations 13 - 7

  52. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution ♯ leaves ≥ ♯ permutations There are n ! permutations 13 - 8

  53. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution ♯ leaves ≥ ♯ permutations There are n ! permutations Tree height is at least log 2 ♯ leaves 13 - 9

  54. Sorting Lower bound Input: n real (positive) numbers Output: sorting permutation Yes No Monitoring execution ♯ leaves ≥ ♯ permutations There are n ! permutations Tree height is at least log 2 ♯ leaves ♯ comparisons ≤ log 2 n ! ≃ n log 2 n 13 - 10

  55. Convex hull Lower bound Input: n 2D points (real coordinates) Output: list of points along the convex hull 14 - 1

  56. Convex hull Lower bound A stupid algorithm for sorting numbers 14 - 2

  57. Convex hull Lower bound project on parabola 14 - 3

  58. Convex hull Lower bound project on parabola compute convex hull 14 - 4

  59. Convex hull Lower bound project on parabola compute convex hull find lowest point 14 - 5

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