• Keine Ergebnisse gefunden

Geometric Algorithms with Limited Resources

N/A
N/A
Protected

Academic year: 2021

Aktie "Geometric Algorithms with Limited Resources"

Copied!
90
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Geometric Algorithms with Limited Resources

Lecturers:

TA: Hannaneh Akrami (Hana)

hannaneh.akrami95@gmail.com Themistoklis Gouleakis (Themis)

tgouleak@mpi-inf.mpg.de Sándor Kisfaludi-Bak (["Sa:ndor])

skisfalu@mpi-inf.mpg.de

Assignments: biweekly, hand in 50% of total point value to take exam.

Exam: oral, soon after end of teaching.

Lectures are recorded (without video) and uploaded, see mailing list for access.

(2)

Geometric Algorithms with Limited Resources

(3)

Geometric Algorithms with Limited Resources

Typical input: set of points or a metric space.

But! Not proper computatinal geometry course, only what we need.

(4)

Geometric Algorithms with Limited Resources

Typical input: set of points or a metric space.

But! Not proper computatinal geometry course, only what we need.

Sublinear time, property testing.

Sublinear space, streaming.

(5)

Geometric Algorithms with Limited Resources

Typical input: set of points or a metric space.

But! Not proper computatinal geometry course, only what we need.

Sublinear time, property testing.

Sublinear space, streaming.

Recent (mostly after 2000) results, fresh research questions!

(6)

Introduction, concepts from computational geometry

Sándor Kisfaludi-Bak

Geometric algorithms with limited resources Summer semester 2021

(7)

Overview

(8)

Overview

• Computational models, limitations in space

(9)

Overview

• Naive convex hull, gift wrapping in O(1) space

• Computational models, limitations in space

(10)

Overview

• Naive convex hull, gift wrapping in O(1) space

• Classic algorithm: Graham’s scan, O(n logn) time

• Computational models, limitations in space

(11)

Overview

• Naive convex hull, gift wrapping in O(1) space

• Classic algorithm: Graham’s scan, O(n logn) time

• Computational models, limitations in space

• Time-space tradeoff: Chan and Chen’s algorithm

Convex hull

(12)

Overview

• Naive convex hull, gift wrapping in O(1) space

• Classic algorithm: Graham’s scan, O(n logn) time

• Computational models, limitations in space

• Time-space tradeoff: Chan and Chen’s algorithm

Low-dim linear programming

• A classic deterministic algorithm in R2

Convex hull

(13)

Overview

• Naive convex hull, gift wrapping in O(1) space

• Classic algorithm: Graham’s scan, O(n logn) time

• Computational models, limitations in space

• Time-space tradeoff: Chan and Chen’s algorithm

Low-dim linear programming

• A classic deterministic algorithm in R2

• Sublinear space LP (Chan–Chen ’07)

Convex hull

(14)

Real RAM vs. Word RAM

(15)

Real RAM vs. Word RAM

arbitrary real numbers words of size Θ(log n)

Real RAM Word RAM

(16)

Real RAM vs. Word RAM

arbitrary real numbers words of size Θ(log n)

no rounding/floor, no modulo realisticoperations (shifts, etc)

Real RAM Word RAM

(17)

Real RAM vs. Word RAM

arbitrary real numbers words of size Θ(log n)

no rounding/floor, no modulo realisticoperations (shifts, etc)

Real inputs and outputs, can extend with √

., ln(.)

Exact arithmetic for rational inputs with +− ∗/

Real RAM Word RAM

(18)

Real RAM vs. Word RAM

arbitrary real numbers words of size Θ(log n)

no rounding/floor, no modulo realisticoperations (shifts, etc)

Real inputs and outputs, can extend with √

., ln(.)

Exact arithmetic for rational inputs with +− ∗/

Unrealistic power Too restrictive?

Real RAM Word RAM

(19)

Real RAM vs. Word RAM

arbitrary real numbers words of size Θ(log n)

no rounding/floor, no modulo realisticoperations (shifts, etc)

Real inputs and outputs, can extend with √

., ln(.)

Exact arithmetic for rational inputs with +− ∗/

Unrealistic power Too restrictive?

Real RAM Word RAM

Often needed for exact

computation Usually enough for approximations!

(20)

Limited workspace model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

(21)

Limited workspace model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

Read-write workspace 67 177 2.45 28 3.1416

o(n) e.g., O(√

n), or poly(log n))

(22)

Limited workspace model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

Read-write workspace 67 177 2.45 28 3.1416

o(n) e.g., O(√

n), or poly(log n))

7 7 2.45 7 3.1416 7 -0.7

Write-only output stream

written only in sequence!

(23)

Streaming and multi-pass model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

Read-write workspace 67 177 2.45 28 3.14

o(n) e.g., O(√

n), or poly(log n))

7 7 2.45 7 3.14 7 -0.7 Write-only output stream

(24)

Streaming and multi-pass model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

Read-write workspace 67 177 2.45 28 3.14

o(n) e.g., O(√

n), or poly(log n))

7 7 2.45 7 3.14 7 -0.7 Write-only output stream

Stream: Read once and in sequence

(25)

Streaming and multi-pass model

7 7 2.45 7 3.1416 7 -0.7 7 7 7

Read-only input n

Read-write workspace 67 177 2.45 28 3.14

o(n) e.g., O(√

n), or poly(log n))

7 7 2.45 7 3.14 7 -0.7 Write-only output stream

Stream: Read once and in sequence multi-pass,

k-pass: Read k times and in sequence

(26)

Convex hull

Notations, definitions

Rd is d-dimensional Euclidean space P = {p1, . . . , pn} set of n points

X ⊆ Rd is convex if for any p, q ∈ X we have pq ⊆ X

(27)

Convex hull

Notations, definitions

Rd is d-dimensional Euclidean space P = {p1, . . . , pn} set of n points

X ⊆ Rd is convex if for any p, q ∈ X we have pq ⊆ X

conv(P) =





minimum convex set containing P

intersection of convex sets containing P {α1p1 + · · · + αnpn | αi ≥ 0 and Pn

i=1 αi = 1}

Convex hull:

(28)

Convex hull

Notations, definitions

Rd is d-dimensional Euclidean space P = {p1, . . . , pn} set of n points

X ⊆ Rd is convex if for any p, q ∈ X we have pq ⊆ X

conv(P) =





minimum convex set containing P

intersection of convex sets containing P {α1p1 + · · · + αnpn | αi ≥ 0 and Pn

i=1 αi = 1}

P Convex hull:

(29)

Convex hull

Notations, definitions

Rd is d-dimensional Euclidean space P = {p1, . . . , pn} set of n points

X ⊆ Rd is convex if for any p, q ∈ X we have pq ⊆ X

conv(P) =





minimum convex set containing P

intersection of convex sets containing P {α1p1 + · · · + αnpn | αi ≥ 0 and Pn

i=1 αi = 1}

P conv(P) Convex hull:

(30)

Convex hull: input and output

Input: Points with coordianate pairs (x, y) ∈ R2 (e, π), (3, 3), (2.95, 2.9), (√

11, 3.05), (π, e)

p1

p2

p3

p5

p4

(31)

Convex hull: input and output

Input: Points with coordianate pairs (x, y) ∈ R2 (e, π), (3, 3), (2.95, 2.9), (√

11, 3.05), (π, e)

p1

p2

p3

p5

p4 p1, p4, p5, p3

Output: "corners" in clockwise order

smallest Q ⊆ P s.t. conv(Q) = conv(P)

(32)

Convex hull: input and output

Input: Points with coordianate pairs (x, y) ∈ R2 (e, π), (3, 3), (2.95, 2.9), (√

11, 3.05), (π, e)

p1

p2

p3

p5

p4 p1, p4, p5, p3

non-corner point on bondary:

not in output!

p6 Output: "corners" in clockwise order

smallest Q ⊆ P s.t. conv(Q) = conv(P)

(33)

Convex hull: input and output

Input: Points with coordianate pairs (x, y) ∈ R2 (e, π), (3, 3), (2.95, 2.9), (√

11, 3.05), (π, e)

p1

p2

p3

p5

p4 p1, p4, p5, p3

non-corner point on bondary:

not in output!

p6 Output: "corners" in clockwise order

smallest Q ⊆ P s.t. conv(Q) = conv(P)

(34)

Naive algorithms, workspace O(1)

(35)

Naive Algorithm

Suppose no 3 points on one line. (no collinear triples)

(36)

Naive Algorithm

Suppose no 3 points on one line. (no collinear triples)

p

p0

q

In O(1) time, decide if q is on left or right side of line pp0

sgn

px py 1 p0x p0y 1 qx qy 1

(37)

Naive Algorithm

Suppose no 3 points on one line. (no collinear triples)

p

p0

q

In O(1) time, decide if q is on left or right side of line pp0

sgn

px py 1 p0x p0y 1 qx qy 1

Naive Convex Hull in R2 For each p, p0 ∈ P,

check if all q ∈ P \ {p, p0} is on the left of line pp0. If yes, then p0 follows p in conv(P).

Assemble and output the hull

(38)

Naive Algorithm

Suppose no 3 points on one line. (no collinear triples)

p

p0

q

In O(1) time, decide if q is on left or right side of line pp0

Running time: n

· (n − 2) · O(1) = O(n3)

sgn

px py 1 p0x p0y 1 qx qy 1

Naive Convex Hull in R2 For each p, p0 ∈ P,

check if all q ∈ P \ {p, p0} is on the left of line pp0. If yes, then p0 follows p in conv(P).

Assemble and output the hull

(39)

Less naive algorithm: Jarvis’ March – aka gift wrapping

Algorithm:

Start at leftmost point, find next point with minimum (maxmum) slope.

v1 v1

vi

vi+1 vi

(40)

Less naive algorithm: Jarvis’ March – aka gift wrapping

Algorithm:

Start at leftmost point, find next point with minimum (maxmum) slope.

v1 v1

vi

vi+1 vi

O(hn) time, and enough to keep track of v1, vi, vi+1. O(1) space.

(41)

Less naive algorithm: Jarvis’ March – aka gift wrapping

Algorithm:

Start at leftmost point, find next point with minimum (maxmum) slope.

v1 v1

vi

vi+1 vi

O(hn) time, and enough to keep track of v1, vi, vi+1. O(1) space.

h = size of convex hull. Output-sensitive algorithm.

(42)

Graham’s scan (1972)

(43)

Graham’s Scan idea

Suppose points have distinct x-coordinates.

Let p1, . . . , pn: points sorted with increasing x-coordinates.

(44)

Graham’s Scan idea

Suppose points have distinct x-coordinates.

Let p1, . . . , pn: points sorted with increasing x-coordinates.

p1, pn are on convex hull

p1

pn Upper hull

part of the hull after p1 and before pn in clockwise order

(45)

Graham’s Scan idea

Suppose points have distinct x-coordinates.

Let p1, . . . , pn: points sorted with increasing x-coordinates.

p1, pn are on convex hull

p1

pn

Lower hull Upper hull

part of the hull after p1 and before pn in clockwise order

(46)

Graham’s Scan idea

Suppose points have distinct x-coordinates.

Let p1, . . . , pn: points sorted with increasing x-coordinates.

p1, pn are on convex hull

p1

pn

Lower hull Idea:

Add points left to right, update upper hull after each addition Upper hull

part of the hull after p1 and before pn in clockwise order

(47)

Graham’s Scan: update

p1 Right turn

pi

Left turn

p1

pi

(pi is below last hull segment) (pi is above last hull segment)

(48)

Graham’s Scan: update

p1 Right turn

Add pi to the upper hull

pi

Left turn

p1

pi

(pi is below last hull segment) (pi is above last hull segment)

(49)

Graham’s Scan: update

p1 Right turn

Add pi to the upper hull

pi

Left turn

p1

pi

(pi is below last hull segment) (pi is above last hull segment)

(50)

Graham’s Scan: update

p1 Right turn

Add pi to the upper hull

pi

Add pi but remove previous hull point until left turn disappears

Left turn

p1

pi

(pi is below last hull segment) (pi is above last hull segment)

(51)

Graham’s Scan: update

p1 Right turn

Add pi to the upper hull

pi

Add pi but remove previous hull point until left turn disappears Similalrly for lower hull, after adding pi:

while last three points of lower hull q, q0, pi are a right turn:

remove the middle point q0

Left turn

p1

pi

(pi is below last hull segment) (pi is above last hull segment)

(52)

Graham’s Scan: pseudocode + runtime

Sort P by increasing x-coordinates Add p1, p2 to U and L

for i = 3 to n do

Add pi to U and L

while last three pts of U form left turn do Remove pt preceding pi from U

while last three pts of L form right turn do Remove pt preceding pi from L

return L and reverse of U

(53)

Graham’s Scan: pseudocode + runtime

Sort P by increasing x-coordinates Add p1, p2 to U and L

for i = 3 to n do

Add pi to U and L

while last three pts of U form left turn do Remove pt preceding pi from U

while last three pts of L form right turn do Remove pt preceding pi from L

return L and reverse of U

Running time:

Sorting

O(nlog n)

(54)

Graham’s Scan: pseudocode + runtime

Sort P by increasing x-coordinates Add p1, p2 to U and L

for i = 3 to n do

Add pi to U and L

while last three pts of U form left turn do Remove pt preceding pi from U

while last three pts of L form right turn do Remove pt preceding pi from L

return L and reverse of U

Running time:

Sorting

Each p ∈ P is:

added once to U (same for L)

removed at most once from U (same for L)

O(nlog n)

O(n) O(n) Triplets checked in While loop heads

(55)

Graham’s Scan: pseudocode + runtime

Sort P by increasing x-coordinates Add p1, p2 to U and L

for i = 3 to n do

Add pi to U and L

while last three pts of U form left turn do Remove pt preceding pi from U

while last three pts of L form right turn do Remove pt preceding pi from L

return L and reverse of U

Running time:

Sorting

Each p ∈ P is:

added once to U (same for L)

removed at most once from U (same for L)

O(nlog n)

O(n) O(n)

O (n log n) time, but O (n) space.

Time-optimal because of sorting (was exercise last year)

(56)

Graham’s Scan: pseudocode + runtime

Sort P by increasing x-coordinates Add p1, p2 to U and L

for i = 3 to n do

Add pi to U and L

while last three pts of U form left turn do Remove pt preceding pi from U

while last three pts of L form right turn do Remove pt preceding pi from L

return L and reverse of U

Running time:

Sorting

Each p ∈ P is:

added once to U (same for L)

removed at most once from U (same for L)

O(nlog n)

O(n) O(n) Triplets checked in While loop heads

O (n log n) time, but O (n) space.

Time-optimal because of sorting (was exercise last year) Near-optimal time-space tradeoff:

sorting on RAM requires T · S = Ω(n2/ log n). [Borodin–Cook ’82]

(57)

Convex hull with good time-space tradeoff

(58)

Sorting in sublinear space

Theorem (Munro, Paterson 1980)

Given x and an unsorted array A, we can find the s smallest elements greater than x in A in a single pass, in O(s) space and O(n) time.

We can also sort in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

(59)

Convex hull in sublinear space

Theorem (Chan–Chen 2007)

Given n points in R2, the convex hull can be computed in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

(60)

Sublinear space convex hull pseudocode

v := leftmost point

while v 6= rightmost point do

Find vertical slab σ with s pts whose left wall contains v q0, . . . , qj = upper hull of P ∩ σ

for all p ∈ P to the right of σ do while qj−1qjp is left turn do

j := j − 1

j := j + 1, qj := p Print(q0, . . . , qj)

v := qj

(61)

Sublinear space convex hull pseudocode

v := leftmost point

while v 6= rightmost point do

Find vertical slab σ with s pts whose left wall contains v q0, . . . , qj = upper hull of P ∩ σ

for all p ∈ P to the right of σ do while qj−1qjp is left turn do

j := j − 1

j := j + 1, qj := p Print(q0, . . . , qj)

v := qj

2dn/se passes, O(s) space, O((n/s) · (n + s log s)) time

(62)

Linear Programming in low-dimensional space

(63)

LP with 2 variables: halfplanes in R

2

Given:

min c1x + c2y subject to a11x + a12y ≤ b1

a21x + a22y ≤ b2 . . .

an1x + an2y ≤ bn

(64)

LP with 2 variables: halfplanes in R

2

Given:

min c1x + c2y subject to a11x + a12y ≤ b1

a21x + a22y ≤ b2 . . .

an1x + an2y ≤ bn

c

Given set H of n halfplanes, find extreme point in direction c.

(65)

LP with 2 variables: halfplanes in R

2

Given:

min c1x + c2y subject to a11x + a12y ≤ b1

a21x + a22y ≤ b2 . . .

an1x + an2y ≤ bn

c

Given set H of n halfplanes, find extreme point in direction c. c

OPT

(66)

Deterministic method: paired halfplanes

Lemma [Megiddo, Dyer 1984]

Assuming that T

h∈H H 6= ∅ is bounded from below, we can find OPT in O(n) time.

(67)

Sublinear space low-dimensional LP

We prove:

Theorem (Chan–Chen 2007)

Given n points in R2, the convex hull can be computed in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

Theorem (Chan–Chen 2007)

Given n points in R2, the convex hull can be computed in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

Theorem (Chan–Chen 2007)

Fix δ > 0. Given n half-planes in R2, the lowest point of their intersection can be computed in

• O(1δn1+δ) time

• O(1δnδ) space

• with O(1/δ) passes.

(68)

Sublinear space low-dimensional LP

We prove:

Theorem (Chan–Chen 2007)

Given n points in R2, the convex hull can be computed in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

Theorem (Chan–Chen 2007)

Given n points in R2, the convex hull can be computed in

• O(n2/s + nlog s) time

• O(s) space

• with n/s passes.

Theorem (Chan–Chen 2007)

Fix δ > 0. Given n half-planes in R2, the lowest point of their intersection can be computed in

• O(1δn1+δ) time

• O(1δnδ) space

• with O(1/δ) passes.

We might return to:

Theorem (Chan–Chen 2007)

Given n half-spaces in Rd and δ > 0, the lowest point of their intersection can be computed in

• Od( 1

δO(1) n) time

• Od(δO(1)1 nδ) space

• with O(1/δd−1) passes.

Theorem (Chan–Chen 2007)

Given n half-spaces in Rd, the lowest point of their intersection can be computed in O (n) time and O (logn) space.

(69)

Towards sublinear space LP: filtering and listing

List(r, σ, H)

while H not read through do

h1, . . . , hr := next r halfplanes from H Compute I = h1 ∩ · · · ∩ hr

Print vertical lines through vertices of I that fall in σ

Given stream H of halfplanes, produce stream of vertical lines.

(70)

Towards sublinear space LP: filtering and listing

List(r, σ, H)

while H not read through do

h1, . . . , hr := next r halfplanes from H Compute I = h1 ∩ · · · ∩ hr

Print vertical lines through vertices of I that fall in σ

Given stream H of halfplanes, produce stream of vertical lines.

Given stream H of halfplanes, produce stream of halfplanes.

Filter(r, σ, H)

while H not read through do

h1, . . . , hr := next r halfplanes from H Compute I = h1 ∩ · · · ∩ hr

Print halfplanes involved in ∂(I ∩ σ)

(71)

Towards sublinear space LP: filtering and listing

List(r, σ, H)

while H not read through do

h1, . . . , hr := next r halfplanes from H Compute I = h1 ∩ · · · ∩ hr

Print vertical lines through vertices of I that fall in σ

Given stream H of halfplanes, produce stream of vertical lines.

Given stream H of halfplanes, produce stream of halfplanes.

Filter(r, σ, H)

while H not read through do

h1, . . . , hr := next r halfplanes from H Compute I = h1 ∩ · · · ∩ hr

Print halfplanes involved in ∂(I ∩ σ)

(72)

Sublinear time LP in R

2

Parameter: r

Invariant: solution is in σi and defined by halfplanes in Hi

(73)

Pseudocode

Preserves invariant X LP(r, σ, H)

σ0 := R2

for i = 0, 1, . . . do

if |Hi| = O(1) then

return brute force solution for Hi

Divide σi into r slabs with roughly same # of lines from Listr,σi(Hi) Decide which subslab has the solution, let that be σi+1.

Hi+1 := F ilterr,σi+1(Hi)

(74)

Pseudocode

Preserves invariant X LP(r, σ, H)

σ0 := R2

for i = 0, 1, . . . do

if |Hi| = O(1) then

return brute force solution for Hi

Divide σi into r slabs with roughly same # of lines from Listr,σi(Hi) Decide which subslab has the solution, let that be σi+1.

Hi+1 := F ilterr,σi+1(Hi)

Issue: Hi can’t be stored. We need to recompute it every time.

(75)

Pseudocode

Preserves invariant X LP(r, σ, H)

σ0 := R2

for i = 0, 1, . . . do

if |Hi| = O(1) then

return brute force solution for Hi

Divide σi into r slabs with roughly same # of lines from Listr,σi(Hi) Decide which subslab has the solution, let that be σi+1.

Hi+1 := F ilterr,σi+1(Hi)

LP(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs with roughly same # of lines from

Listr,σi(F ilterr,σi(. . . (F ilterr,σ1(H))))

Decide which subslab has the solution, let that be σi+1 Issue: Hi can’t be stored. We need to recompute it every time.

(76)

Pseudocode

Preserves invariant X LP(r, σ, H)

σ0 := R2

for i = 0, 1, . . . do

if |Hi| = O(1) then

return brute force solution for Hi

Divide σi into r slabs with roughly same # of lines from Listr,σi(Hi) Decide which subslab has the solution, let that be σi+1.

Hi+1 := F ilterr,σi+1(Hi)

LP(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs with roughly same # of lines from

Listr,σi(F ilterr,σi(. . . (F ilterr,σ1(H))))

Decide which subslab has the solution, let that be σi+1 Issue: Hi can’t be stored. We need to recompute it every time.

(77)

Space-efficient pipeline of streams

How to execute Pi(Pi−1(. . . (P1(x))))

if Pj are single-pass processes with worksapce sj and time tj? Pipeline:

x P1 P2 P3 . . . Pi

s1 s2 s3 si

(78)

Space-efficient pipeline of streams

How to execute Pi(Pi−1(. . . (P1(x))))

if Pj are single-pass processes with worksapce sj and time tj? Pipeline:

x P1 P2 P3 . . . Pi

s1 s2 s3 si

Each Pj is either waiting for input, or ready to excute.

Init: all waiting for input

(79)

Space-efficient pipeline of streams

How to execute Pi(Pi−1(. . . (P1(x))))

if Pj are single-pass processes with worksapce sj and time tj? Pipeline:

x P1 P2 P3 . . . Pi

s1 s2 s3 si

Each Pj is either waiting for input, or ready to excute.

Init: all waiting for input

Simulation:

• if all Pj are waiting for input, execute P1

• otherwise, pick largest j ready to execute, and execute one step.

(80)

Space-efficient pipeline of streams

How to execute Pi(Pi−1(. . . (P1(x))))

if Pj are single-pass processes with worksapce sj and time tj? Pipeline:

x P1 P2 P3 . . . Pi

s1 s2 s3 si

Each Pj is either waiting for input, or ready to excute.

Init: all waiting for input

Simulation:

• if all Pj are waiting for input, execute P1

• otherwise, pick largest j ready to execute, and execute one step.

Space: P

j sj + O(1)

(81)

Space-efficient pipeline of streams

How to execute Pi(Pi−1(. . . (P1(x))))

if Pj are single-pass processes with worksapce sj and time tj? Pipeline:

x P1 P2 P3 . . . Pi

s1 s2 s3 si

Each Pj is either waiting for input, or ready to excute.

Init: all waiting for input

Simulation:

• if all Pj are waiting for input, execute P1

• otherwise, pick largest j ready to execute, and execute one step.

Space: P

sj + O(1) Time (mini-hw): O(P

tj)

(82)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

(83)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

Let ni = |Hi|. There are logr(n) iterations, O(logr n) passes.

(84)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

Let ni = |Hi|. There are logr(n) iterations, O(logr n) passes.

Filter pipeline (plus List) in iteration i needs:

O(ri) = O(r logr n) space, O(n0 log r + · · · + ni−1 log r) = O(nlog r) time

(85)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

Let ni = |Hi|. There are logr(n) iterations, O(logr n) passes.

Filter pipeline (plus List) in iteration i needs:

O(ri) = O(r logr n) space, O(n0 log r + · · · + ni−1 log r) = O(nlog r) time ApproxQuant needs O(r log2 ni) space and O(ni log(r log ni)) time. see later!

(86)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

Let ni = |Hi|. There are logr(n) iterations, O(logr n) passes.

Filter pipeline (plus List) in iteration i needs:

O(ri) = O(r logr n) space, O(n0 log r + · · · + ni−1 log r) = O(nlog r) time ApproxQuant needs O(r log2 ni) space and O(ni log(r log ni)) time. see later!

Subslab selection needs O(r) space and O(nr) time.

(87)

Time and space needs

Filter(r, σ, H) σ0 := R2

for i = 0, 1, . . . do

if |F ilterr,σi(. . . (F ilterr,σ1(H)))| = O(1) then

return brute force solution for F ilterr,σi(. . . (F ilterr,σ1(H))) Divide σi into r slabs:

ApproxQuantr Listr,σi(F ilterr,σi(. . .(F ilterr,σ1(H)))) Decide which subslab has the solution, let that be σi+1

Let ni = |Hi|. There are logr(n) iterations, O(logr n) passes.

Filter pipeline (plus List) in iteration i needs:

O(ri) = O(r logr n) space, O(n0 log r + · · · + ni−1 log r) = O(nlog r) time ApproxQuant needs O(r log2 ni) space and O(ni log(r log ni)) time. see later!

Subslab selection needs O(r) space and O(nr) time.

Altogether: O(r logr n + r log2 n) space and O(nr logr n) time.

(88)

Chan-Chen simple LP wrap-up

Theorem (Chan–Chen 2007)

Fix δ > 0. Given n half-planes in R2, the lowest point of their intersection can be computed in

• O(1δn1+δ) time

• O(1δnδ) space

• with O(1/δ) passes.

Altogether: O(r logr n + r log2 n) space and O(nr logr n) time.

(89)

Chan-Chen simple LP wrap-up

Theorem (Chan–Chen 2007)

Fix δ > 0. Given n half-planes in R2, the lowest point of their intersection can be computed in

• O(1δn1+δ) time

• O(1δnδ) space

• with O(1/δ) passes.

Altogether: O(r logr n + r log2 n) space and O(nr logr n) time.

Set r = nδ/2. O

nδ/2 · 2δ + nδ/2 log2 n

= O(1δnδ) O

n · nδ/2 · logn

lognδ/2

= O(1δn1+δ)

(90)

Approximate quantiles

Referenzen

ÄHNLICHE DOKUMENTE

Design 3906-TM adds another option to our already versatile range of anti-fingerprint RESOPAL® Traceless, combining metal and fingerprint resistance in a unique- ly elegant way..

Presently, there are no clear quantitative rules for determining the optimal combination of stand density and mean stem diameter for a protection forest, depending on the

Der Fonds konnte, trotz der seit März anhaltenden Unsicherheit aufgrund der Covid-19-Pandemie und den im Jahresbericht dargestellten Aufwendungen für die Brandschutzmaßnahme,

Jaroslav Hanˇcl, Jan ˇSustek, Radhakrishnan Nair, Pavel Rucki and Dmitry Bodyagin.. Jaroslav Hanˇcl completed his studies in mathematics at Charles University in Prague

Starting with a brief overview of the nexus between the deepening of financial systems and economic growth and development, the paper reviews to what extent financial market

Computability and complexity of real functions and real numbers are studied in a model where methods of recursive function theory as well as methods of numerical analysis

Although a vast range of modeling and simulation tools already exists, automating the mapping from models to simulation codes remains a challenging and elusive goal – even for

Jänner 2011 wurde das neue Roboterdesignlabor an der TU Graz durch Rektor Hans Sünkel in Betrieb genommen und im Rahmen eines Tages der offenen Tür kolleginnen und kollegen