cg course, lecture 10 - computational...

85
CG course, Lecture 10 Michal Kleinbort Tel Aviv University, May 2019 Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 1 / 45

Upload: others

Post on 22-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

CG course, Lecture 10

Michal Kleinbort

Tel Aviv University, May 2019

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 1 / 45

Page 2: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 2 / 45

Page 3: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 2 / 45

Page 4: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Planar Point Location - Definition

Let S be a planar subdivision consisting of faces, edges, and vertices

The Planar Point Location ProblemInput: Query point qOutput: The feature of S containing q

q

n - the number of subdivision edges

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 3 / 45

Page 5: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Two Variants of the Trapezoidal Map RIC Point Location

Basic algorithm [Mulmuley ’90, Seidel ’91]I Expected O(log n) query timeI Expected O(n) sizeI Expected O(n log n) preprocessing time

Guaranteed variant [de Berg et al. ’00]I Guaranteed O(log n) query timeI Guaranteed O(n) sizeI Expected O(n log2 n) preprocessing time (?)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 4 / 45

Page 6: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

Dcv1

q1

p1

A

C

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 7: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

DA

C

cv1(p1, q1)

B

Dcv1

q1

p1

A

C

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 8: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

DA

C

cv1(p1, q1)

cv2(p2, q2)

B

Dcv1

q1

p1

A

C

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 9: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

DA

C

cv1(p1, q1)

cv2(p2, q2)

B

D

A

C

p1

q1

cv1

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 10: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

DA

E

cv1(p1, q1)

cv2(p2, q2)

F

HC

B

Dcv1

q1

p1

A

F

E

p2

cv2

HC

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 11: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

DA

E

cv1(p1, q1)

cv2(p2, q2)

F

HC

B

Dcv1

q1

p1

A

F

E

p2

cv2

HC

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 12: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F

HC HD

I B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

GH

HC

D

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 13: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Basic RIC Point Location Algorithm

Description: Builds the trapezoidal-map using a randomized incrementalconstruction and maintains an auxiliary search-structure (DAG)

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F

HC HD

I

H

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

H

HH

C

D

[Mulmuley ’90, Seidel’91]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 5 / 45

Page 14: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Basic Algorithm [Mulmuley ’90, Seidel ’91] - Complexity

Expected O(log n) query time

Expected O(n) size

Expected O(n log n) preprocessing time

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 6 / 45

Page 15: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Guaranteed O(log n) Query Time and O(n) SizeS - the size of the DAG

L - the length of the longest query path

The main idea:Construct the DAG using the basic algorithm with some randominsertion order

I Verify S on the fly (S can be accessed in O(1) time)I Abort and rebuild if S ≥ c1n

Verify that L ≤ c2 log n, rebuild otherwise

Only a constant number of rebuilds is expected

I The probability that L is bad is very smallI The probability that S is bad is very small

[de Berg et al.]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 7 / 45

Page 16: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Guaranteed O(log n) Query Time and O(n) SizeS - the size of the DAG

L - the length of the longest query path

The main idea:Construct the DAG using the basic algorithm with some randominsertion order

I Verify S on the fly (S can be accessed in O(1) time)I Abort and rebuild if S ≥ c1n

Verify that L ≤ c2 log n, rebuild otherwise

Only a constant number of rebuilds is expected

I The probability that L is bad is very smallI The probability that S is bad is very small

[de Berg et al.]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 7 / 45

Page 17: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Guaranteed O(log n) Query Time and O(n) SizeS - the size of the DAG

L - the length of the longest query path

The main idea:Construct the DAG using the basic algorithm with some randominsertion order

I Verify S on the fly (S can be accessed in O(1) time)I Abort and rebuild if S ≥ c1n

Verify that L ≤ c2 log n, rebuild otherwise

Only a constant number of rebuilds is expectedI The probability that L is bad is very smallI The probability that S is bad is very small

[de Berg et al.]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 7 / 45

Page 18: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Guaranteed O(log n) Query Time and O(n) Size

f (n) - Time to verify that L is logarithmic on a DAG of n curves

Overall expected time for construction: O(n log n + f (n))

It is unclear how to efficiently verify L:I Claim that the expected verification time is O(n log2 n)I No concrete proof is given

[de Berg et al.]

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 8 / 45

Page 19: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Can We Efficiently Maintain L On-the-fly?

The best known solution requires Ω(n log n) size

Idea: Maintain the depth D of the DAG instead (easy to maintain)

D represents the length of the longest DAG path

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 9 / 45

Page 20: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Can We Efficiently Maintain L On-the-fly?

The best known solution requires Ω(n log n) size

Idea: Maintain the depth D of the DAG instead (easy to maintain)

D represents the length of the longest DAG path

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 9 / 45

Page 21: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Can We Efficiently Maintain L On-the-fly?

The best known solution requires Ω(n log n) size

Idea: Maintain the depth D of the DAG instead (easy to maintain)

D represents the length of the longest DAG path

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 9 / 45

Page 22: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Modified Algorithm Using D

The modified algorithm:Observe S and D during construction

Abort and rebuild structure if one of the following occurs:I S ≥ c1nI D ≥ c2 log n

for suitable constants c1, c2 > 0

D is not L

I Can we still expect a constant number of rebuilds?

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 10 / 45

Page 23: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Modified Algorithm Using D

The modified algorithm:Observe S and D during construction

Abort and rebuild structure if one of the following occurs:I S ≥ c1nI D ≥ c2 log n

for suitable constants c1, c2 > 0

D is not LI Can we still expect a constant number of rebuilds?

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 10 / 45

Page 24: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 25: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

H

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

H

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 26: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

H

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

H

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 27: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

H

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

H

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 28: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

Jcv3(p3, q3) M

K

N

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

K

cv3

q3J

M

N

p3

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 29: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

Jcv3(p3, q3) M

K

N

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

K

cv3

q3J

M

N

p3

Longest Query Path - L

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 30: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

Jcv3(p3, q3) M

K

N

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

K

cv3

q3J

M

N

p3

Longest DAG Path - D

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 31: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The Difference between D and L

Reminder: D represents the length of the longest DAG path

Some DAG paths are not search pathsI D is an upper bound on LI D may be significantly larger than L

B

GA

E

cv1(p1, q1)

cv2(p2, q2)

F I

Jcv3(p3, q3) M

K

N

B

cv1

q1

p1

A

F

E

p2

cv2

I

q2

cv2

G

K

cv3

q3J

M

N

p3

Longest Query Path - LLongest DAG Path - D

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 11 / 45

Page 32: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Towards a Worst-Case D/L Ratio

Top-to-bottom insertion order√

n blocks√

n segments in each block

D is Ω(n)

L is O(√

n)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 12 / 45

Page 33: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Towards a Worst-Case D/L Ratio

A

F

cv2(p2, q2)

cv3(p3, q3)

cv4(p4, q4)

M

I’

K BHG

C’ D’ E’

I D

cv1(p1, q1)

C

L

E

B

A

H

L

G

M

cv3

q3

p3

cv2

q2

p2

cv1

q1

p1

I+K

C

D

E+F

D is Ω(n)

L is O(√

n)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 12 / 45

Page 34: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Towards a Worst-Case D/L Ratio

A

K

cv1(p1, q1)

L

BHGC

cv4(p4, q4)

I

N

D

cv2(p2, q2)

cv3(p3, q3)M

EF

B

A

H

L

G

M

F

EI

D

C

q4

cv4

cv3

q3

p3

cv2

q2

p2

cv4

cv1

cv4cv4

p4

q1

p1

N

K I’

C’

D’

E’

D is Ω(n)

L is O(√

n)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 12 / 45

Page 35: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Towards a Worst-Case D/L Ratio

This construction ensures that each newly inserted segment intersectsthe trapezoid with the largest depth

A query can skip an entire block using only one comparison

Within the relevant block there are at most O(√

n) comparisons

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 12 / 45

Page 36: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Worst-Case D/L Ratio

Top-to-bottom insertion order

D is Ω(n)

L is O(log n)I Achieved due to the recursive structure

n2

n4

n8

O(log n)

Theorem 1The worst-case ratio between D and L is Ω(n/log n)and this bound is tight.

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 13 / 45

Page 37: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Worst-Case D/L Ratio

Top-to-bottom insertion order

D is Ω(n)

L is O(log n)I Achieved due to the recursive structure

n2

n4

n8

O(log n)

Theorem 1The worst-case ratio between D and L is Ω(n/log n)and this bound is tight.

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 13 / 45

Page 38: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An Open Problem

Suppose that the structure is rebuilt whenever either the depth D orthe size S exceed some thresholds.

Can we still expect a constant number of rebuilds?

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 14 / 45

Page 39: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Guaranteed logarithmic PL

In [Hemmer et al.] it is shown that:

LemmaThe length L in a linear size DAG can be verified in O(n log n) time.

Theorem 2A point location data structure for a planar subdivision with n edges,which has O(n) size and O(log n) query time in the worst case, can bebuilt in expected O(n log n) time.

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 15 / 45

Page 40: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 16 / 45

Page 41: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 16 / 45

Page 42: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN search problem using kd-tree

Given:I a kd-tree whose root node is rootI a query point q

Find the closest point to q among all points kept in the tree leaves

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 17 / 45

Page 43: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

We use slides from CSE373 course, 2002, University of Washingtonhttps://courses.cs.washington.edu/courses/cse373/02au/

lectures/lecture22l.pdf

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 18 / 45

Page 44: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 19 / 45

Page 45: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Outline

Optimal point locationNearest-neighbor search using kd-treesA glimpse of nearest-neighbor search in robot motion planning

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 19 / 45

Page 46: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

A robot

A mechanical device, equipped with actuators and sensors, that iscontrolled by a computing systemOperates in a real-world workspace, populated by physical objectsPerforms tasks by executing motions in the workspaceAn autonomous robot is required to plan its own motionsautomatically in order to achieve a given task

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 20 / 45

Page 47: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Some examples

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 21 / 45

Page 48: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The motion-planning problem

Given:A robot RA workspace W (with obstacles)Initial and final positions

Goal:Plan a collision-free continuous path forthe robot from the initial position to thefinal position

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 22 / 45

Page 49: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

A configuration of the robotA configuration of the robot is represented by a set of parameters, e.g.,(x , y ,Θ1,Θ2,Θ3)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 23 / 45

Page 50: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The dimensionThe dimension of the motion-planning problem is defined by the length ofeach configuration

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 24 / 45

Page 51: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An alternative formulation of the MP problem

Given:A point robotA d-dimensional configuration space X (C-space)C-obstacles (often not explicitly given) Cforb

Free space Cfree = X \ Cforb

Initial and final configurations (d-dimensional points)Goal:

Plan a continuous path in the free space from the initial configurationto the final configuration

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 25 / 45

Page 52: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Challenges

High-dimensional problems are “hard” tosolveFinding an optimal path is harder thanfinding a path

I minimal path lengthI maximal distance from obstaclesI smoothness

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 26 / 45

Page 53: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Sampling-based methods for solving the problem

Attempt to capture the structure of the C-space by constructing agraph (called a roadmap)

I The nodes are collision-free configurations sampled at randomI Two nearby nodes are connected by an edge if the path between them

(usually a straight line) is collision-freeAre often probabilistically completeNovel methods also ensure asymptotic optimality

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 27 / 45

Page 54: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Primitive operations in sampling-based methods

Collision detection (CD)I Determines whether a configuration or a C-space path between two

configurations is collision-free. The latter is termed local planning (LP)I Complexity usually depends on both the complexity of the workspace

obstacles and the complexity of the robotNearest-neighbor search (NN)

I Returns the nearest neighbor (or neighbors) of a given configurationI Complexity depends on the number n of nodes and the dimension d

The main practical computational bottleneck is typically considered to beCD (including LP)

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 28 / 45

Page 55: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Givenstart and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 56: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Givenstart and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 57: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Involves CD operationQuery: Given configurations, find the shortest path h

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 58: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Givenstart and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 59: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

r

Involves NN operation (r -nearest neighbors or k-nearest neighbors)rPRM∗ (n) = 2

[(1 + 1

d

)·(µ(Cfree)ζd

)·(

log nn

)]1/d

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 60: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

k = O(log n)

Involves NN operation (r -nearest neighbors or k-nearest neighbors)kPRM∗(n) = 2e log n

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 61: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Involves CD operation (as an LP sub-procedure)Query: Given configurations, find the shortest path h

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 62: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Involves CD operation (as an LP sub-procedure)Query: Given configurations, find the shortest path h

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 63: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Givenstart and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 64: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Givenstart and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 65: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Given start and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 66: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

An example: s-PRM* [Karaman and Frazzoli, 11]

The Probabilistic Roadmap Method (PRM) - Multi-query algorithm

Query: Given start and goal configurations, find the shortest path betweenthe two configurations

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 29 / 45

Page 67: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Sampling-based planners

single-robot planners

LBT-RRT MPLB

FMT*RRG

PRM

BTT

dRRT dRRT*M*

multi-robot planners

length cost

bottleneckcost

BFMT*

SPARS2RSEC

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 30 / 45

Page 68: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Our results [K., Salzman and Halperin ’15, ’16]

We formally prove that the complexity of NN search dominates theasymptotic running time of several AO algorithms

We characterize settings in which the role of NN is far from negligibleand show experimentally that NN may dominate CD after finite time

We use an efficient, specifically-tailored NN data structure in suchsettings to reduce the overall time of motion-planning algorithms

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 31 / 45

Page 69: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Our results [K., Salzman and Halperin ’15, ’16]

We formally prove that the complexity of NN search dominates theasymptotic running time of several AO algorithmsWe characterize settings in which the role of NN is far from negligibleand show experimentally that NN may dominate CD after finite time

We use an efficient, specifically-tailored NN data structure in suchsettings to reduce the overall time of motion-planning algorithms

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 31 / 45

Page 70: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN-sensitive settings

Can be of the following types:Algorithms: Planners that algorithmically shift some of thecomputational weight from CD to NNScenarios: Scenarios in which the computational cost of certainplanners is mostly due to NN searchParameters: Parameters’ values for which the computational cost ofcertain planners is mostly due to NN search

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 32 / 45

Page 71: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN-sensitive algorithmsWe measure the ratio χALG(N) between the overall time spent on NN andthe time spent on CD, after N configurations were sampled, whenalgorithm ALG is used

0.00.20.40.60.81.01.21.41.6

MPL

B(N

)

0 5 10 15 20 25 30Number of samples (in thousands)

Using NN-sensitive algorithms (e.g., Lazy-PRM* [Hauser ’15],MPLB [Salzman and Halperin ’15] etc.), the ratio χALG(N) significantlyincreases as a function of N, obtaining values greater than 1, namely, NNtakes more time than CD

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 33 / 45

Page 72: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN-sensitive scenarios

Let S = (W,R) denote a scenario, where:I W denotes the workspaceI R denotes the robot system, which is a set of ` single

constant-description complexity robots operating simultaneouslyLet d denote the dimension of S, d = Θ(`)Let m denote the complexity of the workspace obstaclesRobot-robot collisions should be taken into account as well

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 34 / 45

Page 73: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN-sensitive scenarios - The effect of dsPRM* example:

When d is gradually increased, the ratio χsPRM*(N):I Shows an initial increaseI Then shows a possible decreaseI Finally, tends to some constant value

R-NN

0.0

0.5

1.0

1.5

2.0

2.5

sPR

M*(

N)

5 10 15 20 25 30 35 40 45 50Dimension

rNN, = 0.5rNN, = 0.25rNN, = 0

d-dimensional workspaceµ is the obstacle volume

start end

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 35 / 45

Page 74: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

NN-sensitive scenarios - The effect of dsPRM* example:

When d is gradually increased, the ratio χsPRM*(N):I Shows an initial increaseI Then shows a possible decreaseI Finally, tends to some constant value

K-NN: shows a different trend

0

9

18

27

36

45

sPR

M*(

N)

5 10 15 20 25 30 35 40 45 50Dimension

kNN, = 0.5kNN, = 0.25kNN, = 0

d-dimensional workspaceµ is the obstacle volume

start end

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 35 / 45

Page 75: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Adapting all-pairs rNN algorithms for sampling-basedmotion planning

In several planning algorithms “all-pairs” r -NN are used with apredefined value r(n) = O(( log n

n )1/d )Randomly transformed grids (RTG) [Aiger et al., 14] is a novelmethod for approximate all-pairs r -NNWe implemented RTG and used it for certain sampling-basedalgorithmsWe obtain significant speedups improving: the construction time, thetime to find an initial solution, and the time to converge tohigh-quality solutions

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 36 / 45

Page 76: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Randomly transformed grids (RTG) [Aiger et al., 14]Given a set P of n points in Rd and a radius r , RTG reports all-pairsof points p, q ∈ P such that ||p − q||2 ≤ r , with high probabilityThe algorithm:

1 Place a d-dimensional axis-parallel grid of cell size c with a randomshift (chosen uniformly)

2 The points of P are partitioned into the grid cells3 The distance ||p − q||2 between every pair of points p, q ∈ P within the

same cell is computed, and the pair is reported if ||p − q||2 ≤ r4 Repeat steps (1)-(3) m times, producing m distinct grids

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 37 / 45

Page 77: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Randomly transformed grids (RTG) [Aiger et al., 14]Given a set P of n points in Rd and a radius r , RTG reports all-pairsof points p, q ∈ P such that ||p − q||2 ≤ r , with high probabilityThe algorithm:

1 Place a d-dimensional axis-parallel grid of cell size c with a randomshift (chosen uniformly)

2 The points of P are partitioned into the grid cells3 The distance ||p − q||2 between every pair of points p, q ∈ P within the

same cell is computed, and the pair is reported if ||p − q||2 ≤ r4 Repeat steps (1)-(3) m times, producing m distinct grids

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 37 / 45

Page 78: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Randomly transformed grids (RTG) [Aiger et al., 14]Given a set P of n points in Rd and a radius r , RTG reports all-pairsof points p, q ∈ P such that ||p − q||2 ≤ r , with high probabilityThe algorithm:

1 Place a d-dimensional axis-parallel grid of cell size c with a randomshift (chosen uniformly)

2 The points of P are partitioned into the grid cells3 The distance ||p − q||2 between every pair of points p, q ∈ P within the

same cell is computed, and the pair is reported if ||p − q||2 ≤ r4 Repeat steps (1)-(3) m times, producing m distinct grids

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 37 / 45

Page 79: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Randomly transformed grids (RTG) [Aiger et al., 14]Given a set P of n points in Rd and a radius r , RTG reports all-pairsof points p, q ∈ P such that ||p − q||2 ≤ r , with high probabilityThe algorithm:

1 Place a d-dimensional axis-parallel grid of cell size c with a randomshift (chosen uniformly)

2 The points of P are partitioned into the grid cells3 The distance ||p − q||2 between every pair of points p, q ∈ P within the

same cell is computed, and the pair is reported if ||p − q||2 ≤ r4 Repeat steps (1)-(3) m times, producing m distinct grids

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 37 / 45

Page 80: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Randomly transformed grids (RTG) [Aiger et al., 14]Given a set P of n points in Rd and a radius r , RTG reports all-pairsof points p, q ∈ P such that ||p − q||2 ≤ r , with high probabilityThe algorithm:

1 Place a d-dimensional axis-parallel grid of cell size c with a randomshift (chosen uniformly)

2 The points of P are partitioned into the grid cells3 The distance ||p − q||2 between every pair of points p, q ∈ P within the

same cell is computed, and the pair is reported if ||p − q||2 ≤ r4 Repeat steps (1)-(3) m times, producing m distinct grids

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 37 / 45

Page 81: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Factors determining the efficiency

1 The number m of grids:I Increasing m increases the probability of capturing true near neighbors

in the same cellI Increasing m increases the overall running time

2 The cell size c:I Large c increases the probability of capturing true near neighbors in the

same cellI Small c causes the ratio between the overall number of inspected pairs

and the output size to be close to 1 (reduces the portion of irrelevantchecks)

c should be greater than (but very close to) r when a random shift is used

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 38 / 45

Page 82: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Experimental results

Improved construction time (3D Euclidean C-space)

In the above scenario for n = 50K we managed to always find a solution.The number of reported NN pairs was ∼ 400K .

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 39 / 45

Page 83: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Experimental results

Faster convergence to high-quality solutions (6D non-Euclidean C-space)

In the above scenario for n = 50K we managed to always find a solution.The number of reported NN pairs was ∼ 400K .

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 39 / 45

Page 84: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

Experimental results

Shorter times for finding an initial solution (6D Euclidean C-space)

In the above scenario for n = 50K we managed to always find a solution.The number of reported NN pairs was ∼ 400K .

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 39 / 45

Page 85: CG course, Lecture 10 - Computational Geometryacg.cs.tau.ac.il/courses/computational-geometry/spring-2019/main.pdf · cv 2 I q 2 cv 2 G H Michal Kleinbort (TAU) CG Course, Lecture

The End

Michal Kleinbort (TAU) CG Course, Lecture 10 May, 2019 40 / 45