69
Randomized Techniques in Computational Geometry I Fundamentals Sandeep Sen I.I.T. Delhi, India 1

Randomized Techniques in Computational Geometry

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Randomized Techniques in Computational Geometry

Randomized Techniques in Computational Geometry

I Fundamentals

Sandeep Sen

I.I.T. Delhi, India

1

Page 2: Randomized Techniques in Computational Geometry

Outline

• Kind of Problems

• Kind of Algorithms

• Random Sampling in Geometry

• Incremental Construction

2

Page 3: Randomized Techniques in Computational Geometry

Primary Source (for this talk)

• Clarkson and Shor, “Applications of random sampling in

computational geometry”. DCG 89.

• Reif and Sen “Optimal parallel randomized algorithms for

3-D hulls and related problems. SIAMJC 92.

• Mulmuley and Sen, Dynamic point location in arrangements

of hyperplanes. DCG 92.

• Mulmuley “Computational Geometry : An introduction

through randomized algorithms” . Prentice Hall 94.

3

Page 4: Randomized Techniques in Computational Geometry

The problems addressed

• Range searching

• Ray shooting/Point location

• Planar partitioning

• Convex hulls

• Linear programming

• Nearest neighbour

4

Page 5: Randomized Techniques in Computational Geometry

The problems addressed cont’d

• Triangulation

• Hidden surface

• Levels of arrangements

• Diameter/ Width

• Euclidean minimum spanning tree

Exact computations

“Real” RAM

5

Page 6: Randomized Techniques in Computational Geometry

Randomization in Computational Geometry

• Improved Complexities

Range searching

• Simpler Algorithms

Convex hulls, triangulation, LP

• Dynamic Algorithms

with minimal modifications

• Parallel Algorithms

Faster, more efficient

6

Page 7: Randomized Techniques in Computational Geometry

Randomized Algorithms

• RNG O(log n) bits in constant time

• Assumes No input distribution

• Halts with a correct output

• Running time is bounded by some probability distribution

Prob.distr.

Running time T

Expectation [T ]

Tail estimates : Prob. [Tn > f(n)] ≤ ε]

7

Page 8: Randomized Techniques in Computational Geometry

Elementary Tools

Probabilistic Inequalities :

• Markov only expectation

• Chernoff moment generating function

• Chebychev intermediate(bounding random bits)

Linearity of Expectation E[X + Y ] = E[X] + E[Y ]

for any X, Y not necessarily independent

P (A ∪B) ≤ P (A) + P (B)

Notation :∼

O (·)def= O(·) with prob. 1− 1

n

8

Page 9: Randomized Techniques in Computational Geometry

Quick Sort

Splitter

Sortrecursively

Sortrecursively

Ideal : T (n) = 2T (n/2) + O(n)

≤ O(n log n)

randomized : T (n) = T (n1) + T (n− n1 − 1) + O(n)

where n1 is a random variable in [1, n]

E[T (n)] : O(n log n)

9

Page 10: Randomized Techniques in Computational Geometry

Generalized : r splitters

n n n n4321

Splitters

Ideal : T (n) =∑

T (n/r) + O(n log r)

≤ O(n log n)

E[T (n)] : O(n log n)

10

Page 11: Randomized Techniques in Computational Geometry

Kind of sampling

Choose a random subset R ⊂ N

• with replacement

• without replacement

• Bernoulli sample

(expected sample size is |R| by picking every element with

prob. ( |R||N |)).

“parallel” sampling

Remark : Little difference in final results. We shall choose the

one that simplifies proof.

11

Page 12: Randomized Techniques in Computational Geometry

Some Notations

N : set of objects |N | = n

σ : (D(σ) L(σ)) (D, L)

configuration define conflict

Assumptions(for technical reasons)

• D is bounded by constant

• Valence (no. of σ with same D(σ) is bounded

12

Page 13: Randomized Techniques in Computational Geometry

13

Page 14: Randomized Techniques in Computational Geometry

14

Page 15: Randomized Techniques in Computational Geometry

15

Page 16: Randomized Techniques in Computational Geometry

.

.

..

.

.

..

..

..

.

.

..

..

.

.

.

.

.

..

.

..

.

.

.

.

.

..

...

16

Page 17: Randomized Techniques in Computational Geometry

.

.

..

.

.

..

..

..

.

.

..

..

.

.

.

.

.

..

.

..

.

.

.

.

.

..

...

17

Page 18: Randomized Techniques in Computational Geometry

.

.

..

.

.

..

..

..

..

.

..

..

.

.

.

.

.

..

.

..

.

.

.

.

.

..

...

18

Page 19: Randomized Techniques in Computational Geometry

.

.

..

.

.

..

..

..

..

.

..

..

.

.

.

.

.

..

.

..

.

.

.

.

.

..

.

19

Page 20: Randomized Techniques in Computational Geometry

Need for bounded degree

All lines tangential to a circle

Any subset of size r induces a face that intersects n− r lines.

20

Page 21: Randomized Techniques in Computational Geometry

Some Notations cont’d

• Π(N) : set of configurations (multiset) over N

• Πi(N) : set of configurations with conflict size =i

• Π0(R) : configurations active

For R ⊂ N , σ is feasible (for R) if D(σ) ⊂ R

We shall often use Π(N) to also denote |Π(N)|

21

Page 22: Randomized Techniques in Computational Geometry

22

Page 23: Randomized Techniques in Computational Geometry

A

B

23

Page 24: Randomized Techniques in Computational Geometry

A simple combinatorial bound

Claim Πa(N) = O(2a+d ·E[Π0(R)])

where R is a random sample of size n/2.

Π0(R) =∑

σ∈Π(N) Iσ,R

where Iσ,R is 1 if σ is feasible.

E[Π0(R)] = E[∑

σ∈Π(N) Iσ,R] =∑

σ∈Π(N) E[Iσ,R]

=∑

σ∈Π(N) Prσ ∈ Π0(R)

≥∑

σ∈Πa(N)σ ∈ Π0(R)

= Πa(N) · 12a+d

24

Page 25: Randomized Techniques in Computational Geometry

Claim :

Pr maxσ∈Π0(R)

l(σ) ≥ cn

rlog r ≤

1

2

|R| = r by Bernoulli sampling

p(σ, r) : conditional probability that none of the k conflicting

element are selected given σ is feasible

≤ (1− r/n)k

≤ e−c log r for k ≥ cn/r ln r

BAD σ

= 1/rc

25

Page 26: Randomized Techniques in Computational Geometry

q(σ, r) : Prob. that D(σ) ⊂ R

Prob. that σ ∈ Π0(R) = p(σ, r)× q(σ, r)

Prob. that some σ ∈ Π0(R) is BAD (l(σ) ≥ c(n ln r)/r) :

≤1

rc

σ∈Π(N)

q(σ, r)

=1

rcE[Π(R)]

(usually Π(R) = rO(1))

≤ 1/2 for appropriate c

26

Page 27: Randomized Techniques in Computational Geometry

Sum of subproblem sizes

Def: c-order conflict

l(σ)

c

, for some c ≥ 0

Let Tc =∑

σ∈Π0(R)

l(σ)

c

Remark For technical reasons it is not l(σ)c. T0 = |Π0(R)|. T1 =

sum of subproblems.

Claim E[Tc] = O((

nr

)cE[Πc(R)])

For constant c, E[Πc(R) = O(E[Π0(R)] implying that average conflict size is

very close to n

r

27

Page 28: Randomized Techniques in Computational Geometry

Prσ ∈ Πc(R) = Prd(σ)defining elements chosen and c out of

l(σ) conflicting elements not chosen

E[Tc] =∑

σ∈Π(N)

l(σ)

c

pd(σ) · (1− p)l(σ) for l(σ) ≥ c.

=∑

σ∈Π(N)

l(σ)

c

pd(σ)+c · (1− p)l(σ)−c ·(

1−pp

)c

≤(

1−pp

)c

·E[Πc(R)]

≤(

1p

)c

·E[Πc(R)]

where p = rn.

28

Page 29: Randomized Techniques in Computational Geometry

Improvements - Tail estimates ?

29

Page 30: Randomized Techniques in Computational Geometry

Improvements - Tail estimates ?

n2

s log log n

Pr no segments in S’ is selected ≥

(

1

2

)log log n

= Ω(1

log n)

⇒ With Prob. Ω( 1log n

), # of intersections is Ω(n log log n)

30

Page 31: Randomized Techniques in Computational Geometry

Selecting a GOOD sample w.h.p.

Motivation: In divide-and-conquer algorithms, we are often

interested in bounding the maximum size of subproblems for which

we need tail estimates including the sum of subproblem sizes.

Since sample is GOOD in the expected sense, the probability that

the sum of subproblems is ≤ 2× E[ sum of subproblems ] is ≥ 1/2

from Markov’s inequality.

Implying

If we choose a set of log n independent samples - R1, R2 . . . Rlog n,

at least one is GOOD w.h.p.

How do we know which is good ?

31

Page 32: Randomized Techniques in Computational Geometry

Polling: an efficient resampling technique

1. Choose c log n samples

2. Poll (sample) S′ = nlog2 n

of the input

3. Estimate the goodness of the samples w.r.t. S ′. Choose an Ri

that is good w.r.t. S′ (break ties arbitrarily).

Polling Lemma With high probability we obtain a good sample

by the above procedure.

32

Page 33: Randomized Techniques in Computational Geometry

Consequences of Random Sampling

• Dynamization

• Existence of good splitters : The probabilistic method. There

exists efficient derandomization by method of connditional

probability and divide-and-conquer.

• Improved bounds for important combinatorial measures like

k − sets.

33

Page 34: Randomized Techniques in Computational Geometry

Randomized Incremental Construction (RIC)

Starting from an empty set

Repeat:

1. Insert the next object

2. Update the partial construction (data-structures)

Total Time =∑

i Time to insert the i-th object.

Ts(N) = Total time to insert a sequence s. (s is good if total time

is less).

Expected total time = Expected time for a Random Insertion

sequence (worst case for any input of size n).

34

Page 35: Randomized Techniques in Computational Geometry

Quicksort as R.I.C.

Gradual refinement of partition

.

.

.

.

.(-inf , +inf)

1234567891011

.

.

.

.

.

.

.

.

.

.

.

1234567891011

.

.

.

.

.

.

.

.

.

.

.

X X X X X X X X X X X1 2 3 4 5 6 7 8 9 10 11

35

Page 36: Randomized Techniques in Computational Geometry

Quicksort as R.I.C.

Conflict graph

..

.

.

.

.

.(-inf , +inf)

1234567891011

.

.

.

.

.

.

.

.

.

.

.

1234567891011

.

.

.

.

.

.

.

.

.

.

.

X X X X X X X X X X X1 2 3 4 5 6 7 8 9 10 11

(-inf , 4)

(4 , +inf)

36

Page 37: Randomized Techniques in Computational Geometry

Quicksort as R.I.C.

Conflict graph

..

.

.

.

.

.(-inf , +inf)

1234567891011

.

.

.

.

.

.

.

.

.

.

.

1234567891011

.

.

.

.

.

.

.

.

.

.

.

1234567891011

.

.

.

.

.

.

.

.

.

.

.

X X X X X X X X X X X1 2 3 4 5 6 7 8 9 10 11

(-inf , 1)

(1 , 4)

(4 , 8)

(8 , 10)

(10 , +inf)

37

Page 38: Randomized Techniques in Computational Geometry

A general bound for RIC

Total (amortised) cost = O(edges created in conflict graph)

Edges can be deleted at most once

General Step: R← R ∪ s (both random subsets)

Expected work (#edges created in the conflict graph)=∑

σ∈Π0(R∪s)

l(σ) · Prσ ∈ Π0(R ∪ s)−Π0(R)

From backward analysis this probability is the same as deleting a

random element from R ∪ s which is d(σ)r+1 . Substituting

σ∈Π0(R∪s)

l(σ) ·d(σ)

r + 1=

d(σ)

r + 1

σ∈Π0(R∪s)

l(σ)

= O(d(σ)

r·n

rE[Π0(R ∪ s)])

38

Page 39: Randomized Techniques in Computational Geometry

Backward Analysis

For a fixed set of i + 1 object , what is the probability that the

i + 1-st insertion affects σ ?

Because of random insertion sequence, any one of the fixed set of i + 1 objects

is equally likely to be the last inserted object (by symmetry)

What is the probability that a random deletion from i+1 objects

defines σ ? (pretending to run backwards).

d(σ)

i + 1

Since conditional expected cost depends only on i (independent of

the actual set of objects)

Conditional expected cost = (Unconditional) expected cost

39

Page 40: Randomized Techniques in Computational Geometry

A common scenario E[Π0(R) = O(r).

Total expected cost of RIC =

r=n∑

r=1

O

(

d

r· n

)

= O(n log n) (applicable to convex hulls)

OPEN PROBLEM

Tail estimates

40

Page 41: Randomized Techniques in Computational Geometry

Linear programming (fixed Dim.)

Xd

Max.

Constraints

Non degenerate : Exactly d constraints define the optimum.

41

Page 42: Randomized Techniques in Computational Geometry

42

Page 43: Randomized Techniques in Computational Geometry

43

Page 44: Randomized Techniques in Computational Geometry

44

Page 45: Randomized Techniques in Computational Geometry

Analysis

Td(n) = Expected running time in d dimension for n constraints.

From backward analysis, probability that i-th insertion changes

optimum is di

(d constraints define optimum).

Td(i) = Td(i− 1) + Td−1(i− 1) ·d

i+ O(d)

By induction [Seidel]

Td(n) = O(d!n)

45

Page 46: Randomized Techniques in Computational Geometry

A generic search problem

Given a set S ⊂ U , build a data structure D, so that we can answer

a query quickly.

Issues

• query time

• space for D (space)

• Preprocessing time to construct D

Dynamic version

• Insert update D for S ∪ x, x ∈ U − S

• Delete update D for S − x

Ideal goal is to match the static performance and minimize update

times.

46

Page 47: Randomized Techniques in Computational Geometry

Arrangement Searching

Problem : Given N lines(planes,hyperplanes), build data

structure to do point location(report the face it lies in)

1

2

3

45

6

789

1112

1314

16 1718

19

10

47

Page 48: Randomized Techniques in Computational Geometry

Arrangement Searching cont’d

Dynamic version :

Allow insertion/deletion of lines

1

2

3

45

6

789

1112

1314

15

16 1718

19

20

21

10

48

Page 49: Randomized Techniques in Computational Geometry

Binary search

T (n) ≤ T (n

2) + O(1)

Approximate split :

T (n) ≤ T (αn) + O(1)

where α is a constant < 1(independent of n)

49

Page 50: Randomized Techniques in Computational Geometry

Binary search cont’d

Random split :

T (n) ≤ T (x) + O(1)

where x is random variable uniformly distributed in [1..n]

Pr[T (n) > c log n] <1

n

Examples : • Randomized search trees

• Quick sort

50

Page 51: Randomized Techniques in Computational Geometry

Review of randomized search

Simple binary search

T (n) = T (n

2) + O(1)

Approximate Split

T (n) ≤ T (α · n) + O(1) , α < 1

Random Split

T (n) ≤ T (X) + O(1)

X is a r.v. ∈ [1 . . . n]

Pr[T (n) > c log n] <1

n

Randomized Search Trees/Quicksort

51

Page 52: Randomized Techniques in Computational Geometry

R5

R6

R1R2

R3

R4

R7

52

Page 53: Randomized Techniques in Computational Geometry

R5

R6

R1R2

R3

R4

R7

53

Page 54: Randomized Techniques in Computational Geometry

Generalizing the randomized search tree

• Choose a good sample R of size C.

• Split the input using R and build the data structure recursively

for each subset.

R is good if each subproblem size is less than n/2

• C is large enough such that R is good with probability ≥ 1/2,

i.e. expected number of repetition ≤ 2.

• Height of data structure is O(log n), so search time is O(log n)

• Space Fragmentation makes it super-linear space. In this case

O(

C2 nC

log C)

or

O(nC log C)

54

Page 55: Randomized Techniques in Computational Geometry

R5

R6

R1R2

R3

R4

R7

55

Page 56: Randomized Techniques in Computational Geometry

R5

R6

R1R2

R3

R4

R7

56

Page 57: Randomized Techniques in Computational Geometry

From triangles to triangles

R5

R6

R1R2

R3

R4

R7

57

Page 58: Randomized Techniques in Computational Geometry

Reviewing skip list

58

Page 59: Randomized Techniques in Computational Geometry

Reviewing skip list cont’d

59

Page 60: Randomized Techniques in Computational Geometry

Reviewing skip list cont’d

60

Page 61: Randomized Techniques in Computational Geometry

A slightly different version

Choose an element to be in the sample with probbility 0.5

Li

Expectation[Li] = 2

PUGH Exp.[Total] = O(log n)

Improvement with careful analysis [Sen 91]:

Total < c log n with probability 1− 1nc

61

Page 62: Randomized Techniques in Computational Geometry

Overall structure

S

SInteraction

RandomSampling

OracleDescendence

1

62

Page 63: Randomized Techniques in Computational Geometry

Overall structure

S

SSearch

DataStructure

Interaction

RandomSampling

OracleDescendence

S

1

2

63

Page 64: Randomized Techniques in Computational Geometry

Descendence oracle for skip-lists

For each level Li, maintain a linked-list of elements of Li−1 that an

interval [a, b], a, b ∈ Li intersects.

a b

i

L

L

i

i -1

64

Page 65: Randomized Techniques in Computational Geometry

Descendence oracle for arrangement searching

How many triangles of level i intersect a triangle of level i− 1 ?

O(n

r

)

whp from Random sampling lemma

Descendence oracle can be a simple data structure storing the

intersections between triangles of successive levels and takes time

O(log n) w.h.p.

implying O(log2 n) time w.h.p for overall query.

65

Page 66: Randomized Techniques in Computational Geometry

Updates

66

Page 67: Randomized Techniques in Computational Geometry

Update

67

Page 68: Randomized Techniques in Computational Geometry

Zone lemma

Size of zone is O(n), i.e. only O(n) triangles must be updates at

each level.

68

Page 69: Randomized Techniques in Computational Geometry

Bounds

• Searching O(log n) w,h.p.

• Update O(n log n) w.h.p.

• Space O(n2)

Dimension d (fixed)

• Searching O(logd−1 n) w.h.p.

• Update O(nd−1 log n) w.h.p.

• Space O(nd)

[Mu-Sen]

69