Experimental Evaluation of Parametric Search Algorithms

Experimental Evaluation of Parametric Search Algorithms

EuroCG 2014, Ein-Gedi, Israel, March 3–5, 2014 Experimental Evaluation of Parametric Search Algorithms Ivaylo Ilinkin∗ Abstract Algorithm 2 [4]: Compute a tangent through a given point, p, to the k-level in the arrangement. This paper provides an experimental report on im- plementation of parametric search algorithms. The Algorithm 3 [2]: Compute the k-th vertex in the algorithms are due to Matouˇsek and Cole et al. and arrangement. answer the following questions about an arrangement of n lines: (a) compute a tangent to the k-level with Note that the implementations discussed in this pa- a given direction d; (b) compute a tangent to the k- per have an extra O(log n) factor, since the frame- level through a given point p; and (c) compute the work of van Oostrum and Veltkamp does not include k-th vertex in the arrangement. The implementa- Cole’s technique [1]. Future work will consider adapt- tions are based on the framework of van Oostrum and ing the implementations to the framework of Goodrich Veltkamp, which simplifies considerably the develop- and Pszona [3], which has expected running time that ment of parametric search algorithms. matches Cole’s improvement. 1 Introduction 2 Parametric Search Framework Parametric search is an optimization technique that The framework of van Oostrum and Veltkamp [8] has been used to obtain efficient algorithms for a wide simplifies considerably the task of implementing range of problems [5]. In the parametric search setting parametric search algorithms by requiring that the one considers a decision problem, P (λ), that is mono- user provide only a small number of classes: tone in a real-valued parameter λ, i.e. if P (λ′) = T , then P (λ) = T for λ < λ′. The goal is to find the Polynomials class: This is a representation of the largest value, λ∗, for which P (λ)= T . During its ex- objects that are compared during the search. Here ecution a parametric search algorithm maintains an the polynomials are the given lines. The outcome ∗ of the comparison depends on a critical value, λij , interval, (λlo, λup), where λ lies. This interval is re- fined repeatedly by updating one of the bounds until defined by the polynomials ℓi and ℓj. λ∗ is discovered as one of the intermediate computa- ∗ Comparison class: This compares two polynomials tions, or the interval is small enough that λ can be ∗ computed directly. at the unknown value λ . The framework collects Despite its successful applications to a number of independent comparisons in a single batch to be problems, parametric search algorithms are consid- resolved efficiently later once the answers for the λ ered difficult to implement, and therefore, the tech- associated critical values, ij , are known. nique has been primarily of theoretical interest. In- deed, until recently the only reported implementa- Solver class: This solves the decision problem, P (λ), for any concrete value, λ, which effectively answers tions of parametric search algorithms were by Schw- ∗ ∗ ∗ erdt et al. [6] and Toledo [7]. Interest in the practical whether λ < λ , λ = λ , or λ > λ . This is an aspects of parametric search was renewed with the expensive computation and the framework ensures work of van Oostrum and Veltkamp [8] and more re- that a number of decision questions are answered cently with the work of Goodrich and Pszona [3]. together in binary search fashion exploiting the monotonicity property. This paper discusses the implementation of the following algorithms due to Matouˇsek [4] and For sorting-based parametric search the framework Cole et al. [2], respectively. Given a set of n lines: offers an implementation of quick sort based on the observation that it allows for convenient batching of Algorithm 1 [4]: Compute a tangent with a given comparisons. To this end, quick sort is modified so direction, d, to the k-level in the arrangement. that during the partition step it first computes, for each comparison of two polynomials, the critical value ∗Department of Computer Science, Gettysburg College, λ that determines the outcome of the comparison, but [email protected] does not evaluate the decision problem, P (λ), yet. 30th European Workshop on Computational Geometry, 2014 ∗ Instead, the decision problem is answered for the me- direction for τ is fixed, the order of ℓi and ℓj changes ∗ dian of the critical values and this single expensive only when rij is crossed. Thus, if rij lies below τ , we comparison computation makes it possible to deduce can intersect ℓi and ℓj with any line with direction d ∗ the answer for half of the comparisons. Therefore, all that is above rij and infer their order along τ . of the O(n) comparisons during the partition step can The decision problem, P (y), that guides the sort is: be answered using only O(log n) expensive evaluations Does the line with direction d and height y intersect of the decision problem. Thus, the running time per the k-level?. Notice that the decision problem exhibits 2 level in quick sort is O(TS log n), or O(TS log n) for the monotonicity property, since as we sweep a line the entire sort over the O(log n) expected levels, where with direction d along the y-axis, the answer is P (y)= ∗ ∗ ∗ TS is the time for the Solver to answer the decision T for all y ≤ y , where y is the height of τ . problem at any concrete value λ. Consider a question about the relative order of ℓi ∗ In essence, the framework abstracts the low-level and ℓj along τ . Form the critical line, τij , through decisions about coordinating the interactions between rij with direction d — if τij intersects the k-level, then ∗ ∗ the Solver and the Comparison classes, which typi- τij is below τ and needs to be raised, i.e. yij < y ; cally has been the challenge in implementing para- otherwise, if τij misses the k-level, then it is above ∗ ∗ metric search algorithms. Now, one can focus only on τ and needs to be lowered, i.e. yij > y . Thus, the the high-level aspects of the problem — implementing answer to the decision problem, P (yij ), answers yij ≶ ∗ ∗ an algorithm for the decision problem and a compar- y , which also answers whether rij is above/below τ . ison predicate for two polynomials. The decision problem can be answered using Proce- dure 1, which makes it possible to use Procedure 2 to ∗ 3 Algorithm 1 determine the order of ℓi and ℓj along τ . Notice that Procedure 1 and Procedure 2 correspond to the Solver Recall that Algorithm 1 seeks to find a tangent with a and Comparison classes, respectively, in the frame- given direction, d, to the k-level in the arrangement of work. Since the Solver’s running time is O(n log n), 3 n lines. This algorithm is mentioned only in passing the running time of Algorithm 1 is O(n log n). in [4], so we provide the details here for completeness. Finally, we highlight the genericity of the frame- Its simplicity makes it a good candidate for illustrat- work and the style of programming that it offers. ing parametric search and the use of the framework. Conceptually, one can view the quick sort algorithm The main idea behind the algorithm is to sort the offered by the framework as an STL-like quick sort. given lines along the unknown tangent τ ∗. While it In fact, the original problem could be solved using an STL-like quick sort — the lines will be sorted correctly may seems strange to attempt to sort along the object ∗ ∗ we are trying to find, nevertheless, if this sorted order along τ , despite the fact that τ is not known: were somehow available, then the vertex at which τ ∗ bool comp(const Line& l1, const Line& l2) touches the k-level will be determined by two adjacent ∗ { lines. In fact, even though τ is not known, the order ∗ Point r = intersection(l1, l2); of two lines, ℓ and ℓ , along τ can be determined if i j result_t side = Procedure_1(r); it is known whether their intersection, rij , lies above ∗ if (side == ON) { abort(); } or below τ . return Procedure_2(l1, l2, side); The following two procedures aid in solving the } overall problem [4]: std::quick_sort(lines.begin(), lines.end(), Procedure 1: Given a line q, the vertices of the k-level comp); lying on q can be found in time O(n log n). Of course, this is an inefficient way of solving the Procedure 1 works by intersecting q with the given problem, since each comparison takes O(n log n) time lines and sorting the intersections. The level of the for Procedure 1 for an overall O(n2 log2 n) time over left-most intersection is computed directly and the the O(n log n) comparisons. Nevertheless, it can be levels of the subsequent intersections are computed helpful to cast the solution in this form, since it ig- ± via a scan along q updating each level by 1 as lines nores the low-level details of parametric search. With- go above/below q The running time is dominated by out the framework we would have to worry about the time to sort the intersections. those details next; instead, we can simply write: Procedure 2: The order of two lines, ℓi and ℓj , vov::quick_sort(lines.begin(), lines.end(), ∗ along τ can be determined in O(1) time assum- Procedure1, Procedure2); ∗ ing that it is known whether rij lies above or below τ . The above is a simplification and used only as a Procedure 2 relies on the observation that since the conceptual illustration.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us