parametric search (ppt by indranil nandy)

29
Parametric Search Parametric Search What it is and how to make it What it is and how to make it practical practical Presented by Presented by Indranil Nandy Indranil Nandy Guided by Guided by Prof. Arijit Bishnu Prof. Arijit Bishnu

Upload: indranil-nandy

Post on 15-Oct-2014

467 views

Category:

Documents


4 download

DESCRIPTION

A presentation in Parametric Search

TRANSCRIPT

Page 1: Parametric Search (PPT by Indranil Nandy)

11

Parametric SearchParametric Search

What it is and how to make it practicalWhat it is and how to make it practical

Presented by Presented by Indranil Nandy Indranil Nandy

Guided by Guided by Prof. Arijit BishnuProf. Arijit Bishnu

Page 2: Parametric Search (PPT by Indranil Nandy)

22

Linear SearchLinear SearchBinary SearchBinary SearchHashingHashing .. .. ..Parametric SearchParametric Search -what it is-what it is

Page 3: Parametric Search (PPT by Indranil Nandy)

33

Parametric SearchParametric Search

optimization technique developed by Megiddo in the late 1970s and early 1980s

has become an important tool for solving many geometric optimization queries efficiently

Page 4: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 44

What is Parametric What is Parametric Search?Search?Parametric search can be defined as follows :Parametric search can be defined as follows :

Assume that we have a decision problem P(t) that is monotonous in t. Our task is to find t(=t*), the maximum value of t for which P(t) is true.

Page 5: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 55

What is monotonous function?What is monotonous function? if P(t0) is true, then P(t) is true for all t <= t0. if P(t0) is false, then P(t) is false for all t => t0.

Let, us give an example. Look at the following fig.

q(t) : parametric equation of the rayP(t) : whether q(t) lies on the left of AB

So, P(t) is a monotonous function8 9

q(t)

t = 0

(starting point)

t = t*

A

B

P(t) is true for 0<=t<=t*

P(t) is false for t>=t*

Page 6: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 66

So how to find t* ?So how to find t* ? We will find t* with the technique called Parametric We will find t* with the technique called Parametric

Searching.Searching. For Parametric Searching to be used it must have the For Parametric Searching to be used it must have the

following property :following property : we have an algorithm As that solves the

decision problem P, and that can determine for any input value t whether t < t*, t = t*, or t > t* [It may seem strange that we do not know t*,then how to compare any given input with t*…mainly the equality test? Think for the previously given example, there if we know the equation of AB then it is possible to say for any t whether q(t) is on AB (i.e.t=t*) or it lies on the left (i.e. t<t*) or on the right(t>t*),though we do not know t*!!]

the flow of control of As depends on comparisons

Page 7: Parametric Search (PPT by Indranil Nandy)

77

Let, the domain of t is (-Let, the domain of t is (-¥,¥) where ¥ may ¥,¥) where ¥ may be ∞.be ∞.

We can assume any value We can assume any value ΔΔ from the from the domain to be approximated as t* and we domain to be approximated as t* and we can check if it is really t* or less than or can check if it is really t* or less than or greater than with the known algorithm Agreater than with the known algorithm Ass for for the decision problemthe decision problem

But if it solves our problem?But if it solves our problem?

No, there are infinitesimal points in the No, there are infinitesimal points in the domaindomain

So, what will we do?So, what will we do?

Page 8: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 88

How to find t*?How to find t*?

We will use this algorithm for the decision problem We will use this algorithm for the decision problem but slightly changed.but slightly changed.

At every iteration if we can reduce the interval in At every iteration if we can reduce the interval in which t lies then eventually we can get t* from a which t lies then eventually we can get t* from a sufficient small intervalsufficient small interval

Our implementation will do that exactly by using Our implementation will do that exactly by using the decision problem algorithm and finally we will the decision problem algorithm and finally we will get t* as a by-product of running our algorithm, say get t* as a by-product of running our algorithm, say AAGGss ,generic A ,generic Ass algorithm. algorithm.

Page 9: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 99

How does our algorithm AHow does our algorithm AGGSS work? work? The input to The input to AAGGS S is is ΔΔ assumed as an approximation of t* assumed as an approximation of t* AAGGSS will simulate A will simulate Ass on on ΔΔ Now control flow of Now control flow of AAs s depends on comparisons, so the depends on comparisons, so the

quantities that arise in this simulation are going to be quantities that arise in this simulation are going to be rational functions in t*rational functions in t*

Now the comparison of two Now the comparison of two rational bounded functions rational bounded functions of t* of t* can be reduced to testing can be reduced to testing the sign of a single suitable polynomial function the sign of a single suitable polynomial function ff(x(x) at the value t*) at the value t*

In the process of testing the sign of In the process of testing the sign of ff(x), we will actually (x), we will actually reduce the searching interval for t* as a by-productreduce the searching interval for t* as a by-product

Eventually either we will get t* or a sufficient small interval Eventually either we will get t* or a sufficient small interval (u,v) for t* so that it can be approximated by some function (u,v) for t* so that it can be approximated by some function ψψ(u,v) [Actually (u,v) [Actually ψψ depends on the application for which depends on the application for which parametric searching is used.parametric searching is used.

Page 10: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1010

Rational bounded function :Rational bounded function :

A rational function is the ratio of two A rational function is the ratio of two polynomial functionspolynomial functions

A rational function is bounded if both the A rational function is bounded if both the numerator and the denominator are numerator and the denominator are polynomials of bounded degreepolynomials of bounded degree

Page 11: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1111

How to check the sign of a bounded degree How to check the sign of a bounded degree polynomial function f(t) at t = a?polynomial function f(t) at t = a?

ff(t) is a bounded degree polynomial function,so (t) is a bounded degree polynomial function,so all roots of all roots of ff(t) can be found in O(1) time by (t) can be found in O(1) time by using some numerical methods e.g. Newton’s using some numerical methods e.g. Newton’s approximation. Let those be aapproximation. Let those be a00,a,a11,….,a,….,akk..

So So ff(t) can be expressed as below : (t) can be expressed as below :

ff(t) = (t - a(t) = (t - a00)(t – a)(t – a11)…(t - a)…(t - akk))Now, clearly from the above equation sign of Now, clearly from the above equation sign of

f(a) can be foundf(a) can be found

Page 12: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1212

Graphical representation of the control flow of our algorithm AGraphical representation of the control flow of our algorithm AGGSS

Reduced to the comparison of two rational bounded

functions

Reduced to test the sign of a bounded poly

f(x) at x=t*

since As is simulated on the

input

Reduced interval for t* (as a by-product)

I = I ∩ (ri ,ri+1)

Take any value Δ as the approximation for t* from

the reduced interval I

t* found and the Execution aborted

From the sign of the polynomial the outcome

of the comparison isobvious

Δ a

s an

app

rox

of t

*

Page 13: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1313

Newton’s Approximation

As As As As

Find ri and ri+1 such thatri<=t*<=ri+1

Evaluate f(x) for any value xri < x < ri+1 t* foundt*

found

sign off(x) atX=t*

f(x)

Y N

Roots of f(x)

Page 14: Parametric Search (PPT by Indranil Nandy)

1414

What is the running time of AWhat is the running time of AGGSS??Look again at the graphical representation of our algorithm ALook again at the graphical representation of our algorithm Ass. Except . Except for the block of testing the sign of f(x) at x=t*,other blocks will take for the block of testing the sign of f(x) at x=t*,other blocks will take constant order of time. So the running time of As depends on the constant order of time. So the running time of As depends on the running time of that block.running time of that block.

Page 15: Parametric Search (PPT by Indranil Nandy)

1515

What is the running time?What is the running time?Now what is the running time of this block?Now what is the running time of this block?

Let, running time of ALet, running time of Ass is : T is : Tss

No of comparisons made by ANo of comparisons made by Ass (totally in all iterations) : C (totally in all iterations) : Css

O(1)

O(Ts) for

each block

O(1)

Page 16: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1616

So the running time of ASo the running time of AGGSS is O(T is O(TSSCCSS)) How can it be improved?How can it be improved? At each iteration, we were doing comparison for each of At each iteration, we were doing comparison for each of

the roots of f(x), this number can be minimisedthe roots of f(x), this number can be minimised First sort the rootsFirst sort the roots Then starting from the lowest valued root proceed until P(t) Then starting from the lowest valued root proceed until P(t)

(say at t = tx) is false(say at t = tx) is false As P is monotonous, for As P is monotonous, for ҰҰt((t<tx) → P(t)) and t((t<tx) → P(t)) and ҰҰt((t=>tx) → t((t=>tx) →

~P(t))~P(t)) So t* must be in between tx and tx-So t* must be in between tx and tx-11 and we need not and we need not

check the remaining rootscheck the remaining roots This can be furthur improved by using binary search This can be furthur improved by using binary search

technique on the roots to take it for comparison. The technique on the roots to take it for comparison. The median of the roots are found by some linear-time median median of the roots are found by some linear-time median find algorithmfind algorithm

Page 17: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1717

Actually to speed up the execution, our algorithm Actually to speed up the execution, our algorithm AAGGSS is replaced with the parallel version A is replaced with the parallel version App

AApp uses P processors and runs T uses P processors and runs Tpp parallel steps parallel steps Then each parallel step invokes at least P Then each parallel step invokes at least P

independent comparisonsindependent comparisons The cost of simulating a parallel step of AThe cost of simulating a parallel step of App is P + is P +

TTsslogPlogP So, total cost (for TSo, total cost (for Tpp parallel steps) is : parallel steps) is :

TTpp ( P + T ( P + TsslogP )logP ) In most cases the second term dominatesIn most cases the second term dominates

Page 18: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1818

Cost of simulating a parallel step of Cost of simulating a parallel step of AApp is : P + T is : P + TsslogPlogP

As As As As

∩ ∩

logP

ste

ps

Eac

h st

ep

cost

Ts

∆1 ∆2 ∆3 ∆4

Page 19: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 1919

The running time of the previous block is : The running time of the previous block is : P +TslogPP +TslogP

Now if the previous block runs for Tp times Now if the previous block runs for Tp times i.e., total Tp parallel steps then total cost will i.e., total Tp parallel steps then total cost will be Tp( P + TslogP)be Tp( P + TslogP)

Page 20: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2020

RAM ModelRAM Model

Two optimized algorithms for parametric searching Two optimized algorithms for parametric searching named as named as COLE’s optimizationCOLE’s optimization. .

One of these algorithms works under the CREW One of these algorithms works under the CREW PRAM model of parallel computation, and the PRAM model of parallel computation, and the constants in the running time are small. However, constants in the running time are small. However, it does not meet the conditions for applying Cole’s it does not meet the conditions for applying Cole’s optimization.optimization.

The other one works under the EREW PRAM The other one works under the EREW PRAM model; it is more complex than the first algorithm, model; it is more complex than the first algorithm, but Cole’s optimization can be applied to it. but Cole’s optimization can be applied to it.

Page 21: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2121

How is it made practical?How is it made practical? In practical, there are many applications of In practical, there are many applications of

parametric searching (specially in geometrical optimization parametric searching (specially in geometrical optimization techniques), such as :techniques), such as : spanning tree and scheduling problems studied by

Megiddo the slope-selection problem the Fr´echet-distance problem the bottleneck-distance problem the problem of the minimum Hausdorff distance the “median-of-lines”-problem problem of finding the minimum diameter of a

set of moving points

Here, we will discuss, much briefly, the solution of the “mutual visibility problem among spheres” using parametric searching

Page 22: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2222

Mutually Visibility problem among SphersMutually Visibility problem among Sphers

Let S = {S1,S2,…, Sn) be a given set of n spheres in RxRxR, all with the same radius. Let ci denotes the center of Si, for i = 1,…., n. We say that two spheres Si and Sj are mutually visible if the line segment connecting ci with cj does not intersect any other sphere. We say that S is completely mutually visible if every pair of spheres in S is mutually visible.

Our problem is: “Given a set P of n points in RxRxR, we wish to determine the largest possible common radius r such that the set of n spheres of radius r, centered at the given points, is completely mutually visible."

Page 23: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2323

In order to employ the parametric searching technique, we solve the following fixed-size decision problem:

“Given a set of n spheres with the same radius r, determine if it is completely mutually visible".

We use the following simple scheme. For each of the spheres Si, we compute the visibility map of all the other spheres, as viewed from its center ci. We then check that all the centers are visible from ci. This is true for each of the n visibility maps, if and only if the set of spheres is completely mutually visible.

we will use the following interesting property :Lemma : Let S be a collection of n congruent

(nonintersecting) spheres in 3-space, and let p be a point outside the spheres. If the centers of all spheres are visible from p then the complexity of the visibility map of the spheres, as seen from p, is O(n).

Page 24: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2424

The idea is now to compute the visibility map of the spheres from each center ci, using the output sensitive hidden surface removal algorithm. The algorithm runs in time O((n+k) log2 n), where k is the combinatorial complexity of the visibility map.

If the algorithm runs for too long, we stop it and conclude, in view of the preceding lemma, that not all centers are visible from ci. Otherwise the algorithm terminates and then we check whether all centers are indeed visible. This takes, over all visible maps, a total time of O(n2 log2 n).

Based on this sequential algorithm , we can develop a parallel algorithm whose running time is O(log2 n) using O(n log n + k) processors.

Page 25: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2525

Why parametric searching?Why parametric searching?

It is a powerful and ingenious tool for solving efficiently a variety of optimization problems

Many problems of this kind, which can be easily attacked by the technique, are either solved by more complicated and more ad-hoc techniques, or are simply left unsolved.

Page 26: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2626

DrawbacksDrawbacks

It requires the design of an efficient parallel algorithm for the generic version of the decision problem, which is not always easy

The algorithm is rather complex and the constants hidden in the O-notation are very large

Page 27: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2727

ReferencesReferences

P. K. Agarwal and M. Sharir : efficient algorithms for geometric optimization. ACM Comput. Surv.,1998.

N. Megiddo. : Combinatorial optimization with rational objective functions. Math. Oper. Res.,1979.

P.K. Agarwal, M. Sharir and S. Toledo : Applications of parametric searching in geometric optimization, manuscript, 1991.

Page 28: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2828

Page 29: Parametric Search (PPT by Indranil Nandy)

17 th Oct,200617 th Oct,2006 2929