KTT 和其近似问题

· · 个人记录

A Data-Structure for Approximate Dynamic Envelope in 2D

中文版在施工。

Introduction

The maintenance of geometric envelopes---the pointwise maximum or minimum of a set of functions---is a fundamental problem in computational geometry with far-reaching applications in computer graphics, motion planning, and optimization. As a result, there has been a great deal of work on implementing high-speed algorithm for maintaining geometric envelopes around last decades [@Edelsbrunner1989; @BASCH19991; @ALEXANDRON2007144]. After finding the tight upper bound of this problem [@Sharir1994], approximate algorithms are introduced [@BAREQUET200191; @10.1145/1008731.1008736; @Schulz2011]. Then, in dynamic settings, algorithms are created to maintain the envelopes [@10.1145/1008731.1008736; @ALEXANDRON2007144; @Botana2017].

Problem Formulation

Let F = \{f_1,f_2,\dots,f_N\} be an indexed set of univariate polynomial functions: f_{i}:\mathbb{R}\rightarrow \mathbb{R}. The upper envelope \mathfrak U_F(x), lower envelope \mathfrak L_F(x), and extent \mathfrak E_F(x) are defined as:

​ \begin{aligned} ​ \mathfrak U_F(x) & = \max\{f_i(x) \mid f_i \in F\} \\ ​ \mathfrak L_F(x) & = \min\{f_i(x) \mid f_i \in F\} \\ ​ \mathfrak E_F(x) & = \mathfrak U_F(x) - \mathfrak L_F(x) ​ \end{aligned} \end{equation}

We wish to maintain F under a sequence of the following operations online:

To make it more convenient, let Q, M, T and N denote the numberof q ueries, insertions/deletions, interval translations and functions, we regard Q, M, T = O(N). Let s denotes the degree of functions.

Literature Review

The problem of maintaining the envelope of a set of functions in 2D has deep roots in computational geometry and has been approached from multiple perspectives, ranging from exact solutions for specific function classes to approximate generalized frameworks. This review systematically examines the evolution of these techniques, with particular attention to the key challenges of dynamism, approximation, and handling complex operations like bulk translations.

Exact Envelope Structures for Linear Functions

The foundation of envelope maintenance lies in the study of the convex hull of points in the plane, which is dual to the upper envelope of lines.

These exact structures, while optimal for lines, do not extend efficiently to non-linear functions. The upper envelope of N parabolas, for instance, can have complexity \Theta(N \alpha(N)) [@AGARWAL20001], and maintaining it exactly under dynamic updates becomes significantly more complex.

Kinetic Data Structures for Moving Points

The problem of tracking attributes of moving points, such as the convex hull, introduced the concept of kinetic data structures (KDS)[@BASCH19991].

The KDS framework is a natural fit for the translate operation, as a translation corresponds to a change in the time variable x. However, standard KDS focuses on fixed motion plans and is not primarily designed for the bulk updates and dynamic function insertions or deletions central to our problem.

Approximation Schemes for Envelopes

To overcome the high complexity of exact envelopes, a rich line of research has focused on \epsilon-approximations.

These approximation schemes form the mathematical basis of it, demonstrating that the complexity of the envelope can be made independent of N, depending only on \epsilon.

Data Structures for Bulk Updates

Handling bulk operations efficiently requires moving beyond point updates to range updates.

Background - Kinetic Tournament Tree

First, we introduce Davenport-Schinzel Sequences [@AGARWAL20001], used to analysis the time complexity of the Kinetic Tournament Tree.

Definition 1 ((n, s) Davenport-Schinzel Sequences [@AGARWAL20001]).

Let n and s be two positive integers. A sequence U=\langle u_1,\dots ,u_m \rangle of integers is an (n, s) Davenport-Schinzel Sequences if it satisfies the following conditions:

We define

​ \lambda_s(n) = max\{|U|\ |\ U \text{ is an $(n, s)$ Davenport-Schinzel Sequences}\} \end{equation}

Theorem 2 ([@AGARWAL20001]). Let F=\{f_1,\dots,f_n\} be a collection of n real-valued, continuous totally defined functions, with highest s degree. The number of intersection points on the lower envelope of F is \lambda_s(n)

To solve the exact problem, Kinetic Tournament Tree is promoted, but requires an extra property on Q queries:

x_q \leq x_{q+1}, \quad \forall q \in [1, Q - 1] \end{equation}

Because the translate operation is in a contiguous interval of incdices, the naive idea is to store f_i at index i. Thus we can construct the kinetic tournament tree by store the functions in the leaf node, the certificate for each node is to compare the function value from 2 children at current queries. The winner is kept in the current node, and its information is provided to the node's parent.

Queries Only

In the construction of the Kinetic Tournament Tree, it costs O(N) compares and the root node is the function with minimal slope. As the x_q increasing, some certificates become invalid. We search it from the root and update the certificate for each.

Lemma 3. *Let N and Q denote the number of functions and queries. Kinetic Tournament Tree answers queries in O(\lambda_{s}(N)\log^2 N + Q)​ time complexity.

Proof. The number of intersection points of among N s-degree functions are \lambda_s(N). The total intersection points of all Kinetic Tree vertices is O(\lambda_s(N)\log N). Because the tournament tree is balanced, with height O(\log N), each intersection point will invalidate a certificate, an update costs O(\log N). Thus totally we can maintain the upper envelope in O(\lambda_{s}(n)\log^2 N) with answering each query in constant time. ◻

Although the result is not satisfied, compare to the result of fractional cascading [@Chazelle1986] in O(\lambda_s(N)\log N), we will see the potential of this approach for more complex problems.

Insertions and Deletions

Based on insertions and deletions, we can regard the functions as partially functions, which starts from the query just after inserting it and ends at the query just before deleting it.

Theorem 4 ([@AGARWAL20001]). Let F be a collection of n partially defined, continuous, univariate functions, with at most s intersection points between the graphs of any pair. Then the complexity of lower envelope is O(\lambda_{s+2}(n)).

Lemma 5. Let N, M and Q denote the number of functions, insertions/deletions and queries. Kinetic Tournament Tree answers all queries in O(\lambda_{s+2}(N+M)\log^2 N + Q) time complexity.

Proof. We regard insertion and deletion as the functions are partially defined on the time line. Thus we have at most (N+M) partially functions. By Theorem 4, The complexity is O(\lambda_{s+2}(N+M)). Using the same method without insertions and deletions, we can maintain the upper envelope in O(\lambda_{s+2}(N+M)\log^2 N + Q). ◻

Bulk Updates

It is trivial to complete the operation. Using the lazy propagation to record the amount by which the function shifts to the left and up separately. The key challenge is to analysis the time it costs.

Theorem 6. Let N, M, T and Q denote the number of functions, insertions/deletions, interval translations and queries, Kinetic Tournament Tree answers all queries in O(Ns (\log N)^{1+\log_2{(s+1)}} + (M+T)s(\log n)^{2+\log_2{(s+1)}}) time complexity.

Let d(x) and I(x) denote, the depth of a vertex and the number of intersection points of two functions from x's children, after current x_q. The root has depth of 1. We consider to use amortized analysis. Let \phi(x) denotes the potential of a tree vertex. we define \phi(x) as:

​ \phi(x) = d(x)^{\log_2{(s+1)}}I(x) \end{equation}

Then, let \Phi be the potential of the whole data structure. We define \Phi as:

​ \Phi = \sum_x\phi(x) \end{equation}

Let c denote the actual cost of one certificate invalidate, and \hat{c} denote the amortized cost of one certificate invalidate. We define c=1, then \hat{c} = 1+\Delta\Phi. Let \Phi and \Phi^\# denote the potential before and after an certificate invalidation is solved.

​ \begin{aligned} ​ \hat{c} &= 1 + \Delta\Phi\\ ​ &= 1 + \Phi^\# - \Phi\\ ​ &= 1 + (\phi^\#(\text{parent}_x) - \phi(\text{parent}_x)) + (\phi^\#(x) - \phi(x))\\ ​ &\leq 1 + s(d(x)-1)^{\log_2{(s+1)}} - d(x)^{\log_2{(s+1)}}\\ ​ &\leq 0 ​ \end{aligned} \end{equation}

Then, plug in \hat{c} back to the time complexity analysis equation.

​ \begin{aligned} ​ \sum c &= \sum \hat{c} - \Phi_t + \Phi_s\\ ​ &\leq \Phi_s - \Phi_t\\ ​ &= O(Ns (\log N)^{\log_2{(s+1)}}) ​ \end{aligned} \end{equation}

After that, we need to analysis the impact from modification to the potential of data structure. For an insertion, deletion, or interval translation operation, each will at most increasing O(s(\log N)^{1+\log_2{(s+1)}}) In total, certificate invalidation will happen O(Ns (\log N)^{\log_2{(s+1)}} + (M+T)s(\log N)^{1+\log_2{(s+1)}}), For each update of certificate, it costs \mathcal O(\log N). Finally, we can complete all of these operations in O(Ns (\log N)^{1+\log_2{(s+1)}} + (M+T)s(\log N)^{2+\log_2{(s+1)}}).

Our Method

Kinetic Tournament Tree greatly solve the problem, but requires extra property of monotonicity on queries. We can only translate functions to one side of left and right. However, the problem itself does not provide such property.

To address this case, we introduce a new data structure for approximate result of problem. The main idea is to store the \epsilon-kernel with a higher precision in each tree vertex for its whole subtree. In the root vertex we can find an \epsilon-approximate result of all functions, without the restriction on the monotonicity of queries.

Definition 7 (\epsilon-kernel [@10.1145/1008731.1008736]). Let F = \{f_1,\dots,f_n\} be a set of univariate functions defined over x\in R. Let \epsilon > 0 be a parameter, and \Delta be a subset of \mathbb{R}. We say that a subset G\subseteq F is an \epsilon-kernel of F within \Delta if (1-\epsilon)\mathfrak E_{F}(x) \leq \mathfrak E_{G}(x) for each x\in \Delta. if \Delta = \mathbb{R}, we say that G is an \epsilon-kernel of F.

Our goal is to maintain the \epsilon-kernel of the functions under the operations.

Linear Functions

Theorem 8 ([@10.1145/1008731.1008736]). Let H be a set of n univariate functions and let \epsilon > 0 be a parameter. We can compute in O(n+1/\epsilon) time an \epsilon-kernel of H of size O(1/\epsilon), or in O(n+1/\epsilon^{3/2}) time an \epsilon-kernel of H of size O(1/\epsilon^{1/2}).

We construct the \epsilon-kernel of the functions by dual them as the points and then using affine operations to make them as a fat-node set, which can be done in linear time [@BAREQUET200191]. Finally, within the fat-node set, the ratio of distance around all direction from origin between segments on original convex hull and \epsilon-kernel's convex hull can be easily guaranteed, so dose the construction algorithm.

However, merging kernels requires strict restrictions [@agarwal2011mergeable]. Thus because the height of tournament tree is O(\log N), for each layer, we allow an error of (\epsilon / \log N), and add them up to have an \epsilon-kernel.

Therefore, each vertex stores (\epsilon/\log nN)-kernel of its subtree. Totally we can construct the data structure in O((1/\epsilon)N\log^2 n).

Lemma 9 ([@10.1145/1008731.1008736]). Let T : \mathbb{R} \to \mathbb{R} be a translation transformation, i.e., there exists c \in \mathbb{R} such that T(x) = x + c for all x \in \mathbb{R}. Let F be a family of univariate functions f : D \to \mathbb{R} with D \subset \mathbb{R}, and let G \subseteq F be an \epsilon-kernel of F. Define T(F) = \{ T \circ f \mid f \in F \} and T(G) = \{ T \circ g \mid g \in G \}. Then T(G) is an \epsilon-kernel of T(F).

Thus, it is trivial to using lazy propagation to maintain the \epsilon-kernel of a vertex, and update its parent.

Because for each vertex on tree, the \epsilon-kernel it records is of size O(1/\sqrt{\epsilon}), thus when we update the vertex, the time complexity is only O(1/\epsilon)

Therefore, in total, the time complexity is O((1/\epsilon)(N+M+T)\log^2 N).

Polynomial Functions

By using the linearization technique, we can transfrom the k-degree polynomial functions into the k-variable linear functions. Based on this, we can non-trivially get the solution for O((1/\epsilon)^k(N+M+T)\log^{1+k}n), but we can achieve better results.

Theorem 10 ([@10.1145/1008731.1008736]). Let F=\{f_1,\dots,f_n\} be a family of univariate polynomials that admits a linearization of dimension k, and let \epsilon > 0 be a parameter. We can compute in time O(n+1/\epsilon^{3k/2}) an \epsilon-kernel of F of size O(1/\epsilon).

Based on Theorem 10, we can still conclude that O(1/\epsilon) size of \epsilon-kernel is stored on each tree vertex. Hence the complexity of univariate polynomial functions, is bounded by O((1/\epsilon^2)(N+M+T)\log^3 n).

References

[1] P. K. Agarwal, G. Cormode, Z. Haung, J. M. Phillips, Z. Wei, and K. Yi. Mergeable coresets. 2011.

[2] P. K. Agarwal, S. Har-Peled, and K. R. Varadarajan. Approximating extent measures of points. J. ACM, 51(4):606–635, July 2004.

[3] P. K. Agarwal and M. Sharir. Davenport-schinzel sequences and their geometric applica- tions. In J.-R. Sack and J. Urrutia, editors, Handbook of Computational Geometry, pages 1–47. North-Holland, Amsterdam, 2000.

[4] G. Alexandron, H. Kaplan, and M. Sharir. Kinetic and dynamic data structures for convex hulls and upper envelopes. Computational Geometry, 36(2):144–158, 2007.

[5] G. Barequet and S. Har-Peled. Efficiently approximating the minimum-volume bounding box of a point set in three dimensions. Journal of Algorithms, 38(1):91–109, 2001.

[6] J. Basch, L. J. Guibas, and J. Hershberger. Data structures for mobile data. Journal of Algorithms, 31(1):1–28, 1999.

[7] F. Botana and T. Recio. Computing envelopes in dynamic geometry environments. Annals of Mathematics and Artificial Intelligence, 80(1):3–20, may 2017.

[8] G. Brodal and R. Jacob. Dynamic planar convex hull. In The 43rd Annual IEEE Symposium on Foundations of Computer Science, 2002. Proceedings., pages 617–626, 2002.

[9] B. Chazelle and L. J. Guibas. Fractional cascading: II. applications. Algorithmica, 1(1):163–191, nov 1986.

[10] H. Edelsbrunner, L. J. Guibas, and M. Sharir. The upper envelope of piecewise linear functions: Algorithms and applications. Discrete & Computational Geometry, 4(1):311– 336, aug 1989.

[11] M. Keil. A simple algorithm for determining the envelope of a set of lines. Information Processing Letters, 39(3):121–124, 1991.

[12] M. H. Overmars and J. van Leeuwen. Maintenance of configurations in the plane. Journal of Computer and System Sciences, 23(2):166–204, 1981.

[13] T. Schulz and B. J¨uttler. Envelope computation in the plane by approximate implicitization. Applicable Algebra in Engineering, Communication and Computing, 22(4):265–288, nov 2011. 10

[14] M. Sharir. Almost tight upper bounds for lower envelopes in higher dimensions. Discrete & Computational Geometry, 12(1):327–345, sep 1994.