Geometric optimization for classification problems
Full text
Geometric Optimization for Classification Problems Pablo P´ erez Lantero 2010
Universidad de Sevilla Escuela T´ ecnica Superior de Ingenieros Dpto. Matem´ atica Aplicada II Geometric Optimization for Classification Problems Memoria de tesis doctoral presentada por Pablo P´ erez Lantero para optar al grado de Doctor en Matem´ aticas por la Universidad de Sevilla Director: Jos´ e Miguel D´ ıaz-B´ a˜ nez Sevilla, Abril de 2010
Universidad de Sevilla Memoria de tesis doctoral para optar al grado de Doctor en Matem´ aticas Autor: Pablo P´ erez Lantero T´ıtulo: Geometric Optimization for Classification Problems Departamento: Matem´ atica Aplicada II V◦B◦Director: Jos´ e Miguel D´ ıaz-B´ a˜ nez El autor: Pablo P´ erez Lantero
A mis padres, a Diana.
Acknowledgements / Agradecimientos First of all, I would like to thank Jos´e Miguel D´ıaz-B´a˜nez for being my advisor. Throughout these years, he has provided me with guidance in research, valuable knowledge, and financial support. I am indebted to him. I give thanks to Inma Ventura for being an excellent partner. We spent a lot of time discussing problems, writing results, and reviewing papers. I am grateful to have collaborated with Jorge Urrutia, Sergey Bereg, and Sergio Cabello. They let me share part of their wisdom and experience in Computational Geometry and Algorithms. I also give thanks to everyone else whom I have worked with in open problem workshops. I would like to show my gratitude with the invitations of: Jorge Urrutia to the UNAM, Sergio Cabello to the University of Ljubljana, Clemens Huemer to the Universitat Polit`ecnica de Catalunya, and Leslie Bajuelos to the University of Aveiro. I acknowledge the projects MEC MTM2006-03909 and MEC MTM2009- 08652 for offering me the problems of this thesis, and, of course, the collaboration project MAEC-AECID of Spain for giving me the scholarship. Gracias a los miembros del Departamento Matem´atica Aplicada II de la Universidad de Sevilla por todo su apoyo, especialmente a Santigo, Soledad, Mari Carmen, Juan Antonio, Julio, Emilio, y por supuesto, Miguel. Gracias a la Universidad de La Habana por mi formaci´on. Gracias a toda mi familia y a todos mis amigos por el apoyo brindado. Estar´e eternamente agradecido de mis padres por ser lo que son, excelentes padres, y sobre todo, por soportar la distancia y alentarme desde lejos. Agradezco a mi esposa, con todo el orgullo de poder hacerlo, por toda su entrega, amor, compa˜n´ıa, y el sustento que me ha dado durante mis estudios.
Resumen La Miner´ıa de Datos es una importante disciplina dentro de la Ciencia de la Computaci´on cuyo objetivo es la exploraci´on de datos para extraer informaci´on potencialmente ´util y previamente desconocida. Usando t´ecnicas matem´aticas como la Investigaci´on Operativa, la Inteligencia Artificial, y m´as recientemente la Geometr´ıa Computacional, la Miner´ıa de Datos est´a resolviendo problemas en muchas ´areas donde hay grandes bases de datos. En el marco de la Geometr´ıa Computacional, las t´ecnicas de Optimizaci´on Geom´etrica pueden ser aplicadas en la resoluci´on de muchos problemas en este campo. Com´unmente, los problemas en Miner´ıa de Datos est´an vinculados a datos de dos clases, rojos y azules, y aparecen en importantes sub´areas como la clasificaci´on de nuevos datos y el reconocimiento de patrones. En esta tesis se estudian problemas de optimizaci´on con aplicaciones en clasificaci´on de datos y reconocimiento de ratrones. En ellos tenemos datos de dos clases representados por puntos rojos y azules en el plano, y consisten en buscar objetos geom´eticos simples cumpliendo propiedades de optimizaci´on. Los problemas son enfocados desde la ´optica de la Geometr´ıa Computacional, y se presentan algoritmos que usan su inherente geometr´ıa. Un problema importante en la Miner´ıa de Datos es el de la Caja M´axima, donde el objeto a buscar es un rect´angulo con lados paralelos a los ejes coordenados que contiene el m´aximo n´umero de puntos de una sola clase. En esta tesis se resuelven algunas variantes de este problema considerando: dos cajas (una para cada clase), el m´ınimo n´umero de cajas para cubrir una clase, o el mantenimiento de la m´axima caja para puntos en movimiento. Com´unmente los met´odos de clasificaci´on suponen una buena distribuci´on de los datos, de tal suerte que puede ser aplicado un procedimiento de agrupaci´on. Sin embargo, si las clases est´an bien mezcladas, no es posible entonces obtener una agrupaci´on para seleccionar luego prototipos que representen una clase. En este sentido, esta tesis estudia un nuevo par´ametro para medir a priori si datos de dos clases son buenos o no para hacer clasificaci´on. 7
Chapter 1 Introduction The framework of this thesis is the application of the techniques from Computational Geometry, specifically from Geometric Optimization, in order to efficiently solve, from the mathematical and algorithmic point of view, problems that arise in application areas such as Data Mining and Classification. Most of these problems have a geometric modeling which will be used in the design of the algorithms. This chapter presents a brief introduction and motivation for the optimization problems in Classification, followed by a short description of the main contributions developed in this thesis and an overview of the organization into chapters. It serves as an extended abstract for the following chapters. 1.1 Computational Geometry Computational Geometry focuses on the design and analysis of efficient algorithms for problems whose mathematical representation is purely geometrical. Computing geometric properties of a set of geometric objects is a classic problem in Computational Geometry. For example, given a set of points in the plane compute their convex hull or the nearest pair of points, given a polygon to obtain one of its triangulations, etc. A deeper goal of Computational Geometry is the study of the computational complexity that is inherent to some geometric problems under different models of computation. For instance, to know if for a specific problem there exists an efficient computational solution. It is well known, for example, that given a set of points in the plane, there is no efficient algorithm capable of finding a tour that visits all points and minimizes the total traveled distance. The handbook of Preparata and Shamos [91] is considered as an introductory book 9
10 1. Introduction to Computational Geometry. A more recent handbook is the one by M. de Berg et al. [40]. We also cite the handbooks of Goodman and O’Rourke [58] and Sack and Urrutia [92], which are very useful to know what has been studied about any topic. Nowadays, Computational Geometry has a wide area of research with many specialized journals and important worldwide congress. 1.2 Geometric Optimization Geometric optimization deals with problems of computing geometric objects which are optimal subject to certain criteria and geometric constraints. Typical examples include facility location, low-dimensional clustering, network design, optimal path planning, shape matching, proximity, and statistical measure problems. In such cases one expects that faster and simpler algorithms can be developed by exploiting the geometric nature of the problem. Much work has been done on geometric optimization problems during the last twenty-five years. Many elegant and sophisticated techniques have been proposed and successfully applied to a wide range of geometric optimization problems. See the paper of Agarwal and Sharir [3] for a comprehensive survey of these techniques. 1.3 Data Mining and Classification Data Mining is a relevant discipline in Computer Science whose main goal is to explore data and extract information that is potentially useful and previously unknown. By using mathematical tools, such as Operation Research, Statistics, Artificial Intelligence, and more recently the Computational Geometry, Data Mining solves problems in many areas where there are big databases, which occasionally have erroneous data or do not contain a well defined structure due to out-of-range data. Data Mining has many applications, for example: in marketing for the segmentation of clients, in banks to evaluate the risk on credits given to clients and to detect credit cards fraud, in internet for the mining of web pages and to filter unwanted emails, and further examples. One of the basic objectives in Data Mining is the classification of new cases, that is, to identify members between two different classes of data. For example, for the diagnosis of cancer, one should be able to discriminate if new laboratory results of a patient correspond to a benign tumor or to a malign tumor. Within the classification methods used in Data Mining,
1.4. Overview, related work and motivation 11 two types are distinguished, the unsupervised and the supervised [28, 66]. In the unsupervised classification, the problem consists in partitioning the data into groups or clusters which are called “classes”. In this way, a new data is classified according to the nearest cluster by considering a function of similitude. In the supervised classification, one is given the big database in which the class or type of each element is previously known. The aim is to create a method or rule that permits, given a new data, to decide which class it belongs to. The diagnosis of cancer is an example of supervised classification. We are given a big historical database of cases, each classified in benign or malign, and the classification rule says the type of a new tumor. 1.4 Overview, related work and motivation In this section we give a brief review of the related literature and provide motivation for each of the problems studied in this thesis. Suppose we have a database of analysis of a specific type of tumor, to be more precise, of a particular human body cells. Each data is a numerical vector of the same dimension, whose components represent the analysis results, for instance, the uniformity of cells shape, the variability of their size, etc. In turn, each vector belongs to one class of two possible: benign or malign. Now, the problem is to build a supervised classification rule, that is, to study the database and obtain a method which, when the results of a new analysis are given and represented in the corresponding numerical vector, determine with high precision in which class the new analysis is. A natural method to perform this classification is the selection of prototypes that represent data of different classes. The classification approach for a new data is to find the most adjusted prototype to it by using a certain function of distance. A standard classification technique is the analysis of clusters in the training data [46], which are the database under study. Then, the prototypes are defined from the clusters. The database, since it consists of numerical vectors of a fixed dimension d, can be seen from the geometrical point of view as a set of points in the Rdspace. That is why some kind of clusters can be obtained by using simple geometric objects such as lines, disks, balls, boxes, strips, etc. For example, Aronov and Har-Peled [10] and Eckstein et al. [48] considered disks and axis-aligned boxes, respectively. Henceforth, the training data will be referred to as points. The points of one class will be colored red and the points of the other class will be colored blue. A condition on the distribution of the point set that is often handled with
12 1. Introduction care is its separability. The separation of the points is a natural way to obtain clusters. The simplest concept of separability is the linear separability that takes place by using a “line”, that is, if there exists a hyperplane that leaves the red points to one of its sides and the blue points to the other one. Assuming that the set of points is linearly separable, a technique frequently applied is the Support Vector Machine (SVM) [66], that is a robust and tested methodology for problems of inference and prototype searching. SVM resides in finding a hyperplane that separates the red points from the blue points, and maximizes the minimum distance of the points to it (Figure 1.1). In this sense, the set of red points will form a cluster as will the set of blue points. Then, the classification method is very simple: if the new data is in the half-plane (half-space) where the red points are, then it is classified red, otherwise it is classified blue. blue points ` p q red points Figure 1.1: The line `is the SVM. The minimum distance from the points to `is maximized. So the nearest red point pto `and the nearest blue point qto `are equidistant from `. Another technique that can be applied to linearly separable point sets is the Perceptron [16]. The appearance of this model was motivated by biological concepts and is defined as follows: Let x∈Rdbe the point that is to be classified. A perceptron, with weights w∈Rdand margin γ∈R, is the following classification rule: xw −γ > 0⇒xis red, and xw −γ < 0⇒x is blue; where xw is the scalar product between xand w.Geometrically speaking, the perceptron with weights wand margin γis the hyperplane xw −γ= 0 that separates the red points from the blue points. Notice that the SVM is a particular case of a perceptron. When the points are not separable by a straight line, other concepts of separation can be considered. For example, in [94] the authors studied the separation in two dimensions by the use of: a wedge, a strip, a set of wedges, a set of strips, a set of lines, etc. (Figure 1.2). Moreover, separation with planes and extensions of their methods in two dimensions are studied in three dimensions. Another study of separation in R3can be found in [1],
1.4. Overview, related work and motivation 13 and separation by using a circle in [20, 78]. Additionally, results concerning separation with convex polygons and simple polygons in the plane can be found in [14, 49, 53, 88]. a) b) c) Figure 1.2: Separation with: a) a wedge, b) a strip, y c) two lines. In some cases, as in medical data analysis [63], classification methods can produce biased classifications due to defective data or data with values out of reasonable ranges. In the terminology of Data Mining, those erroneous data are called outliers. In other cases, we may obtain data hard to classify because of strong similarities between subsets of different classes. Culling the minimum number of such points (outlier data) could be a suitable criterion in order to lose the smallest amount of information possible and the for classification method to be effective. For example, when the points are not linearly separable and we insist on using a line (hyperplane) as the pattern of classification, we could remove the minimum number of points so that the resulting point set is separable by a line. In this direction, we arrive at the so-called Weak Separation Problem (Figure 1.3 a)). See [29, 50] for results in two dimensions. Another useful criterion is to minimize a measure of the classification errors. Related results can be found in [90], in which the authors consider four measures of separation with hyperplanes and spheres in Rd, and give exact and approximated algorithms. The measures used are: the combinatorial measure (i.e. the number of misclassified points), the L∞measure (i.e. the maximum distance of the misclassified points to the separator object), the L1measure (i.e. the sum of the distances of the misclassified points to the separator object), and the L2measure (i.e. the sum of the squares of the distances of the misclassified points to the separator object). Furthermore, modifications to the definition of the Perceptron are studied in [16] and can be applied in case the linear separability is not possible. Another example in this scenario is to find two half-planes, one for each class, which their intersection is a strip of minimum width [80] (Figure 1.3 b)).
14 1. Introduction B R a) b) c) ` q1q2 p1 R B Figure 1.3: a) The weak separation problem. If the red point p1, and the blue points q1and q2are removed, then the linear separability is achieved by the line `. b) The half-planes Rand Bcontain the red points and the blue points, respectively, and the strip R∩B has minimum width. c) The rectangle R(resp. B) contains all the red (resp. blue) points and best fits their convex hull. Classification relies on axis-aligned hyper-rectangles (boxes or rectangles for short) as a main pattern to search clusters and hence prototypes. For numerical data, rectangles generalize multidimensional points and are a good approximation to a description of a subset of them [4, 79]. For instance, in [48, 83] the problem of finding a box containing the maximum number of blue points without containing a red point is studied; and in [44], the one of computing a box of maximum bichromatic discrepancy, that is, the box in which the absolute difference between red and blue points inside it is maximized. The concept of pattern is used in Logical Analysis of Data (LAD) [22], and it is generalized by the concept of box [37, 48]. In LAD, it is claimed that very good patterns for classification of data are maximal boxes [64]. This approach is strengthened in [48, 83] with boxes containing the maximum number of data of only one class. Another example is the use of rectangles not necessarily axis-aligned, named Method of the Hiperparallelepiped [80]. The idea of this method is to build a rectangle per class containing all its points and fitting their convex hull in the best possible way (Figure 1.3 c)). Most of the optimization problems considered in this thesis use rectangles as classification patterns. On the other hand, this thesis deals with the concept of symmetry in the way red and blue points are treated. We can say that most of the classification techniques are asymmetric, that is, the goal is to classify one class of points while the other is discriminated. The aforementioned papers, in which boxes are used, are examples of asymmetric classification. The work of Aronov and Har-Peled [10] asks for a d-dimensional sphere that contains the maximum number of blue points and no red point. This concept can be generalized
1.4. Overview, related work and motivation 15 to the concept of symmetric classification for which a witness set for both classes is found at the same time. This concept has been applied recently by Cabello et al. [26]. They studied how to place two unit disks (or squares) of disjoint interiors, one red and the other blue, so that the number of red points covered by the red disk, plus the number of blue points covered by the blue one, is maximized. Chapter 2 of this thesis deals with a problem of symmetric classification with two boxes. Another example of asymmetric classification is the covering of one class by using the minimum number of shapes of a given type, but avoiding the elements of the other class (Figure 1.4). In this way, only one class is classified, say the blue class represented by the point set B, and discriminating the other, the red class R. This problem is known in literature as the Class Cover Problem. For example, in [27, 41, 84], the problem of obtaining a smallest set of disks centered at blue points, such that their union covers all the blue points and avoids the red ones, is studied. In [84], the authors propose a simple classifier. Once two sets of disks DBand DRwith the above properties are given, the classifier does the following: Given a new data z, if zis covered by a disk in DBand by no disk in DR, then zis classified blue. Otherwise, if there is a disk in DRthat covers zand no disk in DBthat covers z, then zis classified red. Moreover, if zis covered by both a disk in DBand a disk in DR, then zis pre-classified “ambiguous”, otherwise zis not covered by any disk and is pre-classified “outlier”. Following this, if zis “ambiguous” or “outlier”, then it is finally classified red or blue according to the closest disk to z(by using a scaled distance function) in DRor in DB. Theoretical results related to the class cover problem can be found in [9, 24, 87]. Chapter 4 deals with a non-constrained Class Cover Problem with boxes. a) b) Figure 1.4: Covering the blue class: a) with boxes, b) with disks. In many applications, data are given in a dynamic scenario. For instance, in
22 1. Introduction Rbe a set of red points and Ba set of blue points on the plane. Let X⊆S, and ∇(X) = ||X∩R|−|X∩B||. We say that a partition Π = {S1, S2, . . . , Sk} of Sis convex if the convex hulls of its members are pairwise disjoint. The discrepancy of a convex partition Π of Sis the minimum ∇(Si) over the elements of Π and then the discrepancy of S,d(S), is the discrepancy of the convex partition of Swith maximum discrepancy. We prove several combinatorial properties of the discrepancy, and provide a complete characterization of discrepancy if Rand Bare linearly separable. Concretely, we show that: d(S) = min{r, b}if the cardinality of the majority color in Sis less than twice the minority one, and d(S) = |r−b|, otherwise. If the elements of Sare in convex position, we obtain that d(S) = maxk=1,2,3dk(S), where dk(S) is the discrepancy of Sif we restrict to convex partitions of S with exactly kelements. This result implies that the discrepancy of points in convex position can be computed in polynomial time. In fact, we give an efficient O(nlog n)-time algorithm. The key idea to efficiently solve the problem is a reduction to instances of problems concerning circular sequences of weighted elements, which are of interest by themselves. The problem of determining the discrepancy of point sets in general position seems to be non-trivial. Nowadays, we are unable to even characterize point sets with discrepancy one. It is worth noticing that if d(S) is large with respect to the cardinality of S, then there exists an optimal convex partition of Swith few elements. However, for point sets with small discrepancy, the minimum cardinality of an optimal convex partition can be small or large. We also study the particular case in which the discrepancy of Sis induced by partitions of Swith a straight line (i.e. the linear discrepancy), and we provide exact combinatorial lower and upper bounds of the value of discrepancy. Furthermore, we show that computing the linear discrepancy is 3SUM-hard [55] and give an O(n2)-time algorithm. Additionally and as a consequence, we prove that the well-known Weak Separator problem [29, 50, 70] belongs to the 3SUM-hard class as well. 1.5.5 Publications Most of the results of this thesis can be found in the following papers: •C. Cort´es, J. M. D´ıaz-B´a˜nez, P. P´erez-Lantero, C. Seara, J. Urrutia, and I. Ventura. Bichromatic separability with two boxes: a general approach. Journal of Algorithms. Cognition, Informatics and Logic. Vol. 64, No. 2–3, pp. 79–88, 2009.
1.5. Contribution of this Thesis 23 •S. Bereg, J. M. D´ıaz-B´a˜nez, P. P´erez-Lantero, and I. Ventura. The Maximum Box Problem for moving points in the plane. Journal of Combinatorial Optimization. Published online, 2010. •S. Bereg, S. Cabello, J. M. D´ıaz-B´a˜nez, P. P´erez-Lantero, C. Seara, and I. Ventura. The Class Cover Problem with Boxes. In Proc. 26th European Workshop on Computational Geometry. Dortmund, 2010. •S. Bereg, J. M. D´ıaz-B´a˜nez, D. Lara, P. P´erez-Lantero, C. Seara, and J. Urrutia. Bichromatic Discrepancy Via Convex Partitions. In Proc. XIII Encuentros de Geometr´ıa Computacional. pp. 259–265, Zaragoza, Spain, 2009.
Chapter 2 Bichromatic Separability with two Boxes Motivated by the concepts of red-blue separation and outlier data, shown in the introductory chapter, we state the following problem of symmetric classification by using two boxes, one to “cover” red points and the other to “cover” blue points. It is as follows: The Two Enclosing Boxes problem (2-EB-problem):Let Sbe a set of npoints on the plane in general position such that the points are colored red or blue. Compute two open axis-aligned rectangles Rand Bin such a way the number of red points in R\B plus the number of blue points in B\R is maximized. We notice here that in the definition of our problem we require Rand B to be open. This will facilitate our presentation, but in practice we may proceed in a similar way if our boxes are closed. Observe that Rand Bmay intersect and that any point in R∩Bis not counted. The 2-EB-problem is equivalent to removing from Sthe minimum number of points (i.e. points considered outliers) so that the intersection between the minimum enclosing box of the red points, and the minimum enclosing box of the blue ones, is S-empty. For example, the solution to the 2-EB-problem for the point set S illustrated in Figure 2.1 a) is n−2, where nis the cardinality of the input set. By removing pand qfrom S, we can obtain two rectangles Rand B, each of them containing only red and blue points, respectively, and with no point in their intersection. Notice that an asymmetric separation approach as the one used by Aronov and Har-Peled [10] does not give a solution to our problem (Figure 2.1 b)), 25
26 2. Bichromatic Separability with two Boxes so we must design a procedure which consider Rand Bsimultaneously. Bespamyatnikh and Segal [19] studied a two-box covering problem but using a different min-max criterion. They find two axis-parallel boxes that together cover a given set of points in such a way the measure of the largest box is minimized, where the measure is a monotone function of the box. R B p q a) R0 B0 b) S S Figure 2.1: a) A solution to the 2-EB-problem for the point set Sis given by the boxes Rand B, and is equal to n−2, where nis the cardinality of S. The points p and qdo not count in the solution. b) For the same set of points S, a B-empty box R0containing the maximum number of red points, and an R-empty box B0that contains the maximum number of blue points, do not form a solution. The 2-EB-problem was first introduced by Cort´es et al. [36], solving the problem with an O(n3)-time and space algorithm. In this chapter we show that the 2-EB-problem can be solved in O(n2log n) time and O(n) space. We also introduce a new data structure that allows us to dynamically solve Bentley’s [17] well-known Maximum-Sum Consecutive Subsequence problem (MCS-problem for short) together with some other variants of this problem that have applications, for instance, in sequence analysis in Bioinformatics [6, 32, 51, 71, 82]. We also show a generalization of our approach that can be used to solve a general type of problem which is of interest in areas such as computer graphics or machine learning [42, 43, 44, 45]. The outline of this chapter is as follows: In Section 2.1 we introduce a data structure, the MCS-tree, to dynamically maintain an optimal solution of the MCS-problem. In Section 2.2 we introduce some notation and present the first results on the 2-EB-problem. In Section 2.3 we show our main result, an O(n2log n)-time and linear-space algorithm that solves the 2-EB-problem. In Section 2.5 we show how to solve the following related problem: Let S be a set of points on the plane in general position such that each element of Sis colored red, blue, or green. Find three pairwise-disjoint axis-aligned rectangles R,B, and Gsuch that the total number of red, blue, and green points contained in R,B, and Grespectively is maximized. In Section 2.6
2.1. The dynamic MCS-problem 27 we present a generalization of our technique and show how to apply it to several variants of the original problem. In Section 2.7 we show how to solve the 2-EB-problem in three dimensions in O(n4log n) time and O(n) space. Finally, in Section 2.8, we present the conclusions and state future work. 2.1 The dynamic MCS-problem In this section we describe the main tool that will allow us to solve the 2- EB-problem in O(n2log n) time and O(n) space. Later we show how this technique can be applied to other variants of the same problem. The key idea to solve the 2-EB-problem is a reduction to the computation of some dynamic instances of the following one-dimensional Bentley’s problem [17]: The Maximum-Sum Consecutive Subsequence problem (MCS- problem):Given a sequence X= (x1, x2, . . . , xn)and a real weight function wover its elements where for each i,w(xi)is not necessarily positive, find the consecutive subsequence (xi, xi+1, . . . , xj)of Xsuch that w(xi) + w(xi+1) + ···+w(xj)is maximum. Next we show how to construct a binary tree, the MCS-tree, that allows us to solve the MCS-problem in a dynamic way. The MCS-tree is the first known data structure in literature that dynamically solves the MCS-problem. 2.1.1 The MCS-tree The MCS-tree is a balanced binary tree with nleaves representing the sequence X= (x1, x2, . . . , xn). Assume that nis a power of two, otherwise add a few elements with negative weights at the end of the sequence X= (x1, . . . , xn) until we get a sequence of 2kelements, n < 2k<2n. The k-th leaf (from left to right) represents xk. Each internal node urepresents the consecutive subsequence formed by the descendants (leaves) of u. At each node uof the MCS-tree, we store some values, one of which will be the weight of the maximum weight consecutive subsequence contained in the subsequence of Xdefined by the descendants of u. The root vertex will have the solution of the MCS-problem. Because we focus on the indexes of the first and the last elements of a subsequence, we use the term interval [xi, xj] to denote the consecutive subsequence (xi, xi+1, . . . , xj), 1 ≤i≤j≤n(Figure 2.2). We build the MCS-tree as follows: Each node ustores the following intervals, as well as their weights, that is, the sum of the weights of their elements:
28 2. Bichromatic Separability with two Boxes x1x2x3x4x5x6x7x8 u v root Figure 2.2: The MCS-tree for a sequence of 8 elements. The nodes u,v, and root represent the intervals [x1, x2], [x5, x8], and [x1, x8], respectively. 1. I(u): The interval formed by the descendants of u. If uis a leaf representing xi,I(u) = [xi]. 2. L(u): The interval of maximum weight sum contained in I(u) that contains the leftmost element of I(u). If all the intervals in I(u) containing the leftmost element of I(u) have negative weight, set L(u) = ∅ and its weight to 0. 3. R(u): The interval of maximum weight sum contained in I(u) that contains the rightmost element of I(u). If all the intervals in I(u) containing the rightmost element of I(u) have negative weight, set R(u) = ∅and its weight to 0. 4. M(u): The interval of maximum weight sum that is a subinterval of I(u). If all the intervals in I(u) have negative weight, set M(u) = ∅ and its weight to 0. Observe that, if uis the root of the MCS-tree, then I(u) is [x1, xn]. L(u), R(u), and M(u) are respectively the intervals of the form [x1, xi], [xj, xn], and [xi, xj] with maximum weight sum. Note that in each node we only store the indexes of the first and last elements of each of the above intervals as well the weight sum of its elements, and the implicit references to the two children of the node and to the parent. It means that the total used memory for each node is constant. Hence, since there are 2n−1 nodes in total (i.e. nleaves plus n−1 interior nodes) the total memory used by the MCS-tree is O(n). Let ube an internal node of the MCS-tree, and let v1and v2be its left and right children, respectively. It is clear that if we have the values for I(v1), I(v2), L(v1), L(v2), R(v1), R(v2), M(v1), and M(v2), then we can calculate in constant time each of the values of I(u), L(u), R(u), and M(u). Notice that for M(u) there are three possible cases:
2.1. The dynamic MCS-problem 29 (i) M(u) is contained in I(v1). (ii) M(u) is contained in I(v2). (iii) M(u) overlaps both of I(v1) and I(v2). Thus, M(u) = M(v1), M(u) = M(v2), or M(u) = R(v1)∪L(v2) respectively (Figure 2.3). We choose M(u) to be the interval of maximum weight among M(v1), M(v2), and R(v1)∪L(v2). Similarly L(u) is the interval of maximum weight among L(v1) and I(v1)∪L(v2), and R(u) is the interval of maximum weight among R(v1)∪I(v2) and R(v2). (i) (ii) (iii) v1v2 M(v1) M(v2) R(v1)L(v2) u Figure 2.3: The three possible cases for M(u). The nodes v1and v2are the left child and right child of urespectively. The node v1represents the first half of the subsequence represented by u, and v2represents the second half. If a leaf xiof the MCS-tree has negative weight w(xi), then L(xi) = ∅, R(xi) = ∅and M(xi) = ∅. Otherwise L(xi)=[xi], R(xi)=[xi] and M(xi)=[xi]. By using these values for the leaves of the MCS-tree and a standard bottom-up traversal [35, 76], we can calculate L(u), R(u), and M(u) for all the nodes uof the tree in linear time. For more details we can see Algorithm 1 that builds a node of the MCS-tree. Denote by MaxW{I1, I2, . . . , Ik}the interval of maximum weight among the intervals I1, I2, . . . , Ik. By left(u), right(u) and parent(u) we denote respectively the left child, right child and parent of the node u. Note that all the nodes in the MCS-tree whose represented subsequence contains a given leaf xiare those in the path from xito the root. Therefore, if the weight w(xi) of a leaf xichanges, the MCS-tree can be updated in a bottom-up traversal from xito the root, and thus the weight of the maximum weight consecutive subsequence, as well its weight value, are recalculated in O(log n) time. The complexity follows because the height of the MCS-tree is O(log n) since it is a complete balanced tree with nleaves [76]. Moreover, for a given xi∈X, by traversing from xito the root, the MCS- tree structure allows us to obtain in O(log n) time: (i) the optimal interval
30 2. Bichromatic Separability with two Boxes Algorithm 1 Construction of the node uof the MCS-tree if uis a leaf then I(u)←[u] if w(u)<0then L(u)←R(u)←M(u)← ∅ else L(u)←R(u)←M(u)←[u] end if else I(u)←I(left(u)) ∪I(right(u)) L(u)←MaxW{L(left(u)), I(left(u)) ∪L(right(u))} R(u)←MaxW{R(left(u)) ∪I(right(u)), R(right(u))} M(u)←MaxW{M(left(u)), R(left(u)) ∪L(right(u)), M(right(u))} end if Algorithm 2 Maximum weight sum interval containing xk, where xkis a leaf of the MCS-tree -IL(resp. IR) is the interval of maximum weight ending (resp. beginning) at xk -SL(resp. SR) is the interval beginning (resp. ending) at the element of the leftmost (resp. rightmost) leaf of the subtree rooted at xand ending (resp. beginning) at xk IL←IR←SL←SR←[xk] u←xk repeat v←parent(u) if u= left(v)then IR←MaxW{IR, SR∪L(right(v))} SR←SR∪I(right(v)) else IL←MaxW{IL, SL∪R(left(v))} SL←SL∪I(left(v)) end if u←v until u= the root of the MCS-tree return IL∪IR
2.1. The dynamic MCS-problem 31 for the MCS-problem which contains xi, and (ii) the maximum weight of the interval of Xstarting or ending at xi. The operation (i) is stated in Algorithm 2, and the operation (ii) is a special case of the operation (i). These properties of the MCS-tree structure will be used to solve the 2-EB- problem. From the discussion above we get the following result. Theorem 2.1 Given the sequence X= (x1, . . . , xn)with a real weight function wover its elements, the MCS-tree can be built in O(n)time. Moreover, if any w(xi)is modified, the MCS-tree can be updated in O(log n)time. The MCS-tree allows computation, in O(log n)time, of the interval of maximum weight sum of consecutive elements that includes, starts or ends at a specific element xk∈X. Other operations that can be performed with the MCS-tree, by reasoning similarly as above, are the following: 1. Given two indexes iand j(1 ≤i≤j≤n) of the sequence X= (x1, . . . , xn), find in O(log n) time the interval of maximum weight contained in the interval [xi, xj]. 2. Given four indexes i,j,kand l(1 ≤i≤j≤nand 1 ≤k≤`≤n) of the sequence X= (x1, . . . , xn), find in O(log n) time the interval of maximum weight such that its first and last elements are inside the intervals [xi, xj] and [xk, x`], respectively. The two above operations were studied in [32]. The first one as The Range Maximum-Sum Segment Query Problem and the second one as The Range Maximum-Sum Segment Query Problem with Two Query Intervals. They were solved with the following method: Make a linear preprocessing to the sequence Xin such a way that subsequent queries, for the given indexes, are answered each in constant time. The approach in [32] does not consider changes in the elements of the sequence as is done in the MCS-tree but with logarithmic-time queries. On the other hand, if we consider that the sequence X= (x1, x2, . . . , xn) is circular (i.e. if 1 ≤j < i ≤nthe interval [xi, xj] is the union of the intervals [xi, xn] and [x1, xj]), then we can augment the MCS-tree in order to dynamically compute the (circular) interval of maximum weight when an element of Xchanges. In fact, store in each node uof the MCS-tree the interval E(u) and its weight, where E(u) is the interval of minimum
38 2. Bichromatic Separability with two Boxes beginning of the sweep, hpis above all the points of S, and at the end it will be below them. The line hpstops at each red point p. For each stop of hp, we make another top-bottom sweep of the points of Sthat are below hpwith a red horizontal line hq. The line hqstops at blue points, thus for each position of hpand hqwe have an instance of the HS-problem which is dynamically solved by doing the above assignment of weights, by building a MCS-tree, and by the application of Theorem 2.1 and Lemma 2.4. Suppose that hpis fixed. We slide hqdown, stopping each time hqmeets a point qof S, and following the rules: (i) if qis a red point in S2,qwill enter into S4and its weight will change to −1; (ii) if qis a red point in S5, qwill enter into S3and its weight will remain 0; (iii) if qis a blue point and it enters into S4, its weight changes to 0; and (iv) if qis blue point and it enters into S3, its weight changes to −1. Each time hqcrosses a red point to the right of vpwe update in constant time the number of red points in NE(u) by incrementing it by one, and each time hqhits a blue point, we recalculate the optimal solution of the HS-problem for the new H(bounded above by hpand below by the new position of hq). This immediately suggests using the dynamic version of the computation of the interval of maximum weight sum on hq. By using the MCS-tree and Theorem 2.1, the interval of maximum weight sum containing the current p can be computed in O(log n) time per stop-point of the slide line hq. Thus, the time cost for the fixed red point pis O(n) + O(nlog n) = O(nlog n). Now, for each one of the O(n) red points pin S, we set the horizontal line hp, calculate in linear time the number of blue points in SW(p) and the number of red points in NE(u) (which is initially equal to |Red(NE(p))|), and start again the process by rebuilding the MCS-tree in linear time, and then dynamically solving the MCS-problem. Therefore, the overall time complexity of the algorithm is O(n)(O(n) + O(nlog n)) = O(n2log n). The following result is then obtained. Theorem 2.5 An optimal corner-type solution for the 2-EB-problem for S can be found in O(n2log n)time and O(n)space. The sandwich-type solution We now show how to find a sandwich-type solution. The method is similar to the corner-type solution, and it is based on the following propositions whose proofs are similar to the proofs of Proposition 2.2 and Proposition 2.3, respectively.
2.3. Exact and efficient solution 39 Proposition 2.6 There exists a sandwich-type solution (R,B)to the 2-EB- problem if and only if there exists a pair of strips (SR,SB), one vertical and the other horizontal, that maximize the sum |Red(SR\SB)|+|Blue(SB\SR)|. Proposition 2.7 There exists a pair of strips (SR,SB),SRvertical and SB horizontal, that maximize the sum |Red(SR\ SB)|+|Blue(SB\SR)|such that there is a red element of Son the top side of the rectangle determined by their intersection. Therefore, we can proceed in a similar way to the corner-type solution. For each pair of blue lines hpand hq(Figure 2.8 a)), we consider the blue strip SBbounded by them, plus a starting red strip SRconsisting of the vertical red line vppassing through a red point pin hp(Figure 2.8 a)). They form an initial candidate sandwich-type solution with value |Blue(SB)|. As we widen SRby translating two vertical lines v1and v2to the left and right of p, respectively, the value of the solution will change according to the following weight rules applied to the points of S, where the regions S1,S2, and S3are as in Figure 2.8 b): •Blue points in S1,S2, and S3receive weight 0, −1, and 0, respectively. •Red points in S1,S2, and S3receive weight 1, 0, and 1, respectively. hp p q SB S1 S2 S3 hq a) b) SR v1v2 hp p q SB S1 S2 S3 hq vp Figure 2.8: a) Starting position, b) finding an optimal position. If we store in pthe number of blue points in SBand project the points of S on hq, we can state the following lemma whose proof is very similar to the proof of Lemma 2.4. Lemma 2.8 Given the horizontal lines hpand hqbounding the strip SB, to obtain the positions of v1and v2that optimally define SR, is equivalent
40 2. Bichromatic Separability with two Boxes to finding the maximum weight interval Ion hqthat contains p. Moreover, |Blue(SB\ SR)|+|Red(SR\ SB)|=|Blue(SB)|+w(I)where w(I)is the weight of I. For each position of hpwe assign weight 0 to all the blue points of Sand weight 1 to all the red ones. Initially, We locate the line hqin the same position of hpand build in linear time a MCS-tree Tfor the projected sequence of points. With hqwe make a sweep of the points below hp. Each time hqcrosses a point qwe do the following: If qis blue we change its weight to −1 and update the number of blue points in SB. If qis red its weight is changed to 0 and then we dynamically calculate in O(log n) time by using T, because of Theorem 2.1, the maximum weight sum interval in hqthat contains the current point p. Therefore, we obtain a candidate to the sandwich-type solution if we apply Lemma 2.8. As a consequence, we obtain the following result. Theorem 2.9 An optimal sandwich-type solution for the 2-EB-problem for Scan be found in O(n2log n)time and O(n)space. The disjoint-type solution Finding a disjoint-type solution is straightforward. It can be done in time O(nlog n) by making two plane sweeps, the first one with a horizontal line and the next one with a vertical line. In the two sweeps we keep the position of the sweeping line that maximizes the number of red points to one of its sides plus the number of blue points to the another one. This is due to the observation that there is always a vertical or horizontal line that separates the boxes of a disjoint-solution. Therefore, putting together the results above, we get to the following theorem as the main result of this chapter Theorem 2.10 The 2-EB-problem for Scan be solved in O(n2log n)time and O(n)space. 2.4 Approximated solution As we have seen, the 2-EB-problem has an O(n2log n)-time solution. For big values of nthe time complexity would be very high. A way to reduce it is by using an approximated algorithm, that is, an algorithm that reports
2.4. Approximated solution 41 a solution that is an approximation to the optimal one. We state as future work the analysis of the computational complexity of the 2-EB-problem to see if there is a better time complexity algorithm for it. We conjecture that an o(n2)-time complexity is impossible to achieve. In order to improve the time complexity, we propose in this section an approximated solution that consists of finding only disjoint-type solutions. Before we show the main result of this section, we state the following definition from [35, 100]: Definition 2.11 Let Abe an algorithm that computes a feasible solution for every instance Iof a given problem P. Let A(I)and Opt(I)be respectively the value of the solution reported by Aand the value of the optimal solution for I. If Pis a maximization problem (resp. minimization problem) then Ais an k-approximation to Pif for every instance Iof Pwe have that k·Opt(I)≤A(I)≤Opt(I)(resp. Opt(I)≤A(I)≤k·Opt(I)). In this case kis the factor of approximation of A. Notice in the above definition that the closer to one kis the better the approximation algorithm. The following result states the factor of approximation obtained when we compute only disjoint-type solutions for the 2- EB-problem. Theorem 2.12 The algorithm to find a disjoint-type solution is a 3/4- approximation to the 2-EB-problem. Proof. Let Sapx and Sopt be respectively the value of the disjoint-type solution and the value of the general optimal solution. Suppose that the general optimal solution, (QR,QB), is a corner-type. Consider the lines h1, h2,v1and v2dividing QRand QBinto the six regions S1,S2,S3,S4,S5 and S6, as in Figure 2.9 a). For h1, since Sapx is the value of the disjoint-type solution, it results that Sapx is greater than or equal to the number of red points above h1plus the number of blue points below h1, and in turn, this quantity is greater than or equal to |Blue(QB\QR)|+|Red(S5)|+|Red(S6)|. Thus we obtain: Sapx ≥ |Blue(QB\QR)|+|Red(S5)|+|Red(S6)| Analogously, for the lines h2,v1and v2, the following three inequalities are obtained:
42 2. Bichromatic Separability with two Boxes QR QB a) b) S3 S6S5 S4 S2 S1 h1 h2 v1v2 S1S2 S3 S4 v1v2 h2 h1 SR SB Figure 2.9: a) Corner type-solution, b) sandwich-type solution. Sapx ≥ |Blue(S2)|+|Blue(S3)|+|Red(QR\QB)| Sapx ≥ |Blue(S1)|+|Blue(S2)|+|Red(QR\QB)| Sapx ≥ |Blue(QB\QR)|+|Red(S4)|+|Red(S5)| Since Sopt =|Blue(QB\QR)|+|Red(QR\QB)|=|Blue(S1)|+|Blue(S2)|+ |Blue(S3)|+|Red(S4)|+|Red(S5)|+|Red(S6)|, we obtain the following by adding the four inequalities: 4Sapx ≥3Sopt +|Blue(S2)|+|Red(S5)| ≥ 3Sopt Suppose now that the optimal solution to the 2-EB-problem, (SR,SB), is a sandwich-type. Consider the lines h1,h2,v1, and v2dividing SRand SB into the regions S1,S2,S3and S4, as in Figure 2.9 b). This gives us the following: Sapx ≥ |Red(S4)|+|Blue(SB\SR)| Sapx ≥ |Red(S3)|+|Blue(SB\SR)| Sapx ≥ |Blue(S1)|+|Red(SR\SB)| Sapx ≥ |Blue(S2)|+|Red(SR\SB)| Since Sopt =|Blue(SB\SR)|+|Red(SR\SB)|=|Blue(S1)|+|Blue(S2)|+ |Red(S3)|+|Red(S4)|we obtain: 4Sapx ≥3Sopt
2.5. The three chromatic case with three disjoint boxes 43 In both cases 3 4Sopt ≤ Sapx ≤ Sopt, resulting that the optimal disjoint-type solution is a 3/4-approximation to the 2-EB-problem. 2.5 The three chromatic case with three disjoint boxes In this section we study the following problem as an extension of the 2-EB- problem in which the points are colored red, blue or green. To this end, we define Green(Y), as was done for Red(Y) and Blue(Y), as the subset of green points of Sthat are in Y. The Disjoint Three-Chromatic Enclosing Boxes problem (DTEB- problem):Let Sbe a set of npoints on the plane in general position such that the points are colored red, blue, and green. The DTEB-problem for S consist of finding three pairwise-disjoint isothetic rectangles R,B, and G such that |Red(R)|+|Blue(B)|+|Green(G)|is maximum. Theorem 2.13 The DTEB-problem for Scan be solved in O(nlog n)time and O(n)space. Proof. First, we observe that given any three pairwise-disjoint isothetic rectangles R,B, and Gwe can always find two isothetic lines (or a line and a half-line) `1and `2such that for any pair of elements of {R,B,G} either `1or `2separates them (Figure 2.10). The two cases are solved separately. `1 G BRG B R a) b) `2`1 `2 Figure 2.10: Separation by two isothetic lines: a) parallel lines, b) perpendicular lines. Parallel case: First, we show how to solve the parallel case by reducing it to the Longest Increasing Subsequence problem [76]: Given a sequence (x1, . . . , xn)of numbers, find a largest subset of indexes α1<··· < αksuch that xα1≤ ··· ≤ xαk. It is well known that this problem can be solved in O(nlog n) time [54]. In fact, the instance we have to solve here can be solved
44 2. Bichromatic Separability with two Boxes in linear time, as it involves a sequence whose elements have values 1, 2, or 3. First, suppose that `1and `2are vertical and that R,B, and Gform an optimal solution. We have to consider six cases for the relative positions of R,B, and Gwith respect to `1and `2. Suppose that Bis to the left of `1, that Rlies between `1and `2, and that Gis to the right of `2(Figure 2.10 a)). The remaining five cases are solved in a similar way. Assign weight 1 to the points colored blue, weight 2 to those colored red, and weight 3 to the green points. Project all the points in Son the x-axis obtaining a sequence Σ of 1’s, 2’s, and 3’s. Observe that all the blue, red, and green points contained in B,R, and G, respectively, as projected on the x-axis induce an increasing subsequence of Σ. The result follows. Perpendicular case: Suppose, w.l.o.g., that the relative positions of `1, `2,R,B, and Gare as in Figure 2.10 b)). We show how to solve this case using dynamic binary trees. First, suppose that the elements of Sare labeled p1, . . . , pnsuch that the y-coordinate of piis smaller than the y-coordinate of pj,i < j. Suppose that we are given the line `1and introduce an auxiliary color, the black, for recoloring all the green points and also all the red and blue points to the left of `1. Given an index i, 1 ≤i≤n, let R(i) (resp. B(i)) be the number of red elements pjwith j≤i(resp. blue pj’s with j≥i). Then, the best position of `2, given the position of `1, is determined by the index i(1 ≤i≤n) that maximizes R(i) + B(i). By using the above idea, we construct a balanced binary tree Tsuch that its set of leaves S={p1, . . . , pn}are colored red, blue, and black. Our objective is to store information on the vertices of Tsuch that the following problem, which we call the Maximum Sum problem, or the MS-problem for short, can be solved dynamically in O(log n) time: The Maximum Sum problem (MS-problem):Find an index ithat maximizes R(i) + B(i). At each point in time, a red or blue point can change color to black. As in Section 2.1.1, for every internal node uof Tlet I(u) = [plu, pru] be the interval of Sformed by the descendants of uin T. If u=pjfor some j,I(u) = [pj]. For an index i,lu≤i≤ru, let Ru(i) (resp. Bu(i)) be the number of red pj’s such that lu≤j≤i(resp. the number of blue pk’s with i≤k≤ru). We define IR(u) (resp. IB(u)) as the number of red (resp. blue) points in I(u). At every node uof Twe will store the following information: an index iu,
2.6. Generalization and Applications 45 lu≤iu≤ru, such that Ru(iu) + Bu(iu) is maximized. If uis a leaf pjof T, then iu=j. If uis an internal node of Twhose left and right children are v1and v2, respectively, it is easy to see that iuis either iv1or iv2, according to the following criterion: If R(iv1) + B(iv1) + IB(v2)≥IR(v1) + R(iv2) + B(iv2) then iu=iv1, otherwise iu=iv2. Following this, we can immediately see that by using a bottom-up traversal of T, we can calculate the values IR(u), IB(u), iu,R(iu), and B(iu) for all nodes uof Tin linear time by Theorem 2.1. Moreover, by Theorem 2.1, it is straightforward to see that if a red or blue point piof Tis re-colored black, then we can update Tin O(log n) time by traversing the path from pito the root of T, and that if root is the root vertex of T,R(iroot) + B(iroot) is the solution to the MS-problem. We are now ready to solve the perpendicular case. Take a copy S0of Sand re-color black to all the green elements of S0. Construct a binary tree Tas described above such that the elements of S0are the leaves of T. In this way, R(iroot) + B(iroot) is the optimal solution for which the green box contains no points. We now perform a line sweep using a vertical line `1from left to right. Initially all the elements of Sare to the right of `1, at the end all the elements of Sare to the left of `1. Each time `1meets a point in Swe change the color of its corresponding copy in S0to black. In O(log n) time, we update T, and recalculate the boxes Rand Bthat maximize the number of blue points plus the number of red points contained in them. Each time `1meets a green point, the number of elements in Gincreases by one. By keeping the maximum number of red points plus blue points plus green points contained in R,B, and G, respectively, we obtain an optimal solution to our problem and the algorithm requires O(nlog n) of time and O(n) of space. 2.6 Generalization and Applications We have shown how to solve the 2-EB-problem and the DTEB-problem by using dynamic trees over a sequence of elements for which some attribute is dynamically maintained. Notice that in the case of the 2-EB-problem (resp. the DTEB-problem) the interval of maximum weight (resp. the position in which the number of red elements to its left plus the number of blue points to its right is maximum) is maintained in O(log n) time. The approach can
46 2. Bichromatic Separability with two Boxes easily be generalized as follows. 2.6.1 Generalization It is easy to see that for computing in a given sequence, both the interval of maximum weight and the position in which the number of red elements to its left plus the number of blue points to its right is maximum, we can apply the Divide and Conquer Approach [35] and obtain a recursive linear-time algorithm. This is due to the fact that if we have computed the corresponding attribute for the two halves of the sequence, then we can compute the same attribute for the entire sequence in constant time. Under this observation the generalization idea follows. Generalization: Let X= (x1, x2, . . . , xn)be a sequence of nelements and let A(X)be a set of attributes of Xthat depends on its elements. Suppose that A(X)can be obtained by applying a recursive O(n)-time algorithm as follows: if the length of Xis at most one compute A(X)in constant time, otherwise A(X)is computed in constant time from A(X1)and A(X2), where X1and X2are the two halves of X. Then, the recursive tree having the elements of Xas its leaves is a balanced binary tree and by representing it we can, whenever some xichanges, recompute A(X)in O(log n)time by traversing the path from xito the root. Note that although the goal may be to maintain only one attribute, we maintain a set of them because in many applications the calculation of an attribute of the sequence depends on others. For the sake of clarity see the MCS-tree (Section 2.1.1), where the property of the sequence is the weight of its elements and other three attributes are considered in order to maintain the interval of maximum weight. By applying this generalization we are now ready to present efficient algorithms for a collection of problems. 2.6.2 Applications The Maximum Weighted Box problem (MWB-problem):Given a set Sof npoints on the plane and a weight function w:S→R, compute the axis-aligned box Hsuch that Px∈H∩Sw(x)is maximized. Note that there exists a box Hthat gives an optimal solution such that H contains on its boundary only elements of Swith positive weight. A solution can be calculated as follows:
2.6. Generalization and Applications 47 Make a top-bottom sweep of the elements of Swith a horizontal line `1and whenever it stops at a positive element of S, make a sweep of the elements of Sthat lie below `1with another horizontal line `2that starts at `1and stops only on positive-weight points. Let Xbe the points of Sordered by abscissa and let w0be a weight function for each x∈Sdefined as follows: w0(x) = (w(x) if xlies between `1and `2; 0 if xlies either above `1or below `2. For a given position of `1and `2, the optimal box, whose top and bottom sides lie on `1and `2, respectively, is determined by the interval of maximum weight sum on X. This interval is dynamically computed in O(log n) time, by using a MCS-tree, when the weight w0of an element of Schanges while the line `2moves. Like this, we obtain a simple O(n2log n)-time algorithm since there are O(n2) possible positions of `1and `2. If we restrict Hto be a quadrant, say the North-East quadrant, the solution is even easier. We use only a horizontal sweeping line `1and define the weight function w0as follows: w0(x) = w(x) if xis above or in `1, and w0(x) = 0 otherwise. The problem is reduced to the dynamic computation of the interval of maximum weight in Xthat is a prefix of X. The time and space complexities are O(nlog n) and O(n), respectively. The solutions to the following two problems are found by solving one or two instances of the MWB-problem. Thus, they also have solutions when we restrict the corresponding box to a quadrant. The Maximum Box problem (MB-problem):Given a set of blue points Band a set of red points Ron the plane, where |R∪B|=n, find an R-empty axis-aligned box Hsuch that |H∩B|is maximized. See Figure 2.11 a) for an example. The MB-problem can be solved in O(n2log n) time by using O(n) space since it is an instance of the MWB- problem by considering S=R∪Band the weight function: w(x) = (1 si x∈B; −∞ si x∈R. The MB-problem was solved in [83] with O(b2log b+br+rlog r) time, where r=|R|and b=|B|. However our approach is a simpler method with the same complexity in the worst case.
54 2. Bichromatic Separability with two Boxes in the xy-plane such that: the number of red points of type-1 in QR, plus the number of red points of type-2 in QR\QB, and plus the number of blue points in QB\QRis maximized (Figure 2.16 b)). Computing (QR,QB) is quite similar to solving the corner-type case in two dimensions (Section 2.3). This type of solution can be obtained in O(n4log n) time and O(n) space since there are O(n2) different positions for PB1and PB2. The piercing-type solution The solution here is very similar to the solution of the sandwich-type case in two dimensions (Section 2.3). Let PB1and PB2be two half-planes that are parallel to the xy-plane, in such a way PB1is above PB2in the direction given by the z-axis. Suppose we want to find the piercing-type solution (R,B) such that the top and bottom facets of Bare contained in PB1and PB2respectively, and that Rpierces B. We fix Bto be the space in between PB1and PB2. Now, we assign weight +1 to the red points that are either above PB1or below PB2, weight −1 to the blue points in B, and weight 0 to the other points. Project on the xy-plane all the weighted points, as depicted in Figure 2.17 a). PB1 PB2 QR a) b) xy-plane xy-plane B R −1 −1 −1 −1−1 −1 +1 +1 +1 +1 +1 Figure 2.17: How to compute an piercing-type solution. Then the best Rfor the fixed Bis determined by the box QRin the xyplane that has maximum weight (Figure 2.17 b)). This problem in the plane is The Maximum Weighted Box problem that was solved in Section 2.6 in O(n2log n) time and O(n) space. Since there are O(n2) different positions for PB1and PB2, a piercing-type solution can be found in O(n4log n) time and O(n) space.
2.7. The problem in three dimensions 55 The crossing-type solution Let PB1and PB2be two half-planes that are parallel to the xy-plane, and such that PB1is above PB2in the direction given by the z-axis. Suppose we want to find the crossing-type solution (R,B) such that the top and bottom facets of Bare contained in PB1and PB2respectively. We say that a red point pis of type-1 if it is either above PB1or below PB2, and of type- 2 otherwise. Project on the xy-plane all the red points and also the blue points that are both below PB1and above PB2(Figure 2.18 a)). PB1 PB2 QB QR a) b) xy-plane xy-plane B R `2 `1 Figure 2.18: How to compute an crossing-type solution. Then, the problem is reduced to finding in the xy-plane an isothetic halfplane QBand an isothetic half-strip QRsuch that: the two parallel sides of QRintersect the boundary of QB; the two vertices of QRbelong to the interior of QB; and the number of blue points in QB\QR, plus the number of red points of type-1 in QR, and plus the number of red points of type-2 in QR\QBis maximized. This problem in two dimensions can be solved as follows. Let `1and `2be two isothetic parallel lines and consider w.l.o.g. that they are horizontal and that `1is below `2. Suppose now that QBis the lower half-plane defined by `2and that the finite side of QRlies on `1(Figure 2.18 b)). Take a copy S0of Sand re-color black all its elements except the blue points in between `1and `2, the red points of type-1 above `1and the red points of type-2 above `2. Now project the elements of S0on `1 obtaining a sequence Xof red, blue and black elements. Then, given the current location of QB, the best QRis determined by the two indexes iand
56 2. Bichromatic Separability with two Boxes j(i<j) of Xsuch that: the number of blue elements before index i, plus the number of red elements from index ito index j, and plus the number of blue elements after index jis maximized. By using the generalization approach of Section 2.6, this problem in one dimension can be dynamically solved in O(log n) time when the color of some element changes. Note that the same problem was solved in the solution of the Weak Strip Separation problem presented in Section 2.6. Fixing `1, the above one-dimensional subproblem is dynamically solved when we sweep with `2the points of S above `1. This is done in O(nlog n) time and O(n) space in total. Since there are O(n) different positions for `1the total complexity of the twodimensional subproblem is O(n2log n) time and O(n) space. This implies a total O(n4log n) time and O(n) space for the problem in three dimensions because there are O(n2) different positions for PB1and PB2. The disjoint-type solution Solving this case is as straightforward as solving the disjoint-type case in two dimensions because there is always an isothetic plane that separates the boxes. It can be done by sweeping Swith a plane in each direction given by the coordinate axes. The complexity is O(nlog n) time and O(1) space. Summarizing the complexity of the five above cases, the following result is obtained: Theorem 2.14 The 2-EB-problem in three dimensions can be solved in O(n4log n)time and O(n)space. 2.8 Conclusions and open problems In this chapter we have shown the connection between maximum boxes problems and Bentley’s maximum consecutive sum problem. We have developed a dynamic data structure that allows us to maintain the solution of the Bentley’s maximum consecutive sum problem in O(log n) time when an element of the sequence changes its value. This data structure can be computed in linear time. The key idea used to dynamically solve Bentley’s maximum consecutive sum problem was extended as a general technique useful for solving other data analysis problems. A natural problem, that requires further research, is the design of more efficient algorithms to the three-dimensional case. As we have seen, by using projections of the bicolored point set on the plane, the solutions to
2.8. Conclusions and open problems 57 the vertex-in-type and edge-in-type cases can be reduced to solve O(n2) instances of the corner-type-case of the 2-EB-problem in R2. Those projections are determined by parallel planes and we can sweep the elements of S with those planes and pass from an instance Iin R2to another I0in such a way Iand I0differ by only one point (i.e. a point is added, removed or its color is changed). Then, in order to reduce the time complexity, it would be interesting to design a dynamic data structure that permits us to dynamically compute corner-type solutions in R2when we add or remove a point, and also when we change the color of a point. A good time complexity for this dynamic operations would be o(nlog n). The solution to the piercing-type case of the 2-EB-problem in R3is obtained by solving O(n2) instances of the Maximum Weighted Box problem. In order to reduce the time complexity, we leave to further research the problem of dynamically computing in o(nlog n) time the maximum weighted box when the weight of a point changes. The Maximum Weighted Box problem can be seen as a two-dimensional version of the Bentley’s maximum consecutive sum problem, but by considering a set of weighted points instead of a twodimensional array [98, 99]. Finally, in order to study the complexity of the 2-EB-problem, it is worthy to know if the 2-EB-problem in R2is 3SUM-hard [55].
Chapter 3 The Maximum Box Problem for Moving Points on the Plane In Pattern Recognition and Classification, a natural method for selecting prototypes that represent a class is to perform cluster analysis on the training data [46]. Typically, two sets of points are given, and one would like to find patterns which intersect exactly one of these sets. The clustering can be obtained by using simple geometric shapes such as disks or boxes. A basic problem is the so-called Maximum Box Problem, where the clustering is done by considering maximum boxes, that is, boxes containing the maximum number of points in the given data set (Figure 3.1). See [83, 95] for example. This problem was introduced in Subsection 2.6.2 as the MB-problem. H Figure 3.1: The box His the maximum box. It contains the maximum number of blue points and does not contain any red point. In many applications, data are given in a dynamic scenario [21, 33], that is, they change over time. Motivated by this concept, in this chapter we in- 59
60 3. The Maximum Box Problem for Moving Points on the Plane troduce and investigate the dynamic version of the MB-problem, where the dataset is modeled by points moving along bounded degree algebraic trajectories. We present a Kinetic Data Structure (KDS) to efficiently maintain the maximum box for a set of bicolored moving points. A KDS is used to keep track of the attributes of interest in a system of moving objects [61]. The main idea in the kinetic framework is that even though the objects move continuously, the relevant combinatorial structure changes only at certain predictable discrete events. Therefore, one does not have to update the data structure continuously. The chapter is organized as follows. In Section 3.1 we present the KDS framework. In Section 3.2 we give an algorithm for the static version of the MB-problem that will be useful for the dynamic version. A new data structure for maintaining the maximum box in a kinetic setting is proposed in Section 3.3. In Section 3.4, an algorithm for the MB-problem in a static setting, in which the box can be arbitrarily oriented, is presented. In Section 3.5 we present an efficient data structure to maintain an approximated solution of the MB-problem when the points move. The number of blue points contained in our approximated solution is at least half of the number of blue points contained in an exact solution. Finally, in Section 3.6, the conclusions and further research are presented. 3.1 The KDS framework In this section the KDS framework is presented. The Kinetic Data Structures (KDS) were introduced by Basch et al. [13]. In the following, we cite definitions, information, and examples, taken from [5, 13, 60, 61]. A KDS is a data structure that maintains a certain attribute of a set of continuously moving objects [61]. It consists of two parts: a combinatorial description of the attribute and a set of certificates. The certificates are elementary tests on the input objects with the property which, as long as their outcomes do not change, the attribute does not change either. The main idea in the kinetic framework is that even though the objects move continuously, the relevant combinatorial structure changes only at certain predictable discrete events. Therefore, one does not have to update the data structure continuously. These events have a natural interpretation in terms of the underlying structure, for example, when the x- or yprojections of two points coincide. All the events are managed in an event queue, and they are pairs hc, ti, where cis the certificate and tis the failure time of c. Events in which the attribute changes are called external events, other events are
3.1. The KDS framework 61 called internal events. Any moving object is allowed to change its motion, and when this happens, all certificates involving the object must re-evaluate their failure times and the event queue is updated. A good, very simple example, is a KDS that maintains the rightmost point (the point with maximum x-coordinate) in a set Sof ncontinuously moving points on the plane. The simplest approach is to sort Sby x-coordinate and store it in a list P, thus the rightmost point is given by the last element of P. There is a certificate (the x-order condition) for every two consecutive elements in P, and we have a certificate failure every time two consecutive elements in P,piand pi+1, have the same x-coordinate. Then, piand pi+1 are swapped in P, and at most three new certificates arise involving pi−1, pi,pi+1, and pi+2. The performance of a KDS is measured according to four properties. A KDS is compact if the total number of stored certificates is near-linear in the total number of objects (say O(n1+ε), where nis the number of objects), and local if no object participates in too many (say O(nε)) certificates, that is, at any one time, the maximum number of events in the event queue that depend on a single object is small. A KDS with this property can be updated quickly when the flight plan (motion) of an object changes. A KDS is responsive if the time needed to update it (as well the event queue), when a certificate fails, is poly-logarithmic in the problem size, and a KDS is efficient if the ratio of the maximum total number of internal and external events, to the maximum total number of external events, is poly-logarithmic in the problem size. Analyzing the efficiency of a KDS is slightly more complicated than the other performance measures. Revisit above example of a KDS that maintains the rightmost point. The KDS is local since every point is involved in at most two certificates, and hence is compact, and it is responsive since the list Pis updated in constant time and the event queue can be managed by an efficient priority queue in the failure time [35]. Finally, see that the KDS is not efficient. For instance, if the points move in the same line, then the total number of external events (those that change the rightmost element) can be linear, and the total number of internal events can be quadratic. This kinetic problem was efficiently solved in [13] with the well-known kinetic tournament. As we have mentioned, the KDS framework encounters applications in many problems concerning extent, proximity, collision detection, connectivity, and clustering, etc. of moving objects [60].
62 3. The Maximum Box Problem for Moving Points on the Plane 3.2 The static version of the Maximum Box Problem The static version of the MB-problem in the plane has already been studied. Liu et al. [83] give an O(b2log b+br +rlog r)-time algorithm. The same problem was solved in Subsection 2.6.2 in O(n2log n) time and O(n) space. Unfortunately, the approach used in Subsection 2.6.2 could not be applied for the dynamic environment. In the following we put forward for consideration a simple algorithm, that is similar to the algorithm in [83], and with a slightly different complexity, which will be used later in Section 3.3 to design a data structure for the kinetic version. That is why, as we will see below, in our variant we elaborate more than in [83]. First, we observe that a maximum box for Rand Bcan be enlarged until each of its sides either contains a red point or reaches infinity. Thus, the maximum box can be transformed to one of the following isothetic objects with red points on its boundary and no red points inside: a rectangle, a half-strip, a strip, a quadrant or a half-plane (Figure 3.2). We show how to compute the maximum box when it is a rectangle, a halfstrip or a strip. The cases of a quadrant and a half-plane are even easier. The case of a quadrant can be addressed by applying the techniques based on the Dynamic Bentley’s Maximum Subsequence Sum Problem presented in Chapter 2. Both cases can be solved in O(nlog n) time (see the MWB- problem in Subsection 2.6.2). Actually, both can be solved by using our below approach if we allow sweeping to infinity, that is, the sweep stops once all points in R∪Bare swept. a) b) c) d) e) Figure 3.2: Configurations of the maximum box. a) A rectangle, b) a half-strip, c) a strip, d) a quadrant, e) a half-plane. We proceed as follows. For every red point p, we compute a rectangle H(p) which satisfies the following:
3.2. The static version of the Maximum Box Problem 63 (i) the top side of H(p) contains p, (ii) the interior of H(p) contains the maximum number of blue points and no red points, and (iii) the boundary of H(p) contains only red points. Then, we take the best of all H(p), that is, the one that contains the maximum number of blue points. To do this, for each red point p, we draw a horizontal line `passing through pand sweep the points below `by moving `downwards (Figure 3.3). Let hpbe the horizontal line that passes through p. During the sweep, we maintain two balanced binary search trees TRand TBsuch that TR(resp. TB) contains all the red (resp. blue) points that lie between hpand `sorted by x-coordinate. In TB, for each node u, we also maintain a counter of the number of blue points on the subtree rooted at u. When `passes through a point qwe perform the following. Let left(q) (resp. right(q)) be the rightmost (resp. leftmost) red point in TRlocated to the left (resp. right) of the vertical line that passes through q, and let xleft (resp. xright) be its xcoordinate. If left(q) (resp. right(q)) does not exist then xleft (resp. xright) is −∞ (resp. +∞). We only process qif the x-coordinate of plies in the interval (xleft,xright). In that case, qis inserted in TRor in TBaccording to its color and, if qis a red point, then we consider a candidate to H(p) the isothetic rectangle (half-strip or strip) Hqwhose sides pass through left(q), right(q), pand q. Note that Hqis a half-strip if either left(q) or right(q) does not exist, and that Hqis a strip if neither of them exists. The number of blue points inside Hq(i.e. |Blue(Hq)|) is equal to the number of blue points in TBwhose x-coordinate lies in (xleft, xright). At the end of the sweep, we consider the candidate to H(p) whose bottom side is at infinity (i.e. H(p) is a vertical top-bottom half-strip, quadrant, or half-plane), that is, we stop the sweeping line `at a dummy red point qthat is in the same vertical as pand below every point in R∪B. It is equivalent to say that `stops at infinity. In above procedure, left(q), right(q), and the number of blue points inside Hq, are obtained in logarithmic time each [35]. Then, for every red point qbelow hrwe obtain: both left(q) and right(q) in O(log r) time, and |Blue(Hq)|in O(log b) time. Inserting each blue point below hpin TBtakes O(log b) time. Thus each top-bottom sweep from a red point pis done in O(rlog r+rlog b+blog b) time. The overall process requires, firstly, to sort Sby y-coordinate in O(rlog r+ blog b) time (i.e. first, sort R, after that sort B, and finally merge the sorted
70 3. The Maximum Box Problem for Moving Points on the Plane and y(q0) is maximized. If lis labeled with c= 0, then there is no interval. Otherwise, find the deepest ancestor uof lsuch that lis located on the left subtree of u, and the clabel of the right child of uis equal to 0. Let lube a pointer to u. Set luequal to its right child and do, while luis not a leaf, the following: if the clabel of the left child of luis equal to 0, then make lupoint to its left child, and if not, make lupoint to its right child. When the loop ends, the interval is determined by land the predecessor leaf of lu. Furthermore, Tleft(q) is designed to support the operators JOIN1and SPLIT2, both in logarithmic time [35]. The set Tright(q) is represented in the same manner. q right(q) left(q) Ileft(q) Iright(p) TB(q) TBright (q) q0 p hp Figure 3.6: Details of D(p). The set {I(q)|q∈Red(Sp)}∪{V(q)|q∈Red(Sp)}determines a partition Pof the lower half-plane defined by hp. For each cell Cof P, we store in a balanced binary search tree TB(C) (supporting operators JOIN and SPLIT) the elements of B∩C in decreasing order of y-coordinate. Each node uis labeled with the number of blue points on the subtree rooted at uin such a way the label of the root is |B∩ C|. Each blue point qbelow hphas a reference TC(q) to the tree TB(C) where Cis the cell that contains q. Also, we associate with each qin Red(hp) the tree TB(q), which is the tree of blue points that corresponds to the cell of Pthat is bounded below by I(q), and 1Given two balanced binary search trees T1and T2, in which every value in T1is less than any value in T2, JOIN operator constructs a balanced binary search tree by merging the nodes of T1and T2. 2Operator SPLIT is like the inverse of JOIN. Given a balanced binary search tree T and a value x, splits the nodes of Tin such a way that those nodes whose value are less than (resp. greater than) xbecome the nodes of a balanced binary search tree T1(resp. T2).
3.3. The Maximum Box Problem for moving points 71 the tree TBright (q) that corresponds to the cell of Pbounded by V(q) and V(q0), and has no bottom boundary, where q0is the element that follows q in TR(Figure 3.6). Each of the trees that are used in D(p) can be implemented by using Red- Black-trees, where all the elements are stored in the leaves [35]. Because of the similarity between the structure of D(p) and the operations of the algorithm of Section 3.2, a similar algorithm to build D(p) can be designed. The following result is established: Theorem 3.4 Given R,Band p, such that |R|=r,|B|=b, and p∈R, the data structure D(p)requires O(r+b)space and can be built in O(rlog r+ rlog b+blog b)time. Proof. Both Qand TRhave O(r) space complexity. The total complexity of Ileft(q) and Iright(q) for all qin Red(Sp) is O(2|Red(Sp)|) = O(r). The total space required by TB(C) for all cells Cof Pis O(PC∈P |B∩C|) = O(|B∩ (SC∈P C)|) = O(b). Then the space complexity follows. The construction of D(p) can be done by making the following changes in the procedure presented in Section 3.2 for the static case. Process all points qbelow hpfrom top to bottom by inserting qin TRor TBaccording to its color, and, if qis a red point, do the following. Obtain left(q) and right(q) in O(log r) time, compute |Blue(H(q))|,|Blue(Hleft(q))|and |Blue(Hright(q))| by querying TBin O(log b) time, and insert Ileft(q) and Iright(q) in the trees Tright(left(q)) and Tleft(right(q)), respectively, in O(log r) time. This part of the construction has time complexity O(rlog r+rlog b+blog b). Finally, construct TB(q) and TBright (q) for all the red points qin Red(Sp) as follows. First, preprocess Bin O(blog b) time to use O(blog b) space in order to answer orthogonal range search queries in O(log b+k) time, where k is the number of reported points [31, 40]. To construct TB(q) for a given red point qin Sp, search left(q) and right(q) in O(log r) time, and then, answer an orthogonal range search query with the box H0 qwhose bottom side is I(q) and one of its top vertices is the point with minimum y-coordinate among left(q) and right(q). The range query reports in O(log b+kq) time the kq blue points in H0 q, and constructing TB(q) can be done in O(kqlog kq) time. Similarly, construct TBright (q). The overall time complexity is: X q∈Red(Sp) O(log r+ log b) + X q∈Red(Sp) O(kqlog kq) + X q∈Blue(Sp) O(log b) =O(rlog r+rlog b+blog b)
72 3. The Maximum Box Problem for Moving Points on the Plane Hence, the following theorem is obtained, Theorem 3.5 Given Rand B, such that |R|=rand |B|=b, the data structure Dhas space complexity O(r2+rb)and can be built in O(r2log r+ r2log b+rb log b)time. The following will show all the possible types of flips that can occur when the elements of R∪Bmove. We say that a flip is an x-flip (resp. a y-flip) if the involved points change their x-order (resp. y-order). Furthermore, according to the colors of the flipping points, we classify every flip in blueblue,red-blue, or red-red. The details to process any of them depend on its type. In some flips we apply insertions and/or deletions of points in D(·). As we shall see in Subsection 3.5.1, inserting or removing a blue point in a given D(p) can be done in O(r+log b) time, and inserting or removing a red point in O(r+b) time. Furthermore, in some cases we use the operations GetPriorities and RebuildCandidates, described also in Subsection 3.5.1, that both run in O(r) time. The blue-blue x-flip In this flip we do nothing because it does not affect the maximum box, neither the structure of D. The blue-blue y-flip Two blue points p1and p2make a y-flip. Exchange p1and p2in every tree of blue points TB(.) or TBright (.) that contains both. The red-blue y-flip A red point q1and a blue point q2make a y-flip. Consider five cases as depicted in Figure 3.7. Procedure red-blue-y-flip-1 (Algorithm 3) solves case 1). Note that case 5) only occurs in one structure D(·), and it can be processed by inserting/removing q2in D(q1). Procedures for the other cases are similar.
3.3. The Maximum Box Problem for moving points 73 q1 q2q3 q1q2 q3 q1 b2 q3 q1 q2 q3 3) 4) 1) 2) q1 q2 5) D(q1) Figure 3.7: y-flip cases between a red point q1and a blue point q2. Algorithm 3 red-blue-y-flip-1(q1, q2) Remove q2from D(q1) (see Subsection 3.5.1) for all red points psuch that q1and q2are in D(p)do Add +1 to the αlabel of the leaf Iright(q1) in Tleft(right(q1)). if q1is a candidate point then Add +1 to the αlabel of the leaf q1in Qand update the βlabels from q1to the root. H(p) is now determined by the βlabel of the root. end if Let T= TB(q3) if q3exists, otherwise T= TBright (q1) Pass q2from Tto TB(q1) end for The red-blue x-flip A red point q1and a blue point q2make an x-flip. Consider the two cases as depicted in Figure 3.8, and their symmetric cases. Procedure red-blue-x- flip-1 (Algorithm 4) solves case 1). The red-red flips Two red points q1and q2make a flip. We consider two cases as depicted in Figure 3.9, and their symmetric cases. We use the operators join and split [35] for x-flips. Procedures red-red-y-flip-1 (Algorithm 5) and red-red- x-flip-2 (Algorithm 6) solve cases 1) and 2), respectively.
74 3. The Maximum Box Problem for Moving Points on the Plane q1 q2 1) 2) q1 q2 q3q4 Figure 3.8: Two cases of x-flip between a red point q1and a blue point q2. q1 1) 2) q1 q2 q2 qx qz qy T1 T2 Ty1 Ty2 Figure 3.9: A flip of two red points q1and q2. 1) y-flip, 2) x-flip. In the processing of the flips we first make (if any) some update operations in at most two structures D(·), and each update costs O(r+b) time in the worst case. After that, we update each D(·) that contains the flipping points. Each of these updates runs in O(log r+ log b) time. Thus we have an O(rlog r+rlog b+b)-time update for Dwhen two points make a flip. Finally, the following result is obtained: Theorem 3.6 Given a set Rof rmoving red points and a set Bof bmoving blue points, whenever two points in R∪Bmake a flip, the data structure MBKDS can be updated in O(rlog r+rlog b+b)time. 3.3.1 A particular case Suppose that |R|= 1, |B|=nand let pbe the only one red point. We take pas a fixed point by considering the relative motions of the points in Bwith respect to p. Under this circumstances, the maximum box corresponds to an isothetic half-plane that contains pon its boundary. In this case, maintaining the maximum box over time is easier. The only thing we have to do is to maintain, between the four possible isothetic half-planes containing pin the boundary, the one that contains the maximum number of blue points inside. We only process the flips between any point of Band p, making an O(1)-
3.4. The Arbitrarily Oriented Maximum Box Problem 75 Algorithm 4 red-blue-x-flip-1(q1, q2) for all red points psuch that q1and q2are in D(p)do Find in Tleft(q1) (resp. Tright(q1)) the elements lying below q2and by using the αlabels modify their |Blue(.)|value in −1 (resp. +1). if q1is a candidate point then if x(p)<x(q1)then Find in Tleft(q1), by using clabels, the elements Iright(q) lying below q2where qis a candidate red point, and, by using αlabels, modify in −1 their |Blue(H(q))|values in Q. else Find in Tright(q1), by using clabels, the elements Ileft(q) lying below q2where qis a candidate red point, and, by using αlabels, modify in +1 their |Blue(H(q))|values in Q. end if Let T2= TB(q3) if q3exists, otherwise T2= TBright (left(q1)) Let T3= TB(q4) if q4exists, otherwise T3= TBright (q1) Pass q2from T2to T3. end if end for time update of the solution per each. Then, we can design a responsive, compact and local KDS [61]. 3.4 The Arbitrarily Oriented Maximum Box Problem In this section we consider, as an application of our method for the dynamic case, the problem of finding the maximum box for a static set R∪Bon the plane, when the box can be oriented according to any angle (direction) in [0, π] (Figure 3.10). This is an open problem [10] and here we give the first non trivial solution. An orientation of the maximum box can be determined by a rotation of the coordinate axes, and two orientations are equal if and only if their x- and y-orders are respectively equal. Thus, there are O((r+b)2) critical directions. The method of Section 3.2 can be applied for each critical direction obtaining a simple O((r+b)2(r2log r+r2log b+rb log b))-time algorithm. However, we can do it better by iterating all the critical directions and computing dynamically the Maximum Box per each. We start with the direction given by the angle θ= 0. Compute the isothetic Maximum Box and the data structure D. Then make a rotational sweep of the coordinate axis maintain-
76 3. The Maximum Box Problem for Moving Points on the Plane Algorithm 5 red-red-y-flip-1(q1, q2) Remove q2from D(q1) Remove q1from D(q2) (see Subsection 3.5.1) for all red points psuch that q1and q2are in D(p)do if q1is candidate and it is not after the flip then Remove q1from Q end if Find c1=|Blue(Hleft(q1))|in Tright(left(q1)). Do the same for c2=|Blue(Hright(q1))|and c3=|Blue(Hleft(q2))|. Remove Ileft(q2) from Tright(q1) and insert it in Tright(left(q1)) ensuring that |Blue(Hleft(q2))|=c1+c3. Remove Iright(q1) from Tleft(right(q1)) and insert it in Tleft(q2) ensuring that |Blue(Hright(q1))|=c3. if q1is candidate after the flip then Change |Blue(H(q1))|in Qto c1+c3. end if if q1was candidate before the flip and not after then Update clabels in Tleft(right(q1)) and in Tright(left(q1)). end if if q2appears as candidate after the flip then Insert q2in Qsuch that |Blue(H(q2))|=c1+c2. Update clabels in Tleft(right(q2)) and in Tright(left(q2)). end if Swap TB(q1) and TB(q2) Swap q1and q2in TR end for
3.4. The Arbitrarily Oriented Maximum Box Problem 77 Algorithm 6 red-red-x-flip-2(q1, q2) Apply GetPriorities and RebuildCandidates in D(q1) (see Subsection 3.5.1) for all red points psuch that q1and q2are in D(p)do Define qx,qyand qzas depicted in Figure 3.9 b). Note that left(qy) = qx, right(qx) = right(qy) = q1and left(qz) = q2. Let Tz= TB(qz) if qzexists, otherwise Tz= TBright (q2) Set Tz= JOIN(Tz,TB(q2)) If qxexists let v1=|Blue(Hright(qx))|, otherwise let v1= |Blue(Hleft(q1))|and qx= left(q1) Let Ty= TB(qy) if qyexists, otherwise Ty= TBright (qx) Apply SPLIT on Tyby using y(q2) to obtain the trees Ty1and Ty2as shown in Figure 3.9 b), and set Ty=Ty2and TB(q2) = Ty1. Apply SPLIT on Tleft(q1) by using y(q2) to obtain the trees T1and T2 as shown in Figure 3.9 b). Set Tleft(q1) = T1. Remove Iright(q2) from Tleft(right(q2)) and insert it in Tleft(q1) such that |Blue(Hright(q2))|= 0. Set Tright(q1) = JOIN(Tright(q1),Tright(q2)), Tleft(q2) = T2and Tright(q2) = null. Remove Ileft(q2) from Tright(q1) and insert it in Tright(qx) ensuring that |Blue(Hleft(q2))|is equal v1plus the number of elements in Ty1 if q2is candidate and it is not after the flip then Remove q2from Q Update clabels in Tleft(right(q2)) and in Tright(left(q2)). else if q2appears as candidate after the flip then Insert q2in Qsuch that |Blue(H(q2))|=|Blue(Hleft(q2))| Update clabels in Tleft(right(q2)) and in Tright(left(q2)). end if Swap q1and q2in TR end for
78 3. The Maximum Box Problem for Moving Points on the Plane y x Figure 3.10: The arbitrarily oriented Maximum Box. ing the x-order and the y-order of the elements of R∪B. The x-order (resp. y-order) changes whenever two points are at the same distance to the y-axis (resp. x-axis), implying the swap (flip) of two consecutive elements and the appearance of a new critical direction θ. Thus, the maximum box that is oriented according to θis computed by making the O(rlog r+rlog b+b)- time update in D. The overall rotation angle is at most πradians and the following result is established. Theorem 3.7 Given a set of red points Rand a set of blue points Bon the plane, such that |R|=rand |B|=b, the Arbitrarily Oriented Maximum Box Problem can be solved in O((r+b)2(rlog r+rlog b+b)) time and O(r2+rb) space. 3.5 An approximation approach In this section we study how to maintain an approximation of the maximum box (i.e. the number of blue points is approximated) by using sub-quadratic space. For a constant c∈(0,1), a c-approximation of the Maximum Box is a box containing no red points and at least cb∗blue points, where b∗is the number of blue points in the maximum box. An O(nlog2n)-time algorithm to compute a 1/2-approximation of the maximum box in the static setting is presented in [83]. The key idea the following: take the median point pof the x-order and compute the exact maximum box Hpthat has pon either its left side or its right side. Then, return the best box among Hpand the boxes that are returned by the recursive calls to the sets {q∈R∪B|x(q)<x(p)} and {q∈R∪B|x(q)>x(p)}. We use a similar procedure to extend MBKDS to a new KDS named as Apx- MBKDS. First of all, we study in Subsection 3.5.1 the dynamic operations on D(p), that is, how to efficiently perform insertions and deletions of red
3.5. An approximation approach 79 an blue points on it. Next, we consider a new data structure D∗(p) as an extension of D(p), and it is used with a binary tree that has the points of R sorted by y-coordinate. 3.5.1 Dynamic operations In this subsection we show that inserting or removing a blue point in D(p) can be done in O(r+ log b) time, and that inserting or removing a red point in O(r+b) time. These dynamic operations are based on the following primitives. GetPriorities: Given a D(p), computes in O(r) time |Blue(H(q))|for all the red points qin D(p). As will stated next. For each red point qin D(p), apply a top-bottom traversal in Tleft(q) and in Tright(q) such that for each node uwe take its αlabel uαand increase the αlabels of its children (if any) in uα, and after that, reset uαto zero. When the traversals finish, we have computed |Blue(Hleft(q))|and |Blue(Hright(q))|for all qin D(p). Note that |Blue(H(q))|=|Blue(Hleft(q))|+|Blue(Hright(q))|. The overall complexity of the traversals is O(r) time. IntersectLists(u): Given any D(p) and a point u, returns two lists Lleft and Lrigth such that: (i) Lleft (resp. Lrigth) contains the red points qof D(p) such that I(q) intersects V(u) and x(q)<x(u) (resp. x(q)>x(u)) (ii) the elements in Lleft and Lrigth are sorted in decreasing order of y-coordinate. This can be done in O(r) time as follows: Set Lleft and Lrigth to two empty lists. Iterate the red points qof D(p) by traversing the leaves of TRfrom left to right. If I(q) intersects V(u) then insert qat the end of Lleft if x(q)<x(u), otherwise insert it at the beginning of Lrigth. RebuildCandidates: This is the operation that given D(p) rebuilds in O(r) time the set Qassociated to D(p). First, we apply GetPriorities and obtain the candidates points by merging on a list Lthe two lists returned by the invocation of IntersectLists(p). After that, apply a bottom-top building of Qfrom L. Inserting a blue point uin D(p) can be done as follows: We find the cell Cof the partition Pdetermined by D(p) that contains u, and insert uin TB(C). Since we do not store explicitly the cells of P, we have to identify C. Note that either (i) Chas a red point on its bottom boundary, or (ii) C has no bottom boundary and is bounded by V(q) and V(q0), where qand q0 are consecutive red points in the x-order. In the case (i) we first find left(q) and right(q) for all red points qin D(p) in overall O(r) time, and after
Chapter 4 The Class Cover Problem with Boxes In previous chapters we dealt, in static and kinetic scenarios, with the basic problem of finding a box covering the maximum number of blue points and avoiding red points (the MB-problem). Such box does not always cover a reasonable amount of points with respect to the cardinality of the blue class. Consequently, here we consider a related problem which is to find a minimum set of boxes covering all blue points and no red point. A classical problem in Data Mining and classification problems is the Class Cover problem [27, 41, 84]. It consists in, given a bichromatic set of points S=R∪B, finding a minimum-cardinality set of R-empty balls which covers the blue class (i.e. every point in Bis contained in at least one of the balls) and with the constraint that balls are centered at blue points. In [27], the authors showed that this problem is NP-hard in general. They also presented an O(log n+ 1)-approximation algorithm, and, in the case the points lie in ad-dimensional space with Euclidean norm, for some fixed constant d, they gave a polynomial-time approximation scheme. In this chapter we study a non-constrained version in the plane, named the Boxes Class Cover problem, in which axis-aligned rectangles (i.e. boxes) are considered as the covering objects. Our problem can be formulated as follows: The Boxes Class Cover problem (BCC-problem):Given S=R∪B, find a minimum-cardinality set Hof R-empty axis-aligned open rectangles such that every point in Bis contained in at least one rectangle of H. A solution to an instance of the BCC-problem is shown in Figure 4.1 a). A similar problem is the one of covering with disks, not necessarily centered 87
88 4. The Class Cover Problem with Boxes at blue points, instead of boxes (Figure 4.1 b)). This version of the class cover problem is NP-hard [15], and as we will see in Section 4.3, it admits a constant-factor approximation algorithm [24, 87] and is APX-hard [67]. a) b) Figure 4.1: Covering the blue class: a) with boxes, b) with disks. This chapter is outlined in the following way. In Section 4.1 we prove that the BCC-problem is NP-hard. In Section 4.2 we state a first approach to our problem. In Section 4.3 we review related results concerning range spaces and epsilon-nets, which give approximation algorithms to our problem. In Section 4.4 we study the BCC-problem when we restrict the boxes to strips or half-strips. In Section 4.5 we consider the version of the BCC-problem in which the boxes are axis-aligned squares, and we prove its NP-hardness. In Section 4.6 we show that the BCC-problem remains NP-hard if the covering boxes are pairwise disjoint, and show an O(1)-approximation algorithm. Finally, in Section 4.7, we state the conclusions and further research. 4.1 Hardness In this section we prove that the BCC-problem is NP-hard. Our proof is based on a reduction from the Rectilinear Polygon Covering problem (RPC- problem), which is defined as follows: Given a rectilinear polygon P, find a minimum cardinality set of axis-aligned rectangles whose union is exactly P. See Figure 4.2 for clarity. For a general class of rectilinear polygons with holes, Masek [85] proved that the RPC-problem is NP-hard. Culberson and Reckhow [38] used a clever reduction from the 3-SAT-problem [57] to show that this problem is also NP-hard for polygons without holes. Theorem 4.1 The BCC-problem is NP-hard.
4.1. Hardness 89 H1 H2 H3 H4 a) b) P P Figure 4.2: a) A rectilinear polygon P. b) An optimal covering of Pwith four rectangles: H1,H2,H3, and H4. Proof. Let the rectilinear polygon Pbe an instance of the RPC-problem. Let A1be the set of all distinct axis-parallel lines that pass through an edge of P. For every two consecutive vertical (resp. horizontal) lines in A1, draw a vertical (resp. horizontal) line in-between. Denote as A2these additional lines. Let Gbe the grid defined by A1∪A2. We put a red (resp. blue) point in every vertex of G\P(resp. G∩P) (see Figure 4.3). Figure 4.3: The reduction from an instance of the RPC-problem to an instance of the BCC-problem. Let Sbe the above set of red and blue points. Clearly, any covering set of Pcorresponds with a solution to the BCC-problem on Swith the same cardinality. Conversely, any solution Hfor the BCC-problem on Scan be adjusted to be a covering set of P. Namely, let H={H1, H2, . . . , Hk}be
90 4. The Class Cover Problem with Boxes a solution to the BCC-problem on S. We can consider that each box in H is maximal, that is, it can not be enlarged in order to contain more blue points. Let H0 i(1 ≤i≤k) be the bounding box of Hi∩B. We have that every H0 i(1 ≤i≤k) is fully contained in P. In fact, if some H0 iis not fully inside P, then H0 imust contain at least one cell of G\Pwhich has at least one red vertex u, and thus Hicovers uwhich is a contradiction. Furthermore, Sk i=1 H0 icovers P. This can be checked as follows. Let cbe a cell of G∩P. Notice that: (i) chas exactly two adjacent sides in lines of A1 and two adjacent sides in lines of A2, and (ii) any maximal box Hvof H, covering the blue vertex vof cwhose two edges are in lines of A1, covers c. Hence, H0={H0 1, H0 2, . . . , H0 k}is a solution to the RPC-problem on P. 4.2 A simple approach Any solution Hto the BCC-problem is a covering of B, and we observe that we can extend each box H∈ H until each side of Hpasses through a red point or reaches infinity. From this observation we will only consider the set H∗of all the R-empty open boxes whose sides pass through red points or are at infinity. Up to symmetry, such types of boxes are depicted in Figure 4.4. a) b) c) d) e) Figure 4.4: Types of boxes in H∗. a) A rectangle, b) a half-strip, c) a strip, d) a quadrant, e) a half-plane. We notice that the cardinality of H∗is O(r2). Namely, let pbe a red point and let hpbe the horizontal line through p. For every red point qbelow hp, if the box Hpq, with opposite vertices pand q, is R-empty, then it can be extended horizontally until its left and right sides touch red points or reach infinity, and then Hpq become a member of H∗(Figure 4.5 a)). We also consider that qis at infinity in which case Hpq is a vertical half-line with top-most point p. Then, there are at most O(r) boxes in H∗whose top side contains p, and thus at most O(r2) boxes whose top side passes
4.2. A simple approach 91 through a red point. Similarly, there are O(r2) boxes in H∗whose left side (resp. right side, bottom side) contains a red point. Since every box in H∗has a red point on its boundary we conclude that |H∗|is O(r2). There are configurations in which |H∗|is Ω(r2). For example, suppose that ris even and distribute two sets of red points S1and S2with r/2 points each (Figure 4.5 b)) and put the bblue points anywhere. Then, we have a box in H∗for every two consecutive red points in S1and two consecutive red points in S2, thus r2/4 = Ω(r2) in total. We also notice that any solution Hto our problem is such that |H| ≤ min{r+ 1, b}because either the r+ 1 R-empty vertical strips or bsmall enough boxes cover B(Figure 4.5 c) and d)). a) b) S1 S2 p q hp Hpq c) d) Figure 4.5: a) Finding boxes in H∗whose top sides contain the red point p. b) An example in which there are Ω(r2) boxes in H∗. c) The r+ 1 R-empty vertical strips are enough to cover B. d) A small box for each blue point is a covering of B. We have seen that the BCC-problem is NP-hard, and to give an exact solution we can apply an exhaustive algorithm. First, compute in O(r2) time the set H∗, and after that, test for k= 1 . . . min{r+ 1, b}if there is a subset of cardinality kin H∗that covers B. The first covering found is a solution to our problem. Since in the worst case there are (O(r2))min{r+1,b} subsets of H∗to be tested, and every test can be done in O(min{r+ 1, b}· b) = O(min{rb, b2}) time, the overall time complexity is O(r2 min{r+1,b}· min{rb, b2}) = O(min{r2r+3b, r2bb2}). The time complexity of this simple algorithm is exponential in rand polynomial in b, and notice that if either ror bis small, e.g. O(1), then it is polynomial.
92 4. The Class Cover Problem with Boxes 4.3 Related results In this section we relate our problem with ε-nets. A finite1range space (X, R) is a pair consisting of an underlying finite set Xof objects and a finite collection Rof subsets of Xcalled ranges. Given a range space (X, R), the SET COVER problem [57] asks for the minimum-cardinality subset of R that covers X. Then, the BCC-problem is an instance of the SET COVER problem in the range space (B, H∗). The dual of the SET COVER problem is the HITTING SET problem [57], that is, to find a minimum subset P⊆X such that Pintersects with each range in R. Both problems are NP-hard and the best known factor of approximation of a polynomial-time algorithm is O(1 + log |X|) [52, 57]. For the SET COVER problem, the algorithm follows the greedy approach [35], that is, while there are elements in Xnot covered, add to the solution the set of Rcovering the maximum number of non-covered elements in X. This approach gives the same logarithmic factor of approximation for the BCC-problem, even if we modify its definition by restricting the covering boxes to axis-aligned squares (Figure 4.6). H0 H00 H1H2H3Hk−1Hk ··· ··· ··· 2k−2 2k−22k−1 2k−1 a) . . . H0 H00 H1H2Hk b) Figure 4.6: The greedy method gives a logarithmic factor of approximation for both boxes and squares. In a) (resp. b)), each of the intersections of the boxes (resp. squares) H0and H00 with the box (resp. square) Hi(1 ≤i≤k) contains 2i−1blue points. The greedy method reports {H1, H2, . . . , Hk}instead of {H0, H00}. Given the (primal) range space (X, R), its dual range space is (R, X∗) where X∗={Rx|x∈X}and Rxis the set of all ranges in Rthat contains x[24]. A set cover in the primal range space is a hitting set in its dual, and vice versa. In [24], Br¨onnimann and Goodrich give a general approach in order to find an approximated hitting set for range spaces, in such a way that when it is solved in the dual range space, it gives a set cover in the primal one. Their method is based on finding small-size subsets called 1A range space can be infinite, but for the purpose of our problem we only define it as finite.
4.3. Related results 93 ε-nets, as candidate hitting sets, and it works for range spaces with finite VC- dimension [24, 68, 101]. ε-nets were introduced by Haussler and Welzl [68] and became a main concept in computational and combinatorial geometry. Given 0 < ε < 1, a subset N⊆Xis an ε-net for Xand Rif any range H∈ R with |H∩X| ≥ ε|X|contains an element of N. In terms of our problem, an ε-net is a subset B0⊂Bsuch that any box in H∗that contains ε|B|points covers an element of B0. In the dual range space, an ε-net is a subset H⊂ H∗that covers all points pof Bsuch that pis covered by at least ε|H∗|boxes of H∗. The VC-dimension of (X, R) is stated as the maximum cardinality of a subset Y⊆Xsuch that any subset of Yis the intersection of Ywith some range in R, and the VC-dimension of the dual range space is less than 2d+1, where dis the VC-dimension of the primal space [24, 101]. Note that the VC-dimension of our range space (B, H∗) is at most four (i.e. in any subset P⊆Bwith at least five points, there is subset P0⊂Pthat can not be separated with a box in H∗from P\P0). For range spaces with constant VC-dimension, the method of Br¨onnimann and Goodrich [24] reports a hitting set of size at most a factor of O(log c) from the optimal size c. This result is based on the fact that, for every range space with finite VC-dimension d, there exists an ε-net of size O(d εlog d ε) [68]. In fact, a random sample of Xof this size is an ε-net with high probability [68]. In general, if the range space has constant VC-dimension, and there exists an ε-net of size O(1 εϕ(1 ε)), their method finds a hitting set of size O(ϕ(c)c), where cis the size of an optimal set. Therefore, since our range space (B, H∗) has constant VC-dimension (also the dual), their technique can be applied to obtain in the dual range space a hitting set of size at most a factor of O(log c) from the optimal size c, which induces a solution H(a set cover) for the BCC-problem with the same size. Thus we have an O(log c)-approximation algorithm for the BCC-problem. Recently, Aronov et al. [9] proved the existence of ε-nets of size O(1 εlog log 1 ε) for range spaces of points and box ranges. They stated as further research to find, for the dual range space, ε-nets of size less than O(1 εlog 1 ε). They also mentioned that in [25] authors claim, without proof, their existence. It would give an O(log log c)-approximation algorithm to the BCC-problem. Matouˇsek et al. proved in [87] that ε-nets of size O(1 ε) exist for range spaces of points and disk ranges, and also for half-spaces in three dimensions. Due to this, techniques in [24] provide an O(1)-approximation for the class cover problem with disks. Very recently, Har-Peled [67] proved that the general problem of covering a set of points with the minimum number of disks from a given family of disks is APX-hard [57]. In [34], Clarkson and Varadarajan
94 4. The Class Cover Problem with Boxes showed that if the geometric range space2(X, R) has the property that, given a random subset R0⊂ R and a nondecreasing function f(·), there is a decomposition of the complement of the union of the elements of R0into an expected at most f(|R0|) regions (each region of a particular form), then a cover of size O(f(|C|)) can be found in polynomial time, where Cis the optimal covering set. This result is based on the fact that, with the above conditions, there are ε-nets of size O(f(1 ε)) for the dual range space [34, Theorem 2.2]. If Ris a family of pseudo-disks3, then the trapezoidization of the complement of any subset R0⊂ R has complexity O(|R0|) and thus the dual range space has ε-nets of size O(1 ε) [34]. Note that a set of axis-aligned squares is a family of pseudo-disks, thus we can give an O(1)-approximation algorithm for the BCC-problem (by using the techniques in [24, 34]) if we restrict the covering boxes to axis-aligned squares. 4.4 Solving particular cases In this section we study the BCC-problem for some special cases. Namely, we consider only certain boxes of H∗having at most three points on their boundary. In Subsection 4.4.1 we give an O(rlog r+blog b+√rb)-time exact algorithm when we use both horizontal and vertical strips as covering objects. In Subsection 4.4.2 we only consider one type of half-strip, say top-bottom half-strips, and give an O((r+b) log min{r, b})-time algorithm. In Subsection 4.4.3 we prove that the BCC-problem remains NP-hard if we cover with half-strips in the four possible directions, and that there exists a constant factor approximation algorithm based on results in [34]. Finally, in Subsection 4.4.4, we study the case of covering with opposite half-strips, say top-bottom and bottom-top half-strips. In this case we are unable to give either a polynomial-time exact algorithm or a hardness proof, and propose a 2-approximation algorithm. 4.4.1 Covering with horizontal and vertical strips In this subsection we solve the BCC-problem by using only horizontal and vertical strips. A box in H∗is a strip if it does not contain red points in two consecutive sides (Figure 4.4 c) and e)). Thus we consider as the covering objects vertical or horizontal strips, and also axis-aligned half-planes. 2A range space (X, R) is geometric if Xis a set of geometric objects, generally points, and Ris a set of geometric ranges such as half-spaces, boxes, convex polygons, balls, etc. 3A family of Jordan regions (i.e. regions bounded by closed Jordan curves) is a family of pseudo-disks if the boundaries of any pair of regions intersect at most twice.
4.4. Solving particular cases 95 Notice that a covering set exists if and only if every blue point can be covered by an axis-parallel line avoiding red points. Also, if a blue point and a red point lie on the same vertical (resp. horizontal) line then the blue point can only be covered by a horizontal (resp. vertical) strip. Firstly, we sort Sby x-coordinate and by y-coordinate (two orders) in O(rlog r+blog b) time. Preprocess in linear time the x-order to assign for each blue point pthe references r− x(p) and r+ x(p) to its previous and next red points, respectively. We do the same with the y-order to assign r− y(p) and r+ y(p). A solution does not exist if and only if there is a blue point psuch that x(p) = x(r− x(p)) or x(p) = x(r+ x(p)), and y(p) = y(r− y(p)) or y(p) = y(r+ y(p)). It can be checked in O(r+b) time. Thus suppose now that a solution exists. We can assume that there are no red and blue points on the same horizontal or vertical line. Otherwise we can apply the following linear-time preprocessing and after that, solve the same problem for the blue points not yet covered. Given a blue point p, let Hv(p) be the vertical strip bounded by r− x(p) and r+ x(p), and Hh(p) be the horizontal strip bounded by r− y(p) and r+ y(p). From each non-covered blue point p, if x(p) = x(r− x(p)) or x(p) = x(r+ x(p)), then include in the solution the strip Hh(p). Otherwise, if y(p) = y(r− y(p)) or y(p) = y(r+ y(p)), then include Hv(p). Consider a graph Gwhose set of vertices Vis the set of strips that cover at least one blue point (Figure 4.7), and whose set of edges Eis the following: For each blue point pput an edge between the horizontal strip Hh(p) and the vertical strip Hv(p); different blue points may define the same edge. The graph Gis bipartite, has O(r) vertices and O(b) edges, and can be constructed in O(r+b) time. a) b) Figure 4.7: a) A set of red and blue points. b) Strips covering at least one blue point
102 4. The Class Cover Problem with Boxes The first one with a right-left half-strip covering the two lowest blue points in Viand a vertical strip covering the true part of αi(Figure 4.12 a)), and the second one with a vertical strip covering the false part of αiand a leftright half-strip that covers the upper two blue points of Vi(Figure 4.12 b)). We say that the first way is a true covering of xi(i.e. xiis true), and that the second one is a false covering of xi(i.e. xiis false). a) b) xi βi αi δi xi βi αi δi Figure 4.12: The two ways of optimally covering the blue points associated to a variable xi. a) xiis equal to true, b) xiis equal to false. For each clause Cj(1 ≤j≤m) that involves the variables xi,xk, and xl (1 ≤i<k<l≤m) we observe that if at least one variable, say xi, is such that the covering of Vicovers the blue points in Wj∩αi(i.e. the value of ximakes Cjtrue), then at least two half-strips are needed to cover Wj\αi. Otherwise, at least three half-strips are needed. Due to the above observations we claim that Fis satisfiable if and only if the blue points in Scan be covered with 2t+ 2mhalf-strips. In fact, if Fis satisfiable, then for each variable xiwe cover Viwith a true covering if xiis true, and otherwise with a false covering. Each clause Cj(with variables xi, xk, and xl) is true, then with two half-strips we can cover the blue points in Wjnot covered by the coverings of Vi,Vk, and Vl. We use 2thalf-strips for the variables and 2mfor the clauses, thus 2t+ 2min total. Inversely, we can not use less than 2t+ 2mhalf-strips to cover blue points in S, thus if we use exactly 2t+ 2m, then we have to use two per each variable, and two for each clause, implying that Fis satisfiable if we assign the value true to each variable xiif Vihas a true covering, and the value false otherwise. Hence, the theorem follows. Given the NP-hardness of the HSCC-problem, we are interested in approximation algorithms. Let HSbe the set of all half-strips in H∗. By using results in [34] we prove that the dual of the range space (B, Hs) has ε-nets of size O(1 ε), implying an O(1)-approximation algorithm to the HSCC-problem.
4.4. Solving particular cases 103 Theorem 4.6 There is a polynomial-time O(1)-approximation algorithm for the HSCC-problem. Proof. Let HSbe the set of all half-strips in H∗, and partition HSinto the subsets HSvand HShof all vertical and horizontal half-strips, respectively. Note that HSvand HShare families of pseudo-disks. Given ε > 0, the dual of the range space (B, HSv) has (by using [34]) an (ε 2)-net Nvof size O(2 ε). Analogously, the dual of the range space (B, HSh) has an (ε 2)-net Nhof size O(2 ε). We claim that Nv∪Nhis an ε-net of size O(4 ε) = O(1 ε) for the dual of (B, HS). In fact, if pis a blue point covered by ε|HS|half-strips, then at least ε 2|HS|of them are either vertical or horizontal. Thus pis covered by a half-strip in Nv∪Nhsince Nvand Nhare (ε 2)-nets. Hence, there exists, by [24] and also by [34, Theorem 3.2], a polynomial-time O(1)-approximation algorithm for the HSCC-problem. 4.4.4 Covering with vertical half-strips In this subsection we study the BCC-problem when the covering boxes are open vertical half-strips. At this moment we are unable to give either a polynomial-time exact algorithm or a hardness proof. Nevertheless, we propose a 2-approximation algorithm. We also observe that the greedy approach gives a logarithmic factor of approximation in the worst case (e.g. consider the set of points in Figure 4.6 b)). There are two types of vertical half-strips, top-bottom and bottom-top. Those that have a red point in its top side are top-bottom, and those with a red point in its bottom side are bottom-top. Vertical strips are simultaneously top-bottom and bottom-top half-strips. The following lemma gives a 2-approximation to our problem. Lemma 4.7 Let Hbe an optimal solution for the BCC-problem on Rand Bby using vertical half-strips as covering rectangles. Then Hcan be decomposed into sets H1and H2of open top-bottom and bottom-top half strips, respectively, whose elements are not necessarily in H∗, such that: (i) H1∪H2 covers B, (ii) H1∪H2covers no red point, (iii) the elements in H1and H2 have pairwise disjoint interiors, respectively, and (iv) |H1|+|H2|<2|H|. Proof. Let H1, H2, . . . , Hmbe the mtop-bottom half-strips plus vertical strips in H. Let x1< x2< x3<··· < x2mbe the x-coordinates of the sides of the Hi’s, i= 1, . . . , m, and define E=H1∪H2∪ ··· ∪ Hm. Then, H1 can be defined as H1={([xj, xj+1]×(−∞,+∞)) ∩E|1≤j < 2m}. Note that |H1| ≤ 2m−1. Analogously, H2can be defined by considering the m0
104 4. The Class Cover Problem with Boxes bottom-top half-strips in H. Then |H2| ≤ 2m0−1 and thus |H1|+|H2|< 2(m+m0) = 2|H|. The elements of H1and H2have pairwise disjoint interiors, respectively; and H1∪H2covers all blue points and no red point since this is done by H. An algorithm that finds optimal sets H1and H2with the same conditions as in Lemma 4.7 is a 2-approximation algorithm. By using dynamic programming [35], a polynomial time algorithm can be designed. In fact, H1∪H2has optimal substructure because if we take a vertical line `, then `intersects at most two elements of H1∪H2, and the half-strips of H1∪H2, that are completely to the left (resp. to the right) of `, form an optimal solution for the blue points covered by them. 4.5 Covering with squares In this section we study the variant of the BCC-problem in which we cover with axis-aligned squares instead of general boxes (rectangles). We name this version The Square Class Cover problem (QCC-problem). In [12] authors studied the problem of covering a binary image with the minimum number of squares, that is: Given an image, represented by an array of √n×√nblack-and-white pixels, cover the black pixels with a minimum set of (possibly overlapping) squares. It was proved that obtaining a minimum square covering for a polygonal binary image with holes is NP-hard. By a reduction from it, we show that the QCC-problem is NP-hard. A small variation in our proof shows that the the QCC-problem is also NP-hard if the squares are centered at blue points. Theorem 4.8 The QCC-problem is NP-hard. Proof. Let Pbe a polygonal binary image with holes represented by an array of √n×√nblack-and-white pixels. We reduce Pto an instance Sof the QCC-problem as follows. Let N=√n. We can see Pas a rectilinear polygon with lattice vertices in [0, N]×[0, N] (Figure 4.13 a)). We subdivide the square [0, N]×[0, N] into a regular grid Gof cell size 1 N, and put a blue (resp. red) point in every vertex of Gthat is in the interior (resp. boundary) of P(Figure 4.13 b)). Let Sbe the added set of red and blue points. Any covering of Pis a covering of S, and conversely, the squares of a covering in Scan be enlarged/shifted to be a covering of P. Namely, let Q={Q1, Q2, . . . , Qk}be a covering of S. We can assume that Qi(1 ≤i≤k) is closed and also maximal, that is, Qican not be enlarged without contain-
4.5. Covering with squares 105 a) b) 0 1 2 3 1 2 3 0 1 2 3 1 2 3 Figure 4.13: The reduction from the problem of covering a binary image with the minimum number of squares to the QCC-problem. a) A binary image represented by an array of 3×3 black-and-white pixels that is seen as a rectilinear polygon with lattice vertices in [0,3] ×[0,3]. b) The set of red and blue points generated from the image. ing red points in its interior; thus the side length of Qiis an integer number. Now we show that we can shift the elements of Qin order to obtain a covering of P. Let `be a horizontal line passing through points of S, and Q`be the set of squares of Qintersected by `. We have that Q`covers P∩`but maybe in a set I`of segments having each length at most 1 N. For a Qiin Q`, denote as x(Qi) the abscissa of the left side of Qi. In order to cover all P∩`, we shift elements of Q`as follows. For j= 0,1, . . . , N −1, if there is no segment in I`so that the abscissa of its right endpoint is jthen: if there is Qiin Q`such that j−1<x(Qi)< j, then shift Qito the right so that x(Qi) is equal to j, otherwise there is a Qiin Q`with j < x(Qi)< j + 1 and we shift Qito the left until x(Qi) is equal to j. The last condition holds since for the current jthe total shift to the left of squares is at most j N≤N−1 N<1. By repeating the above process for every horizontal line ` passing through points of S, and analogously when `is vertical, the final set Qcovers P. Notice that we can prove that the QCC-problem remains NP-hard if we restrict the squares to be centered at blue points. In fact, we can use the above reduction and only adding blue points over every lattice vertex of the interior of Pand at the centers of the pixels of P, and red points over the lattice points of the boundary of P. We have seen in Section 4.3 that there exists an O(1)-aproximation algorithm for the QCC-problem since a set of squares is a set of pseudo-disks [34].
106 4. The Class Cover Problem with Boxes 4.6 The disjoint version Another version of the BCC-problem is when the boxes of the solution are pairwise disjoint. This version is also NP-hard as we will prove. We will reduce from the Planar 3-SAT-problem which is strongly NP-complete [81]. In an instance of the Planar 3-SAT-problem we are given a planar bipartite graph such that: the vertices in one part of the bipartition are the variables, the vertices in the another part are the clauses, and the edges connect each clause with the three variables it contains. Moreover, the variables can be arranged as axis-aligned rectangles on a horizontal line, and the three-legged clauses drawn so that all edges are either above or below this line. All the graph can be embedded on a rectangular grid of polynomial size [77] (see Figure 4.14) x1x2x3x4xt Figure 4.14: Example of a planar 3-SAT instance. The variables are axis-aligned rectangles arranged on a horizontal line, and the clauses are rounded vertices with three orthogonal edges connecting to the variables. Theorem 4.9 The version of the BCC-problem in which the covering boxes are pairwise disjoint is also NP-hard. Proof. Given an instance Fof the Planar 3-SAT-problem, consisting of t variables x1, . . . , xtand mclauses C1, . . . , Cm, we construct a bicolored set of point as follows. We dispose the variables and the clauses as in Figure 4.14. We replace each variable xi(1 ≤i≤t) by a set Viof 4K+2 small axis-aligned boxes arranged in a ring-like fashion, where Kis greater than the maximum number of clauses in which a variable appears, as shown in Figure 4.15 a). We say that an axis-aligned box is oriented horizontally if its width is greater than its height, and oriented vertically otherwise. Note that two boxes in Vi, the leftmost and the rightmost, are oriented vertically and the rest 4K boxes are oriented horizontally. In each set Vi(1 ≤i≤t) the boxes are enumerated circularly from 1 to 4K+ 2. Each clause Cj(1 ≤j≤m), that
4.6. The disjoint version 107 involves the variables xi,xk, and xl(1 ≤i < k < l ≤t), is replaced by a set Wjof nine thin boxes as depicted in Figure 4.15 b). The first (resp. second, third) vertically-oriented box in Wj, from left to right, intersects exactly one horizontally-oriented box Hof Vi(resp. Vk,Vl) so that: His enumerated with an odd number if and only if xi(resp. xk, xl) is not negated in Cj, and Vi(resp. Vk,Vl) contains the center point of Hon its interior. Moreover, every box of Vi(1 ≤i≤t) intersects at most one box of the Wj’s (1 ≤j≤m). xi a) xixkxl b) pj,i pj,k pj,l Figure 4.15: Reduction from the Planar 3-SAT-problem. a) The set of boxes Vi corresponding to the variable xi. b) The set of nine boxes Wjfor the clause Cj that involves the variables xi,xk, and xl. Let G={V1, V2, . . . , Vt}∪{W1, W2, . . . , Wm}. We put a blue point in the intersection of every two boxes of Gensuring that: if the two boxes are so that one of them is oriented vertically and the other horizontally, the blue point is put closer to either the top-left or the bottom-right corner of the horizontally-oriented box; and if the two boxes are one of some Vi (1 ≤i≤t), and the other of some Wj(1 ≤j≤m), put the blue point pj,i in the center of the rectangle of Vi(see Figure 4.15). Let UGbe the region corresponding to the union of all the boxes of G. For each blue point pwe add four red points as follows. Let hp(resp. vp) be the maximal length horizontal (resp. vertical) segment containing pand fully inside UG. Put two red points, one to the left of pand other to the right, such that they are in the same horizontal line that p, outside UG, and close enough to the endpoints of hp(see Figure 4.15). Analogously, put two red points, one above pand other below p, such that they are in the same vertical line that p, outside UG, and close enough to the endpoints of vp. The red points ensure that if two blue points can be covered by a box that does not cover any red point, then both blue points belong to the same box in G.
108 4. The Class Cover Problem with Boxes Let Sbe the above set of red and blue points. Notice that the set of blue points Bithat are contained in the boxes of a given Vi(1 ≤i≤t) can be optimally covered by 2K+1 disjoint boxes which can be boxes of Viwith the same parity in their enumeration number. If the boxes are enumerated with an odd number then we have a true covering of Bi(i.e. xiis true), otherwise we have a false covering (i.e. xiis false). For the clause Cj(1 ≤j≤m), that involves the variables xi,xk, and xl(1 ≤i < k < l ≤t), we have that if at least one of the blue points pj,i,pj,k, and pj,l is covered by the coverings of Bi,Bk, and Bl, then we need exactly five disjoint boxes to cover the rest of the blue points contained in the boxes of Wj, otherwise we need exactly six. The first case is equivalent to Cjis true, and the second one to Cjis false. From this observations we conclude that Fis satisfiable if and only if the number of disjoint boxes in the solution to the BCC-problem for Sis exactly (2K+ 1)t+ 5m. Hence, the result follows. In [88] the following problem is studied: Given a set of points Pin the plane and a family Fof axis-parallel boxes that covers P, find a smallest set Fof pairwise disjoint axis-parallel boxes such that Fcovers Pand every box in Fis fully contained within a box of F. This problem is NP-hard and a polynomial-time O(1)-approximation algorithm is given in [88]. The algorithm is based on that if we have kdisjoint boxes on the plane and construct a binary space partition, it results in O(k) disjoint new boxes such that there exists either a horizontal or a vertical line which separates the set of boxes into two nonempty sets [88, 89]. Due to this, the authors apply dynamic programming. We can apply their approach to obtain a constant-factor approximated solution to our problem. Notice that every box in the solution is fully contained within a box in H∗. Thus we have to solve an instance of the problem in [88] in which Pis Band Fis H∗. 4.7 Conclusions and further research In this chapter we have addressed the class cover problem with boxes, which consists in covering the blue points with a minimum-cardinality set of axisaligned boxes, and without covering any red point. We proved the NP- hardness by a reduction from the Rectilinear Polygon Covering Problem [38], and showed that there is an O(log c)-approximation algorithm due to known results on ε-nets [24, 68, 101], where cis the size of an optimal covering. Given the hardness of the general problem, we explored some variants by restricting the covering boxes to have special shapes. If the covering boxes are vertical or horizontal strips, we presented an efficient algorithm that runs
4.7. Conclusions and further research 109 in O(rlog r+blog b+√rb) time. When the covering rectangles are half-strips oriented in one direction, say top-bottom, an O((r+b) log min{r, b})-time algorithm was proposed. If the boxes are half-strips oriented in the four directions, the problem remains NP-hard. We proved the hardness by a reduction from the 3-SAT-problem [57], and showed the existence of an O(1)-approximation algorithm from results in [24, 34]. Another variant we considered is when the boxes are vertical half-strips. It was impossible for us to give either a hardness proof or an exact polynomial-time algorithm, but we proved that there exists a 2-approximation algorithm. The version in which we cover with squares, instead of boxes, is also NP- hard. We proved it by using a reduction from the problem of covering an image with a minimum number of squares [12], which is NP-hard when the image has holes. Due to results in [24, 34], there exists a constantfactor approximation algorithm. Another variant is when the boxes are pairwise disjoint, and we showed its NP-hardness by using the Planar 3- SAT-problem [57, 81]. In that case, an O(1)-approximation algorithm exists because of results in [88, 89]. The main results of this chapter are the NP-hardness proofs and the exact algorithms when we cover with strips and top-bottom half-strips, respectively (see Subsections 4.4.1 and 4.4.2). All the approximation algorithms for the NP-hard problems come from results on ε-nets, which were stated for a more general problem, and the factors of approximation given are asymptotic. The major open problem of this chapter is to develop approximation algorithms whose approximation factors are either better than or equal, but not asymptotic, to the ones stated in this chapter. A minor open problem is to give a hardness proof, or an exact polynomial-time algorithm, for the problem of covering with vertical and horizontal half-strips (see Subsection 4.4.4).
Chapter 5 Bichromatic Discrepancy via Convex Partitions In database management systems, clustering is often an initial stage for data classification [65]. A typical problem in clustering analysis is that of splitting Sinto disjoint sets S1, . . . , Sksuch that the elements of each Siare all red or blue, and their convex hulls are pairwise disjoint. In general we would like each Sito have a large number of points. However, such partitions do not necessarily exist. For example, let Scontain 2nelements placed on a circle, and alternating in color. It is easy to see that any partition S1, . . . , Skof Sinto monochromatic subsets with disjoint convex hulls contains at least n+ 1 elements, nof which contain at most two elements. In this chapter we study a parameter that measures how blended two point sets are. Intuitively speaking, Rand Bare well blended if for any convex region Cof the plane the proportion of red elements of Sis approximately r b+r, e.g. if r= 2b, we would expect Cto contain twice as many red points as blue. It is clear that we must be careful in defining well-blended point sets. For example if Rand Bhave npoints each, we can always find ndisjoint line segments whose endpoints have different colors, and thus we could conclude that S=R∪Bis always well blended. In this chapter we introduce a parameter that seems like a good candidate to measure how well blended a bicolored point set is, we call this parameter the discrepancy of S. If Pis a point set, CH (P) will denote the convex hull of P. We say that a point set Pis in convex position if the elements of Pare the vertices of a convex polygon. Let S=R∪B, and X⊆S. Let ∇(X) = ||X∩R| − |X∩B||. We say 111
118 5. Bichromatic Discrepancy via Convex Partitions on (x0, . . . , xn−1) is [xi, xj]. Otherwise, [xi, xj] is the union of two disjoint intervals [x0, xi] and [xj, xn−1] maximizing w[x0, xi]+w[xj, xn−1]. This case can be solved in linear time, see Section 2.1 for more details. Another linear-time solution to the MWI-problem is the following. In [32], the authors solve in O(n)-time the Bentley’s problem satisfying length constraints, that is, given a lower bound L, and a upper bound U, find the maximum-weight interval with length at least Land at most U. Observe that if we duplicate our sequence Xand find the solution to the lengthconstrained Bentley’s problem with L= 1 and U=n, then we will obtain a solution to the MWI-problem on X. We show now how to solve the MM2I-problem in O(nlog n) time. In [32], the authors solve the following problem, which they call the Range Maximum- Sum Segment Query Problem with Two Query Intervals: RMSQ2-problem:Given a linear sequence X= (x0, . . . , xn−1), preprocess Xin linear time so that, for any i≤j≤k≤`, the following query can be answered in constant time: Find the interval [xs, xt]of maximum weight such that i≤s≤jand k≤t≤`. Observation 5.11 If i=j=kin the above problem, [xs, xt]will be the interval of maximum weight contained in [xi, x`]starting at xi. Let X0= (x0, . . . , xn−1, xn, . . . , x2n−1), where xn+i=xi,i= 0, . . . , n −1. Preprocess X0as in [32] to solve the RMSQ2-problem. Let I1= [xi, xj] and I2= [xk, x`] form an optimal solution to the MM2I- problem, and suppose w.l.o.g. that i≤j < k. We solve now the MM2I- problem in O(log n) time for a fixed value of i, 0 ≤i≤n−1. For simplicity assume that i= 0. Let I1= [x0, xj] and I2= [xk, x`] be an optimal solution to our problem. Notice that there exists an index tsuch that j≤t < k. Let I1(t) be an interval of maximum weight contained in [x0, xt] that starts at x0. By Observation 5.11, I1(t) can be found in constant time. Let I2(t) be the interval of maximum weight contained in [xt+1, xn−1] that can be also found in constant time. Observe that, by the way we choose I1and I2, we can assume that I1and I2are I1(t) and I2(t), respectively. Then, the MM2I-problem consists in finding a value of tso that min{w(I1(t)), w(I2(t))}is maximum. Suppose now that for a given t,w(I1(t)) ≤w(I2(t)). Then we can discard all indexes t0< t since min{w(I1(t0)), w(I2(t0))} ≤ w(I1(t0)) ≤w(I1(t)) = min{w(I1(t)), w(I2(t))}. The case when w(I1(t)) > w(I2(t)) is analogous
5.2. Point sets in convex position 119 and all indexes t0> t are discarded. It now follows that we can search for tin a logarithmic number of steps. Since the RMSQ2-problem can be used to obtain both I1(t) and I2(t) in constant time, tcan be found in logarithmic time. We repeat this procedure for i= 1, . . . , n−1 by using the preprocessing done in X0and choosing I1and I2in the interval [xi, xi+n−1] of X0. Thus we have proved: Theorem 5.12 The MM2I-problem can be solved in O(nlog n)time. 5.2.2 Computing the discrepancy of point sets in convex position Theorem 5.13 The discrepancy of a point set Sin convex position can be computed in O(nlog n)time and O(n)space. Proof. Suppose w.l.o.g. that b≤r. By Lemma 5.4, if r≥2b, then d(S) = d1(S) = r−b. Suppose then that this is not the case. By Theorem 5.10, we have to compute the maximum among d1(S), d2(S), and d3(S). Assign weights to the elements of Sas follows: red points are weighted +1, and blue points −1. We can now consider Sas a weighted circular sequence. Computing d2(S):By Lemma 5.2, any optimal convex partition contains an m-red element and an m-blue element. Let Π = {S1, S2}be a convex partition of Ssuch that S1is m-blue and S2is m-red, see Figure 5.3 a). We have that ∇(S2) = r2−b2= (r−r1)−(b−b1) = r−b+b1−r1= r−b+∇(S1)≥ ∇(S1), and thus d(S, Π) = ∇(S1). Then d(S, Π) is maximum if and only if ∇(S1) is maximum. In this case, S1corresponds to an interval of Swith minimum weight (i.e. S2has maximum weight). This an instance of the MWI-problem and can be solved in linear time. S2 S1S1 S3 S2 a) b) Figure 5.3: Points in convex position. a) Computing d2(S), b) computing d3(S).
120 5. Bichromatic Discrepancy via Convex Partitions Computing d3(S):Assume that d(S) = d3(S). Let Π = {S1, S2, S3} be an optimal convex partition of S, see Figure 5.3 b). It is easy to see, from Lemma 5.7, that if Siis m-blue (resp. m-red) then Si+1 is m-red (resp. m-blue), i= 1,2. Moreover d(S, Π) is ∇(S1) or ∇(S3), otherwise d(S, Π) ≤d(S, {S1∪S2∪S3}) = d1(S). If S1and S3are m-blue, then d(S, Π) is at most d2(S). Then S1and S3are m-red, and thus computing d3(S) reduces to the problem of finding in Stwo disjoint intervals such that the minimum weight of both of them is maximized. By Theorem 5.12, we can solve this problem in O(nlog n) time. 5.3 Point sets in general position The problem of determining the discrepancy of point sets in general position seems to be non-trivial. At this point, we are unable even to characterize point sets with discrepancy one. In this section we study some particular families of point sets. Proposition 5.14 For all n≥4, there are bichromatic point sets of size n, not in convex position, with discrepancy one. Proof. Let Sbe a point set consisting of the vertices of a regular polygon P with 2nvertices together with an extra point pclose to the center of P. Color the vertices of Pred or blue in such a way that adjacent vertices receive different color, and color pred (Figure 5.4 a)). Let Π = {S1, S2, . . . , Sk}be any convex partition of S. If k= 1 then d(S, Π) = 1. Suppose that k > 1, then there is some Si∈Π (1 ≤i≤k) such that p6∈ Siand Sicontains a set of consecutive vertices of P. Then, ∇(Si)≤1 and therefore d(S, Π) ≤1. For n= 2m+2, let Sconsist of the vertices of P, colored as before plus two points pand qin the interior of Pclose enough to the middle of an edge e of P, so that the line joining them is almost parallel to e(Figure 5.4 b)). Observe that d2(S) = 1. Let Π = {S1, . . . , Sk}be any convex partition of S. If pand qare in the same set of Π, then d(S, Π) = 1 since S\{p, q}is an alternating convex chain. Otherwise, k= 2 or there is an element Si∈Π, not containing both pand q, so that Siis composed by consecutive vertices of Pand thus d(S, Π) ≤ ∇(Si)≤1. It follows now that d(S) = 1. Proposition 5.15 Let b≤r < 2b, and dan integer such that max{1,|r− b|} < d ≤b. Then there exists a set of Swith rred points and bblue points, not in convex position, such that d(S) = d.
5.3. Point sets in general position 121 a) b) pp q Figure 5.4: In a) (resp. b)), we show a point set with discrepancy one and an odd (resp. even) number of points. Proof. We construct first a point set Sas follows. Let cbe a circle centered at the origin O, and let αbe an arc of cwith length π 2. Let mbe the point such that the midpoint of the segment joining Oto mis the midpoint of α. On a small circle centered at Oplace a point set X1of r−b+d−2 red points uniformly spaced. In a similar way, place a point set X2of d−2 blue points uniformly spaced on a small circle whose center is m. Finally, place a set X3of b−d+2 pairs of points pi, qiclose enough to αsuch that each pair contains a red and a blue point as shown in Figure 5.5, i= 1, . . . , b −d+ 2. Let S=X1∪X2∪X3. If a convex set Qis such that S∩Qis m-blue, then ∇(S∩Q)≤d. In fact, suppose that Qcontains exactly hblue points of X3, then Qhas at least h−2 red points of X3and hence ∇(S∩Q)≤h−(h−2) + (d−2) = d. Since d1(S) = d > r −b, it follows that d(S) is not d1(S). Let Π = {S1, . . . , Sk}a convex partition of Ssuch that k≥2. By Lemma 5.2, Π has an m-blue element Siand then d(S, Π) ≤ ∇(Si) = ∇(S∩CH(Si)) ≤d. om d−2 r−b+d−2 cα Figure 5.5: A point set in general position with rred points and bblue points. Its discrepancy is equal to d, where max{1,|r−b|} < d ≤b.
122 5. Bichromatic Discrepancy via Convex Partitions Choose now two pairs of points pi, qiand pj, qjin X3, and let `be the line that passes trough the midpoints of the segments determined by pi, qi and pj, qj. Let S0and S00 be the subsets of Sdetermined by `. Then d(S, {S0, S00}) = min{r−b+d, d}=d. Hence d(S) = d. Let C1, . . . , Ctbe a family of sets of points such that each Ciis in convex position. We say that C1, . . . , Ctis nested if the elements of Ci+1 belong to the interior of CH (Ci), i= 1, . . . , t −1. The following results deal with families of nested even alternating convex chains, that is, alternating convex chains containing an even number of points, see Figure 5.6 a). This special configuration allows us to give examples with any value of discrepancy and whose points are “well blended”. Lemma 5.16 Let C1, . . . , Ctbe a nested family of point sets in convex position, S=C1∪···∪Ct, and Π = {S1, . . . , Sk}a convex partition of S. Then there is an element Sisuch that Si∩Cjis Cj-consecutive for j= 1, . . . , t. Proof. The proof is by induction on t. For t= 1 the result follows from Lemma 5.8. Suppose that t > 1 and let Π = {S1, . . . , Sk}be any convex partition of S. If Si⊂C1for some i∈ {1, . . . , k}, then the result follows again from Lemma 5.8. Let Π1={S1\C1, . . . , Sk\C1}. Π1is a convex partition of S\C1, and by induction there is a subset Si∈Π such that Si\C1∈Π1and Cj∩(Si\Ct) is Cj-consecutive for j= 2, . . . , t. If Si∩C1 is C1-consecutive our result follows. Otherwise, it is easy to see that there is another element Sl∈Π such that Sl⊂C1. Our result follows. Proposition 5.17 Let C1, . . . , Ctbe a family of nested even alternating convex chains, and S=C1∪ ··· ∪ Ct. Then d(S)≤t. In some cases, d(S) = t. Proof. Let Π = {S1, . . . , Sk}be a convex partition of S. By Lemma 5.16, there is at least one Si∈Π such that Si∩Cjis Cj-consecutive for j= 1, . . . , t. Then ∇(Si∩Cj)≤1 for j= 1, . . . , t. But d(S, Π) ≤ ∇(Si)≤Pt j=1 ∇(Si∩ Cj)≤tand d(S)≤t. Let Wmbe the set of 4m2points with integer coordinates (i, j), 1 ≤i, j, ≤ 2m, and such that if i+jis even the point is colored blue, otherwise it is colored red. We call such a point set an m-chessboard. Note that Wtis the union of tnested even alternating convex chains, and thus d(S)≤t. Let ` be a line with slope π 2that leaves 1 + ···+ 2t−1 elements of Wtbelow it, see Figure 5.6 b). Then the partition of Wtinduced by `has discrepancy
5.4. Partitions with a line 123 t. It is clear that Wtcan be perturbed a bit so that all of its points are in general position without changing our results. ` a) b) Figure 5.6: a) A configuration of 3 nested even alternating convex chains. b) a 3-chessboard and a line `giving a partition with discrepancy 3. The idea of the t-chessboard can be generalized as in Figure 5.7, in which there is a line `so that, in each of the half-planes defined by `, all the tchains have the same majority color. It results in interesting cases depending of the value of t. If Sis formed by teven alternating convex chains with 4t points each, then d(S) = t=√4t2 2=√n 2. If Sis a set of n= 22m(m≥1) points distributed in t= 2m= log2neven alternating convex chains of length 22m−m=n log2neach, then d(S) = t= log2n. ` Figure 5.7: A generalization of the m-chessboard. 5.4 Partitions with a line In this section we characterize sets with linear discrepancy one and show how to decide if the linear discrepancy of a bicolored point set is equal to a
124 5. Bichromatic Discrepancy via Convex Partitions given d. We introduce the following notation. Let Π`+and Π`−be the open half-planes bounded below and above respectively by a non vertical line `. Let S`+=S∩Π`+,S`−=S∩Π`−, and Π`={S`+, S`−}. The linear discrepancy of Sis d2(S) = max`d(S, Π`), where the lines `contain no point in S. Proposition 5.18 Let S=R∪Bsuch that r=band d2(S) = 1. Then the following properties hold: 1. The convex hull of Sis an alternating chain. 2. When projected on any line, the points of Sform a sequence such that no three consecutive points have the same color. 3. For every p∈Son the convex hull of S, the angular ordering of the elements of S\ {p}with respect to pis a sequence with alternating colors. 4. For every line `passing through two points of the same color, say red, the number of red points in each of S`+and S`−is exactly one less than the number of blue points in S`+and S`−, respectively. Property 2 in Proposition 5.18 is not sufficient to guarantee that d(S) = 1, e.g. see Figure 5.8 (a). If r6=bproperties 3 and 4 in the same proposition are not necessarily true, see Fig 5.8 b) and c). We now show that if r=b, property 4is sufficient. pq p q s a) b) c) Figure 5.8: a) There are no three consecutive points of the same color in the projection on any line and d2(S) = 2, b) the red points qand sare consecutive in the angular sorting of S\{p}with respect to pand d2(S) = 1, c) the number of red and blue points in the half-plane above the line through pand qis zero and d2(S) = 1 because Sis an alternating convex chain. The next result, proven in [39], will be useful:
5.4. Partitions with a line 125 Theorem 5.19 Let Pand Qbe two disjoint convex polygons on the plane. Then there is at least one edge eof Por Qsuch that the line `econtaining eseparates the interior of Pfrom the interior of Q(Figure 5.9). P Q e `e Figure 5.9: Two convex polygons Pand Qand a separating line `econtaining the edge eof Q. Lemma 5.20 If r=bthen the following two conditions are equivalent: (a) d2(S) = 1; (b) for every line `passing through two points of Swith the same color, ∇(S`+) = ∇(S`−) = 1. Proof. It is easy to prove that (a) implies (b). We show here that (b) implies (a). Suppose that d2(S) = d≥2. We now show that there exists a line ` containing two points of the same color of Ssuch that {∇(S`−),∇(S`+)}= {d, d −2}. Let `0be a line containing no elements of Ssuch that d2(S) = d(S, Π`0) = d. Assume w.l.o.g. that `0is horizontal. Since r=bwe have that d2(S) = d(S, Π`0) = ∇(S`+ 0) = ∇(S`− 0) = dand ∇0(S`+ 0) = −∇0(S`− 0). Assume w.l.o.g. that ∇0(S`+ 0)>0 (i.e. S`+ 0is m-red and S`− 0is m-blue). Let Pand Qbe the polygons induced by the convex hulls of S`+ 0and S`− 0 respectively. Let pbe a vertex of Psuch that there is a line `0passing trough pthat separates Pfrom Q. Then pmust be a red point, for otherwise by translating `0up by a small distance, we obtain a partitioning Π0of Swith discrepancy d+1. Similarly any point qin Qsuch that there is a line trough qthat separates Pfrom Qmust be blue. By Theorem 5.19, there is an edge eof Por Q, with vertices pand qsuch that the line `econtaining eseparates Pfrom Q. If eis an edge of P, then it can be shown by using the above observation that pand qare red. Thus {∇(S`+ e),∇(S`− e)}={d, d −2}. A symmetric argument works when e belongs to Q.
126 5. Bichromatic Discrepancy via Convex Partitions The next proposition gives lower and upper bounds of the linear discrepancy. The proof is in the appendix. Proposition 5.21 max n1,b|r−b| 2co≤d2(S)≤max nb|r−b| 2c,min {r, b}o. Furthermore, both bounds are tight. Proof. Suppose w.l.o.g. that r≥b. By the Ham Sandwich Cut Theorem [58] there exists a line `, passing through at most one red point and at most one blue point, such that |S`+∩R|=|S`−∩R|=br 2cand |S`+∩B|=|S`−∩B|=bb 2c. Four cases arise depending on the parities of rand b. 1. If r= 2aand b= 2cthen `contains no point of S, and ∇(S`+) = ∇(S`−) = a−c=br−b 2c. Thus br−b 2c=d(S, Π`)≤d2(S). 2. If r= 2a+ 1 and b= 2c+ 1 then `passes through one red ppoint and one blue point q, and |∇(S`+)|=|∇(S`−)|=b−c=br−b 2c. By moving slightly `, both pand qpass to be either in S`+or in S`−thus |∇(S`+)| and |∇(S`−)|do not change. Hence br−b 2c=d(S, Π`)≤d2(S). 3. If r= 2a+ 1 and b= 2cthen `passes through only one red point p and no blue point. |∇(S`+)|=|∇(S`−)|=a−c=r−b−1 2=bn−m 2c. By moving slightly `, the point ppasses to be either in S`+or in S`−. Then min{|∇(S`+)|,|∇(S`−)|} does not change and thus br−b 2c=d(S, Π`)≤ d2(S). 4. If r= 2aand b= 2c+ 1 then `passes through only one blue point qand no red point. |∇(S`+)|=|∇(S`−)|=a−b=r−b+1 2. By moving slightly `, the point qpasses to be either in S`+or in S`− thus min{|∇(S`+)|,|∇(S`−)|} =r−b+1 2−1 = r−b−1 2=br−b 2c. Hence br−b 2c=d(S, Π`)≤d2(S). If |r−b| ≥ 2 then d2(S)≥ b|r−b| 2c ≥ 1 thus it is missing to prove that d2(S)≥1 when |r−b| ≤ 1. Suppose w.l.o.g. that b≤r≤b+ 1. If there is a blue point pin the convex hull of Stake a line `separating pfrom S\{p}and suppose that p∈S`+, then ∇(S`+) = 1, ∇(S`−) = r−b+ 1 ≥1 and d2(S)≥d(S, Πl) = 1. If no such pexists, there are two consecutive red points pand qin the convex hull of S, then take a line `separating pand qfrom S\ {p, q}and suppose that p, q ∈S`+, then ∇(S`+) = 2, ∇(S`−) = b−r+ 2 ≥1 and d2(S)≥d(S, Πl) = 1. This proves the lower bound.
5.4. Partitions with a line 127 We show now that this lower bound is tight. Suppose w.l.o.g. that r > b and let Xbe a set composed by rred points and rblue points, and let Y be a set of r−bred points. Put the elements of Xon an alternating convex chain and the elements of Yin the interior of the convex hull of Xin such a way there is a line `esuch that d(X, Π`e) = 0 and `esplits Yinto two subsets of cardinality b|Y| 2cand d|Y| 2erespectively. Let S=X∪Yand observe that d(S, Π`e) = b|Y| 2c=br−b 2c. For any line `we have that d(X, Π`)∈ {0,1} (by Lemma 5.9). If d(X, Π`) = 0 then d(S, Π`) = d(X∪Y, Π`) = d(Y, Π`)≤ b|Y| 2c=br−b 2c. If d(X, Π`) = 1 then d(X∪Y, Π`) = min{x−1,(r−b)−x+1} where xis such that lsplits Yinto xand (r−b)−xpoints, respectively. It is easy to prove that min{x−1,(r−b)−x+ 1} ≤ br−b 2c. Then d2(S) = d(S, Π`e) = br−b 2c. To prove the upper bound suppose w.l.o.g. that r≥b(i.e. b= min{r, b}). We have to show that d(S, Π`)> b ⇒d(S, Π`)≤ br−b 2cfor every line `. Let `be a line such that d(S, Π`)> b. Then we have that ∇0(S`+)>0 and ∇0(S`−)>0. In fact, suppose that ∇0(S`+)<0, then ∇(S`+) = |S`+∩ B|−|S`+∩R|≤|S`+∩B| ≤ bthus d(S, Π`)≤b, a contradiction. Now, ∇0(S`+)>0 and ∇0(S`−)>0 imply that d(S, Π`)≤ br−b 2c. In fact, suppose the contrary, ∇(S`+)≥ br−b 2c+1 and ∇(S`−) = (r−b)−∇(S`+)≥ br−b 2c+1, thus r−b≥2br−b 2c+ 2, a contradiction. If br−b 2c ≤ bthe upper bound is tight if we take separable sets Rand B. If br−b 2c> b we have shown above how to build a set of points Swith d2(S) = br−b 2c. Corollary 5.22 Let |r−b| ≥ 2. If r≥3bor b≥3rthen d2(S) = b|r−b| 2c. Proof. Suppose that r≥3b, then r−b≥2b⇒r−b 2≥b⇒ br−b 2c ≥ b. Thus the upper and lower bounds of d2(S) in Proposition 5.21 are equal. 5.4.1 Hardness We start with a technical lemma that is proven in the appendix of this chapter, Section 5.6. Lemma 5.23 Let a,band cbe three distinct integers and M= max{|a|,|b|,|c|}. Let εbe a real positive value such that ε < 1 6M2. Then there is no line that simultaneously intersects the horizontal segments [a−ε, a +ε]×a3, [b−ε, b +ε]×b3and [c−ε, c +ε]×c3unless the points (a, a3),(b, b3)and (c, c3)are collinear. Theorem 5.24 Given d≥1, it is 3SUM-hard to decide if d2(S) = d.
134 BIBLIOGRAPHY [10] B. Aronov and S. Har-Peled. On approximating the depth and related problems. SIAM J. Comput. Vol. 38, pp. 899–921, 2008. [11] M.J. Atallah. Some dynamic computational geometry problems. Comput. Math. Appl., Vol. 11, No. 12, pp. 1171—1181, 1985. [12] L.J. Aupperle, H.E. Corm, J.M. Keil, and J. O’Rourke. Covering Orthogonal Polygons with Squares. In Proc. 26th Annu. Allerton Conf. on Communications, Control and Computing, pp. 97–106, 1988. [13] J. Basch, L. J. Guibas, and J. Hershberger. Data structures for mobile data. Journal of Algorithms, Vol. 31, pp. 1—28, 1999. [14] C. Bautista-Santiago, J.M. D´ıaz-B´a˜nez, D. Lara, P. P´erez-Lantero, J. Urrutia, and I. Ventura. Computing Maximal Islands. Proceedings of the 25th European Workshop on Computational Geometry - EWCG’09, Brusseles, Belgium, 2009. [15] C. Bautista-Santiago, J.M. D´ıaz-B´a˜nez, D. Lara, C. Pel´aez, and J. Urrutia. On Covering a Class with Arbitrary Disks. Technical Report. [16] K.P. Bennett and E. Bredensteiner. Geometry in Learning. In Geometry at Work. Mathematical Association of America. Washington, D.C., 1998. [17] J. L. Bentley. Programming pearls: algorithm design techniques. Comm. ACM, Vol. 27, No. 9, pp. 865–873, 1984. [18] J. L. Bentley and M. I. Shamos. A problem in multivariate statistics: Algorithms, data structure and applications. Proceedings of the 15th annual Allerton Conference on Communications, Control, and Computing, pp. 193–201, 1977. [19] S. Bespamyatnikh and M. Segal. Covering a set of points by two axisparallel boxes. Information Processing Letters, Vol. 75, pp. 95–100, 2000. [20] B.K. Bhathacharya. Circular Separability of Planar Point Sets. Computatioanl Morphology, G.T. Toussaint ,editor. North Holland, 1988. [21] P. Bonnet, J. Gehrke, P. Seshadri. Towards Sensor Database Systems. Proceedings of the Second International Conference on Mobile Data Management, Hong Kong. Lecture Notes Comp. Sci., Vol. 1987, pp. 3–14, 2001.
BIBLIOGRAPHY 135 [22] E. Boros, P.L. Hammer, T. Ibaraki, and A. Kogan. Logical analysis of numerical data. Mathematical Programming, Vol. 79, pp. 163—190, 1997. [23] S. Brakatsoulas, D. Pfoser, and N. Tryfona. Modeling, storing, and mining moving object databases. In Proc. International Database Engineering and Applications Symposium (IDEAS), pp. 68—77, 2004. [24] H. Br¨onnimann and M.T. Goodrich. Almost optimal set covers in finite VC-dimension. Discrete and Computational Geometry, Vol. 14, pp. 463– 479, 1995. [25] H. Br¨onnimann and J. Lenchner. Fast almost-linear-sized nets for boxes in the plane. In Proc. 14th Annu. Fall Workshop Comput. Geom., pp. 36—38, 2004. [26] S. Cabello, J.M. D´ıaz-B´a˜nez, C. Seara, J.A. Sellar`es, J. Urrutia and I. Ventura. Covering point sets with two disjoint disks or squares. Computational Geometry: Theory and Applications, Vol. 40, No. 3, pp. 195– 206, 2008. [27] A.H. Cannon and L.J. Cowen. Approximation algorithms for the class cover problem. Annals of Mathematics and Artificial Intelligence, Vol. 40, pp. 215–223, 2004. [28] E. Carrizosa y B. Mart´ın. Problemas de clasificaci´on: una mirada desde la localizaci´on. Avances en Localizaci´on de Servicios y sus aplicaciones, Universidad de Murcia, pp. 249–275, 2004. [29] T. M. Chan. Low-Dimensional Linear Programming with Violations. SIAM Journal on Computing, Vol. 34, No. 4, pp. 879–893, 2005. [30] B. Chazelle. The Discrepancy Method in Computational Geometry. Handbook of Discrete and Computational Geometry, Second Edition. J. E. Goodman and J. O’Rourke, editors. CRC Press 44, pp. 983–996, 2004. [31] B. Chazelle and L. J. Guibas. Fractional cascading: A data structuring technique. Algorithmica, No. 1, pp. 133–162, 1986. [32] K.-Y. Chen and K.-M. Chao. On the range maximum-sum segment query problem. R. Fleischer and G. Trippen Eds., ISAAC 2004, LNCS 3341, pp. 294–305, 2004.
136 BIBLIOGRAPHY [33] A. Civilis, C. S. Jensen, S. Pakalnis. Techniques for Efficient Road- Network-Based Tracking of Moving Objects. IEEE Transactions On Knowledge And Data Engineering, Vol. 17, No. 5, pp. 698–712, 2005. [34] K.L. Clarkson and K. Varadarajan. Improved Approximation Algorithms for Geometric Set Cover. Discrete and Computational Geometry, Vol. 37, pp. 43–58, 2007. [35] T. H. Cormen, C. E. Leiserson, and R. L. Rivest. Introduction to Algorithms, Second Edition. MIT Press, McGraw-Hill, 2001. [36] C. Cort´es, J. M. D´ıaz-B´a˜nez, and J. Urrutia. Finding enclosing boxes with empty intersection. Proceedings of the 23rd. European Workshop on Computational Geometry, Delphi (Greece), pp. 185–188, 2006. [37] Y. Crama, P.L. Hammer, and T. Ibaraki. Cause-effect relationships and partially defined Boolean functions. Annals of Operations Research, Vol. 16, pp. 299—325, 1988. [38] J. C. Culberson and R. A.Reckhow. Covering polygons is hard. J. Algorithms, Vol. 17, pp. 2-–44, 1994. [39] J. Czyzowicz, E. Rivera Campo, J. Urrutia, and J. Zaks. Separating convex sets in the plane. Discrete and Computational Geometry, Vol. 7, pp. 189–195, 1992. [40] M. de Berg, M. van Kreveld, M. Overmars, and O. Schwarzkopf, Computational Geometry: Algorithms and Applications, Third Edition, Springer - Verlag, 2008. [41] J.G. Devinney and C. Priebe. The class cover problem and its applications in pattern recognition. The Johns Hopkins University, 2003. [42] D.P. Dobkin and D. Gunopulos. Concept learning with geometric hypotheses. Proceedings of the 8th Annu. Conference on Computational Learning Theory, ACM Press, pp. 329–336, 1995. [43] D.P. Dobkin and D. Gunopulos. Geometric Problems in Machine Learning. Selected papers from the Workshop on Applied Computational Geormetry, Towards Geometric Engineering, Vol. 1148, pp. 121–132, 1996. [44] D.P. Dobkin, D. Gunopulos, and W. Maass. Computing the maximum bichromatic discrepancy, with applications to computer graphics and
BIBLIOGRAPHY 137 machine learning. J. Computer and Systems Sciences, Vol. 52, No. 3, pp. 453–470, 1996. [45] D.P. Dobkin, D. Eppstein, and D.P. Mitchell. Computing the discrepancy with applications to supersampling patterns. ACM Transactions on Graphics (TOG), Vol. 15, No.4, pp. 354–376, 1996. [46] R. Duda, P. Hart, and D. Stork. Pattern classification. John Wiley and Sons, Inc., New York, 2001. [47] A. Dumitrescu and J. Pach. Partitioning Colored Point Sets into Monochromatic Parts. F. Dehne, J.-R. Sack, and R. Tamassia (Eds.): WADS 2001, LNCS 2125, pp. 264—275, 2001. [48] J. Eckstein, P. L. Hammer, Y. Liu, M. Nediak, and B. Simeone. The maximum box problem and its applications to data analysis. Comput. Optim. Appl., Vo. 23, pp. 285–298, 2002. [49] H. Edelsbrunner and F. P. Preparata. Minimum polygonal separation. Inform. Comput., Vol. 77, pp. 218–232, 1988. [50] H. Everett, J.M. Robert, M. Kreveld. An Optimal Algorithm for Computing (≤k)-Levels, with Applications to Separation and Transversal Problems. Int. J. Comput. Geom. Appl., Vol. 6, pp. 247–261, 1996. [51] T.H. Fan, S. Lee, H.I. Lu, T.S. Tsou, T-C. Wang, and A. Yao. An Optimal Algorithm for Maximum-Sum Segment and Its Application in Bioinformatics. CIAA, LNCS 2759, pp. 251–257, 2003. [52] U. Feige. A threshold of ln nfor approximating set cover. Journal of ACM, Vol. 45, No. 4, pp. 634-–652, 1998. [53] S. P. Fekete. On the complexity of min-link red-blue separation. Manuscript, Department of Applied Mathematics, SUNY Stony Brook, NY, 1992. [54] M.L. Fredman. On computing the length of longest increasing subsequences. Discrete Mathematics, Vol. 11, pp. 29–35, 1975. [55] A. Gajentaan and M. H. Overmars. On a class of O(n2) problems in computational geometry. Computational Geometry: Theory and Applications, Vol. 5, pp. 165–185, 1995. [56] V. Garc´ıa, J.S. Garreta, R.M. Cardenas, R. Alejo, and J.M. Sotoca. The class imbalance problem in pattern classification and learning. CEDI 2007, II Congreso Espa˜nol de Informatica. Zaragoza, 2007.
138 BIBLIOGRAPHY [57] M.R. Garey and D.S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York, NY, 1979. [58] J. E. Goodman and J. O’Rourke, editors. Handbook of Discrete and Computational Geometry, CRC Press LLC, Boca Raton, FL, 1997. [59] Q. Gu, Z. Cai, L. Zhu, and B. Huang. Data Mining on Imbalanced Data Sets. 2008 International Conference on Advanced Computer Theory and Engineering. ICACTE, pp. 1020–1024, 2008 [60] L.J. Guibas. Kinetic Data Structures. Handbook Of Data Structures And Applications (Chapman & Hall/Crc Computer and Information Science Series.). D.P. Mehta and S. Sahni, editors. Chapman & Hall/CRC, 2004. [61] L.J. Guibas. Kinetic Data Structures: A State of the Art Report. In Proceedings of the Third Workshop on the Algorithmic Foundations of Robotics on Robotics: the algorithmic perspective. Houston, Texas, United States, pp. 191–209, 1998. [62] P. Gupta, R. Janardan, and M. Smid. Fast algorithms for collision and proximity problems involving moving geometric objects. Computational Geometry, Theory and Applications, Vol. 6, pp. 371—391, 1996. [63] P. L. Hammer and T. Bonates. Logical analysis of data: from combinatorial optimization to medical applicatios. Rutcor Research Report, RRR 10-2005, Rutger University, New Jersey, USA, 2005. [64] P.L. Hammer, A. Kogan, B. Simeone, and S. Szedmak. Pareto-optimal patterns in logical analysis of data. RUTCOR Research Report 7-2001, 2001. [65] J. Han and M. Kamber. Data mining: concepts and techniques, Morgan Kaufmann Publishers, USA, 2006. [66] H. Hand, H. Mannila, and P. Smyth. Principles of data mining. The MIT Press, 2001. [67] S. Har-Peled. Being Fat and Friendly is Not Enough. CoRR, 2009. [68] D. Haussler and E. Welzl. ε-nets and simplex range queries. Discrete Computational Geometry, Vol. 2, pp. 127–151, 1987.
BIBLIOGRAPHY 139 [69] J.E. Hopcroft and R.M. Karp. An n5/2algorithm for maximum matchings in bipartite graphs. SICOMP, Vol. 2, pp. 225—231, 1973. [70] M. E. Houle. Algorithms for weak and wide separation of sets. Proceedings of the International Workshop on Discrete Algorithms and Computation, pp. 61—68, 1989. [71] X. Huang. An Algorithm for Identifying Regions of a DNA Sequence that Satisfy a Content Requirement. CABIOS, Vol. 10, pp. 219–225, 1994. [72] P. Indyk. High-dimensional computational geometry. Ph. Thesis. Advisor: R. Motwani. Stanford University Stanford, CA, USA, 2001. [73] A. Kaneko and M. Kano, Discrete geometry on red and blue points in the plane–a survey. In Discrete and Computational Geometry, The Goodman-Pollack Festschrift, Vol. 25 of Algorithms and Combinatorics, Springer-Verlag, pp. 551–570, 2003. [74] M. Kano and M. Uno. General Balanced Subdivision of Two Sets of Points in the Plane. J. Akiyama et al. (Eds.): CJCDGCGT 2005, LNCS 4381, pp. 79–87, 2007. [75] S. Kotsiantis. Educational data mining: a case study for predicting dropout-prone students. International Journal of Knowledge Engineering and Soft Data Paradigms. Vol. 1, No. 2, pp. 101–111, 2009 [76] D. E. Knuth. Sorting and searching. The art of computer programming. Addison-Wesley, 2000. [77] D. E. Knuth and A. Raghunathan. The problem of compatible representatives. SIAM Journal of Discrete Mathematics. Vol. 5, No. 3, pp. 422–427, 1992. [78] S.R. Kosaraju, N. Megiddo, and J. O’Rourke. Computing Circular Separability. Discrete Computatioanl Geometry. Vol. 1, pp. 105–113, 1986. [79] L.V.S. Lakshmanan, R.T. Ng, C.X. Wang, X. Zhou, and T.J. Johnson. The generalized MDL approach for summarization. International Conference on Very Large Data Bases, 2002. [80] P.F. Lambert. Designing Pattern Categorizers with Extremal Paradigm Information. Proceedings of the International Conference on Mehtodologies of Pattern Recognition, pp. 359–391, 1969.
140 BIBLIOGRAPHY [81] D. Lichtenstein. Planar formulae and their uses. SIAM Journal of Computing. Vol. 11, No. 2, pp. 329–343, 1982. [82] Y.L. Lin, T. Jiang, and K.M. Chao. Efficient Algorithms for Locating the Length-constrained Heaviest Segments with Applications to Biomolecular Sequence Analysis. Journal of Computer and System Sciences, Vol. 65, pp. 570–586, 2002. [83] Y. Liu and M. Nediak. Planar Case of the Maximum Box and Related Problems. Proceedings of the Canadian Conference on Computational Geometry, Halifax, Nova Scotia, 2003. [84] D. Marchette. Class cover catch digraphs. Wiley Interdisciplinary Reviews: Computational Statistics, Vol. 2, No. 2, pp. 171–177, 2010. [85] W. J. Masek. Some NP-complete set covering problems. Manuscript, MIT, Cambridge, MA, 1979. [86] J. Matouˇsek. Geometric Discrepancy: An Illustrated Guide. Springer- Verlag, 1999. [87] J. Matouˇsek, R. Seidel, and E. Welzl. How to Net a Lot with Little: Small ε-Nets for Disks and Halfspaces. Proceedings of the 6th Annual ACM Symposium on Computational Geometry, pp. 16–22, 2000. [88] J.S.B. Mitchell. Approximation algorithms for geometric separation problems. Technical report, Dept. of Applied Math. and Statistics, State U. of New York at Stony Brook, July 1993. [89] M. S. Paterson and F. F. Yao. Optimal binary space partitions for orthogonal objects. Journal of Algorithms, Vol. 13, pp. 99–113, 1992. [90] S. Har-Peled and and V. Koltun. Separability with Outliers. Lecture Notes in Computer Science, Vol. 3827, pp. 28–39, 2005. [91] F.P. Preparata and M. I. Shamos. Computacional Geometry, An Introduction, Springer-Verlag, 1988. [92] J.R. Sack and J. Urrutia, editors. Handbook of Computational Geometry, North-Holland, Elsevier, 2000. [93] E. Sch¨omer and C. Thiel. Efficient collision detection for moving polyhedra. In Proc. 11th Annu. ACM Sympos. Comput. Geom., pp. 51—60, 1995.
BIBLIOGRAPHY 141 [94] C. Seara. On geometric separability. Ph. Thesis. Advisor: F. Hurtado. Universitat Polit`ecnica de Catalunya, Barcelona, 2002. [95] M. Segal. Planar Maximum Box Problem. Journal of Mathematical Modeling and Algortihms. Vol. 3, pp. 31–38, 2004. [96] A.P. Sistla, O. Wolfson, S. Chamberlain, and S. Dao. Modeling and querying moving objects. In Proc. International Conference on Data Engineering (ICDE), pp. 422—432, 1997. [97] A.P. Sistla, O. Wolfson, S. Chamberlain, and Y. Yesha. Updating and querying databases that track mobile units. Distributed and Parallel Databases, Vol. 7, No. 3, pp. 257—387, 1999. [98] T. Takaoka. Efficient Algorithms for the Maximum Subarray Problem by Distance Matrix Multiplication. Electronic Notes in Theoretical Computer Science, Vol. 61, pp. 191–200, 2002. [99] H. Tamaki and T. Tokuyama. Algorithms for the Maximum Subarray Problem Based on Matrix Multiplication. Interdisciplinary Information Sciences, Vol. 6, No. 2, pp. 99–104, 2000. [100] V.V. Vazirani. Approximation algorithms. Springer-Verlag New York, Inc., New York, NY, 2001. [101] V. N. Vapnik and A. Ya. ˇ Cervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. Theory Probab. Appl., Vol. 16, pp. 264–280, 1971.