# Parametric Search

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

Linear Search Binary Search Hashing . . . Parametric Search -what it is

2

Parametric 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

3

What is Parametric Search?
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.

17 th Oct,2006

4

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.

A

lse s fa i P(t)

=t or t> f

*

q(t) t=0 (starting point)
e is tru P(t)

t = t*
t<= 0<= for t*

B

q(t) : parametric equation of the ray P(t) : whether q(t) lies on the left of AB So, P(t) is a monotonous function
17 th Oct,2006

89

5

So how to find t* ?
 We will find t* with the technique called Parametric Searching.  For Parametric Searching to be used it must have the 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
17 th Oct,2006 6

Let, the domain of t is (-¥,¥) where ¥ may be ∞. We can assume any value Δ from the domain to be approximated as t* and we can check if it is really t* or less than or greater than with the known algorithm As for the decision problem But if it solves our problem? No, there are infinitesimal points in the domain So, what will we do?
7

How to find t*?
 We will use this algorithm for the decision problem but slightly changed.  At every iteration if we can reduce the interval in which t lies then eventually we can get t* from a sufficient small interval  Our implementation will do that exactly by using the decision problem algorithm and finally we will get t* as a by-product of running our algorithm, say AGs ,generic As algorithm.
17 th Oct,2006 8

How does our algorithm AGS work?
 The input to AG is Δ assumed as an approximation of t*  AG will simulate As on Δ  Now control flow of As depends on comparisons, so the quantities that arise in this simulation are going to be rational functions in t*  Now the comparison of two rational bounded functions of t* can be reduced to testing the sign of a single suitable polynomial function f(x ) at the value t*  In the process of testing the sign of f(x), we will actually reduce the searching interval for t* as a by-product  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) [Actually ψ depends on the application for which parametric searching is used.
S S

17 th Oct,2006

9

Rational bounded function :  A rational function is the ratio of two polynomial functions  A rational function is bounded if both the numerator and the denominator are polynomials of bounded degree

17 th Oct,2006

10

How to check the sign of a bounded degree polynomial function f(t) at t = a?  f(t) is a bounded degree polynomial function,so all roots of f(t) can be found in O(1) time by using some numerical methods e.g. Newton’s approximation. Let those be a0,a1,….,ak.  So f(t) can be expressed as below : f(t) = (t - a0)(t – a1)…(t - ak)  Now, clearly from the above equation sign 17 th Oct,2006 11 of f(a) can be found

Graphical representation of the control flow of our algorithm AGS
Reduced to the comparison of two rational bounded functions Reduced to test the sign of a bounded poly f(x) at x=t*

Δ as an approx of t*

since As is simulated on the input

Reduced interval for t* (as a by-product) I = I ∩ (ri ,ri+1)

t* found and the Execution aborted

Take any value Δ as the approximation for t* from the reduced interval I

From the sign of the polynomial the outcome of the comparison is obvious

17 th Oct,2006

12

f(x)

Newton’s Approximation Roots of f(x)

As

As

As

As

Find ri and ri+1 such that ri<=t*<=ri+1 N t* found

Evaluate f(x) for any value x Y ri < x < ri+1 sign of f(x) at X=t*

t* found

17 th Oct,2006

13

What is the running time of AG ?
S

Look again at the graphical for the block of testing the constant order of time. So running time of that block.

representation of our algorithm As. Except sign of f(x) at x=t*,other blocks will take the running time of As depends on the

14

What is the running time?
Now what is the running time of this block? Let, running time of As is : Ts No of comparisons made by As (totally in all iterations) : Cs
) (1 O for k ) Ts bloc O( h c ea

) (1 O

15

 So the running time of AG is O(TSCS)  How can it be improved?  At each iteration, we were doing comparison for each of the roots of f(x), this number can be minimised  First sort the roots  Then starting from the lowest valued root proceed until P(t) (say at t = tx) is false  As P is monotonous, for Ұt((t<tx) → P(t)) and Ұt((t=>tx) → ~P(t))  So t* must be in between tx and tx-1 and we need not check the remaining roots  This can be furthur improved by using binary search technique on the roots to take it for comparison. The median of the roots are found by some linear-time median find algorithm
S

17 th Oct,2006

16

 Actually to speed up the execution, our algorithm AG is replaced with the parallel version Ap  Ap uses P processors and runs Tp parallel steps  Then each parallel step invokes at least P independent comparisons  The cost of simulating a parallel step of Ap is P + TslogP  So, total cost (for Tp parallel steps) is : Tp ( P + TslogP )  In most cases the second term dominates
S

17 th Oct,2006

17

Cost of simulating a parallel step of Ap is : P + TslogP
∆1 ∆2 ∆3 ∆4

As

As

As

As

∩ logP steps ∩ Each step cost Ts
18

17 th Oct,2006

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

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

17 th Oct,2006

19

RAM Model
 Two optimized algorithms for parametric searching named as COLE’s optimization.  One of these algorithms works under the CREW PRAM model of parallel computation, and the constants in the running time are small. However, it does not meet the conditions for applying Cole’s optimization.  The other one works under the EREW PRAM model; it is more complex than the first algorithm, but Cole’s optimization can be applied to it.
17 th Oct,2006 20

 In practical, there are many applications of parametric searching (specially in geometrical optimization techniques), such as :
 Megiddo       spanning tree and scheduling problems studied by 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
17 th Oct,2006 21

Mutually 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." 

17 th Oct,2006

22

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). 
17 th Oct,2006 23

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) log n), where k is the combinatorial complexity of the visibility map.
2

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(n log n).
2 2

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

17 th Oct,2006

24

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.

17 th Oct,2006

25

Drawbacks
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

17 th Oct,2006

26

References
 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.

17 th Oct,2006

27

17 th Oct,2006

28

17 th Oct,2006

29