Covering Points by Disjoint Boxes with Outliers This work was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education, Science and Technology (No. 2009-0067195) and by the Brain Korea 21 Project in 2010.

# Covering Points by Disjoint Boxes with Outliers ††thanks: This work was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education, Science and Technology (No. 2009-0067195) and by the Brain Korea 21 Project in 2010.

Hee-Kap Ahn111Department of Computer Science and Engineering, POSTECH, South Korea. {heekap, helmet1981, irisrein, mnbiny}@postech.ac.kr    Sang Won Bae444Department of Computer Science, Kyonggi University, Suwon, Korea. swbae@kgu.ac.kr    Erik D. Demaine222 MIT Computer Science and Artificial Intelligence Laboratory. {edemaine, mdemaine}@mit.edu    Martin L. Demaine222 MIT Computer Science and Artificial Intelligence Laboratory. {edemaine, mdemaine}@mit.edu    Sang-Sub Kim111Department of Computer Science and Engineering, POSTECH, South Korea. {heekap, helmet1981, irisrein, mnbiny}@postech.ac.kr    Matias Korman333Computer Science department, Université Libre de Bruxelles (ULB), Belgium. mkormanc@ulb.ac.be    Iris Reinbacher111Department of Computer Science and Engineering, POSTECH, South Korea. {heekap, helmet1981, irisrein, mnbiny}@postech.ac.kr    Wanbin Son111Department of Computer Science and Engineering, POSTECH, South Korea. {heekap, helmet1981, irisrein, mnbiny}@postech.ac.kr
###### Abstract

For a set of points in the plane, we consider the axis–aligned -Box Covering problem: Find axis-aligned, pairwise-disjoint boxes that together contain at least points. In this paper, we consider the boxes to be either squares or rectangles, and we want to minimize the area of the largest box. For general we show that the problem is NP-hard for both squares and rectangles. For a small, fixed number , we give algorithms that find the solution in the following running times: For squares we have time for , and time for . For rectangles we get for and time for . In all cases, our algorithms use space.

## 1 Introduction

Motivated by clustering, we consider the problem of splitting a large set of points into a small number of groups. From a geometric point of view, we want to group points together that are ‘close’ with respect to some distance measure. It is easy to see that the choice of distance measure directly influences the shape of the clusters. Depending on the application, it may be useful to consider only disjoint clusters. It is important to take noise into account, especially when dealing with raw data. That means, we may want to remove outliers that are ‘far’ from the clusters, or that would unduly influence their shape.

In this paper, we consider the following optimization problem: Given a set of points in the plane and two integers and , find pairwise-disjoint squares or rectangles that together contain at least points of and minimize the largest area among the squares or rectangles. We treat the squares or rectangles as closed sets, and although we want them to be pairwise-disjoint, we allow overlap at their boundaries or corners.

We call this problem the -Square Covering and the -Rectangle Covering problem, respectively, according to the shape of the covering regions. The points that are not covered by a solution of the problem are called outliers.

Both problems are variations and/or extensions of the rectilinear -center problem. This is usually considered as the problem of finding congruent squares of smallest possible size that together contain all points of , where the squares may overlap. In our setting, however, we have (1) that the regions must not overlap each other (except at their boundaries) and (2) that up to a predefined number of points are considered as outliers and can be ignored. It is known that the rectilinear -center problem is NP-hard even to approximate within ratio  . However, for , worst-case optimal-time algorithms are known: linear time for and time for . For , the best known time bound is  .

For the -Rectangle Covering problem, less work has been done. Bespamyatnikh and Segal  presented a deterministic time algorithm for , but no efficient algorithm for is known. Several papers considered variations of the -Rectangle Covering problem — e.g., arbitrary orientation and three or higher dimensions — and achieved efficient algorithms; see for example [2, 10, 13, 14, 19].

Outliers can also be seen as violation of constraints: basically, the points in are constraints to be covered by squares or rectangles in our problems and of them are allowed to be violated. In this sense, there is a connection to geometric optimization with violated constraints which has been studied by several researchers. Matoušek  and Chan  presented efficient algorithms for LP-type problems allowing violated constraints. The class of LP-type problems, which extends linear programming in a combinatorial sense, was introduced by Sharir and Welzl . Also, a deterministic linear-time algorithm for LP-type problems of finite LP-dimension is known . The LP-dimension is a parameter associated with an LP-type problem; for instance, the -Square Covering problem, or equivalently the rectilinear -center problem, has LP-dimension since the smallest unique enclosing square is determined by three points of the given point set. Indeed, the rectilinear -center problem for is known to be an LP-type problem , so linear-time algorithms follow. Thus, the -Square Covering problem can be solved in time and the -Rectangle Covering problem in time, according to Chan . For LP-dimension larger than four, no efficient algorithm has been found as to date. More details on LP-type problems can be found in Sharir and Welzl , Matoušek and Škovroň , and Dyer et al. .

Independent of LP-type problems with violated constraints, there are some previous results dealing with outliers when . Aggarwal et al.  achieved a running time of using space for both the -Square Covering and the -Rectangle Covering problems. Later, Segal and Kedem  gave an time algorithm for the -Rectangle Covering problem using space. A randomized algorithm that runs in time was given for the -Square Covering problem by Chan . Most recently, Atanassov et al.  presented an time algorithm for the -Rectangle Covering problem.

Most of the above algorithms are optimal when the number of outliers is either a small constant or close to . In this paper, we are interested in algorithms with small running time in . Ideally, we would also like to preserve optimality in for small . We summarize the new results shown in this paper:

• NP-hardness: In Section 3, we prove that both the -Square Covering and the -Rectangle Covering problems are NP-hard when is part of the input, even for a fixed . These are the first NP-hardness proofs for a variant of the rectilinear -center problem where the covering regions are disjoint and also for the problem of covering points by rectangles.

• Efficient algorithms for small : In Section 4, we give efficient algorithms if the number of boxes is small. All our algorithms use linear space. The running times of our algorithms are summarized in Table 1. Recall that the previously best known results for this problem with outliers were restricted to only one box: for the -Square Covering problem , and for the -Rectangle Covering problem .

## 2 A lower bound

We consider the -Square Covering and the -Rectangle Covering problem. Given a set of points in the plane, and two integers and , find axis–aligned pairwise–disjoint (overlap of boundaries is allowed), closed squares or rectangles, that together cover at least points of , such that the area of the largest square or rectangle is minimized. We refer to the points that are not contained in the union of all squares or rectangles as outliers.

The algorithms we present in Section 4 are efficient, as we can show the following lower bound that holds for both the -Square Covering and the -Rectangle Covering problem.

###### Lemma 1.

Let be part of the input and let be any fixed positive integer. Then, both the -Square Covering and the -Rectangle Covering problem have an lower bound in the algebraic decision tree model.

###### Proof.

We reduce from 1-dimensional set disjointness: Given a sequence of real numbers, we want to decide whether there is any repeated element in . The following works for both squares and rectangles.

Given the sequence , we generate the point set . We compute the minimal squares that cover , allowing exactly outliers, which means that the union of the squares must cover points. Thus, the covering squares degenerate to points (i.e., squares of side length zero) if and only if there is a repeated element in the sequence. Otherwise, by the pigeon hole principle, one of the covering squares must cover at least two points and hence, has positive area. ∎

Similar bounds for slightly different problems were given by Chan  () and by Segal  (, arbitrary orientation).

## 3 NP-Hardness Results

In this section, we show that both the -Square Covering and the -Rectangle Covering problems are NP-hard for any fixed when is part of the input. In the following, we focus on the decision version of the two problems for : Given points in the plane and an integer , decide whether or not there exist axis–aligned unit squares or axis–aligned rectangles of area at most one that together cover all points. We reduce from planar 3-SAT. Note that we are not dealing explicitly with outliers. However, the reduction can be adapted by placing points at a sufficiently large distance from the other points as not to be included in the covering. Furthermore, note that our reductions work for all possible cases where the squares or rectangles may (not) overlap or need (not) be congruent. The optimal solutions may be different, however, depending on the underlying case.

### 3.1 Covering Points with Squares

In this section we study the complexity of the -Square Covering problem: cover points in the plane with axis-aligned squares while minimizing the area of the largest square.

NP-hardness of the -center problem (i.e., covering with congruent squares which are allowed to overlap) has been shown previously by Fowler et al. , and by Meggiddo and Supowit . Here we show NP hardness for the case of covering by congruent squares that must not overlap (except at their boundaries).

We reduce from planar 3-SAT: given a 3-CNF formula with variables and clauses , let be the graph of , defined as:

• or

If is a planar graph, then is called a planar -CNF formula. It is NP-hard to decide whether a given planar -CNF formula is satisfiable or not .

#### 3.1.1 Reduction Figure 1: Left: Variable gadget consisting of 4N points that can be covered in two different ways with 2N unit squares (either light or dark grey). Right: Clause gadget with 4M+1 points (including three link points - depicted as hollow circles). 2M boxes are necessary and sufficient to cover all points except any one of the link points.

Given a planar 3-SAT instance, we construct a -Square Covering instance on a grid such that the 3-SAT instance is satisfiable if and only if all points can be covered by unit squares. The reduction is as follows, with all points lying on a grid, such that the distance between two points in the same grid cell is one unit.

• For each variable , we create a gadget of points arranged in a ring-like fashion (where is a sufficiently large constant). By construction, there are only two different ways of covering all generated points with unit squares (see Figure 1, left). We associate each of the coverings to an assignment either of TRUE or FALSE to the literal, and define the TRUE region as the union of squares in the TRUE assignment, and the FALSE region as the union of squares in the FALSE assignment.

• For each clause , we generate points in a linear fashion, where is another large constant. There are three special link points in the gadget: the rightmost, leftmost and middle points of the linear segment, depicted as hollow circles in Figure 1, right.

The main property of the clause gadget is the following:

###### Lemma 2.

To cover all points of a clause gadget except for any one of the three link points, unit squares are sufficient and necessary.

###### Proof.

Figure 1, right, shows a covering of all points (except for the middle link point) with squares. By shifting the rightmost (or leftmost) squares to the center, we can cover the middle link, but at the same time we uncover the right (or left) link point; therefore the upper bound holds.

Consider any covering of all non-link points, which forms two sequences of equal length to the left and right of the middle link point, that are more than unit distance apart. We need at least squares to cover each point sequence, thus the lower bound also holds. ∎ Figure 2: Connection between a clause gadget and its corresponding variable gadgets (switches depicted as crosses and links as hollow circles). In the clause cj, x1 and x2 are negated — their switch lies in the FALSE region, whereas x3 is non negated in cj — the switch lies in the TRUE region. The assignment of x1,x3 – TRUE (light grey) and x2 – FALSE (dark grey), which satisfies the clause cj, leads to a covering of all connecting points and the clause gadget.

We connect each clause gadget with its three corresponding variable gadgets as follows (see Figure 2): from each link point of a clause we add a sequence of connecting points leading to one variable. Let (, resp.) be the total number of points added to connect clause gadget with the variable gadgets (, resp.). We set to be odd, which can always be done by making the underlying grid sufficiently fine.

For each connection between clause gadget and the variable gadgets and , we add three additional points called switches and . We put the switches between two points of the outer boundary of the variable gadget, either in its FALSE or TRUE region, depending on whether the associated literal is negated or not. This way the switch is already covered by a square of the variable gadget if and only if the corresponding variable assignment makes the literal TRUE. We say that the switch is on if it is covered by a square of the variable gadget, and off otherwise. Figure 2 shows how to connect the clause gadget with the three variable gadgets when the specific assignment of truth values is TRUE for and FALSE for .

###### Lemma 3.

Any clause gadget and its connecting points can be covered with unit squares if and only if at least one switch is on.

###### Proof.

Consider the covering of the connecting points when the corresponding switch is off, i.e., it is not covered by a square of the associated variable gadget. In this case, the first square of the connection must cover both the switch and the first connecting point. The following squares cover the second and third connecting points, etc. Since the number of connecting points is odd, the last square covers the last two connecting points.

If the switch is on, i.e., it lies in the covering of the variable, then the first square of the connection can be moved to cover the first and second connecting points, the second square covers the third and fourth connecting points, and the last square covers the last connecting point and the th link point of the clause gadget .

Clearly squares are necessary to cover all connecting points, thus the remainder of this lemma follows directly from Lemma 2. ∎

Since is planar, there exists an embedding of our construction so that no two connections overlap. Furthermore, since is large (in particular larger than the degree of ), we can place switches far away from each other (i.e., more than two units away from each other) so that the associated coverings are independent. Using the lemma above we derive the following lemma:

###### Lemma 4.

A planar -SAT formula is satisfiable if and only if the associated point covering problem instance can be covered with unit squares, where .

###### Proof.

(): Consider any covering of the points. Using Lemma 3 and the pigeon hole principle, unit squares are needed to cover all variable gadgets and at least unit squares are necessary to cover all clause gadgets (including the connecting points and switches). Thus, each variable must be covered with exactly squares and each clause must use exactly squares.

In particular, the covering for the variables is fixed; hence any covering gives a valid variable assignment. By Lemma 3 we get that at least one switch must be on for each clause. This corresponds to each clause being satisfied at least once; thus the 3-SAT instance as a whole is satisfied.

(): Given a variable assignment, we generate the corresponding covering. By construction, each clause must have at least one switch on, therefore the gadget of (and its connecting points) can be covered using squares. ∎

The following lemma on hardness of approximation follows from our construction above:

###### Lemma 5.

If the -SAT formula is not satisfiable, any covering with squares has at least one square with area at least .

###### Proof.

By construction, all points have integer coordinates (semi integer if the point is a switch). That is, all points can be written as , where and . Assume that there exists a covering which has a largest square with area strictly smaller than (i.e., the largest square has side length smaller than ). Given any square covering of the construction, we shrink each square until it has two points on opposite sides of the boundary, without uncovering any points. By shrinking the squares, we set the side length of each square to the difference in either - or -coordinates of some two points of the construction. Since by Lemma 4 it is not possible to find a covering with unit squares, the next possible side length is .

We conclude this section with the following theorem:

###### Theorem 1.

Given points in the plane, let be part of the input and let be any fixed integer with . Then, the -Square Covering problem is NP-hard. Moreover, it is NP-hard to find an approximate solution within ratio .

### 3.2 Covering Points with Rectangles

In this section we show NP-hardness for the -Rectangle Covering problem. Note that by making an affine transformation of the previous reduction for squares, we can easily obtain hardness for coverings with rectangles of any fixed ratio. However, the reduction does not work for arbitrary rectangles, since in this case we can cover each variable gadget with eight horizontal and vertical segments of zero area (i.e., arbitrarily thin rectangles). By doing so, all switches will be on, regardless of the variable assignment, and the reduction fails. Hence, we need a different reduction for the -Rectangle Covering problem. Again, we reduce from planar 3-SAT, and focus on the decision version of the problem for . We call an axis–aligned rectangle a unit rectangle if its area is at most one, and unit rectangles form a unit covering if they together cover all points.

#### 3.2.1 Staircase sequences

For our reduction, we need the notion of staircase sequences:

###### Definition 1.

A sequence of points in the plane is a staircase sequence if and only if it satisfies the following properties:

• For any integer , two consecutive points and of the sequence have the same -coordinate and two consecutive points and have the same -coordinate (we assume the sequence is closed and set ).

• No unit rectangle covers any two non-consecutive points of .

We call staircase sequences mutually independent if no unit rectangle contains points of more than one sequence.

We will consider a covering of points that can be decomposed into mutually independent staircase sequences. By definition, no unit rectangle can include points of two independent sequences, thus the coverings of each sequence can be considered independently.

Consider any unit covering of a single staircase sequence of points with rectangles. If we cover successive points by horizontal or vertical segments, we obtain a covering with largest area zero. We call the covering of a staircase sequence vertical, if the sequence is covered by rectangles such that each rectangle contains two points with the same -coordinate. Similarly, we call the covering of a staircase sequence horizontal, if the points inside one rectangle have the same -coordinate, see Figure 3. Figure 3: Staircase sequence of 2N points. Selecting either the horizontal or vertical segments are the only ways of covering the sequence with N unit rectangles.
###### Lemma 6.

Any unit covering of a staircase sequence of points with rectangles must either be a vertical or a horizontal covering.

###### Proof.

By the definition of staircase sequence no unit rectangle can cover three points. Therefore, each covering rectangle must contain exactly two consecutive points. Since the rectangles must be disjoint, either all rectangles cover two points with the same -coordinate or all rectangles cover points with the same -coordinate. ∎

unit rectangles are both necessary and sufficient to cover a staircase sequence of points, therefore we have:

###### Corollary 1.

Any unit covering of mutually independent staircase sequences, each with points, that uses rectangles must have either a vertical or a horizontal covering for each sequence.

#### 3.2.2 Reduction

We construct mutually independent staircase sequences of points each, where is the number of variables in the associated 3-SAT instance. Any unit covering of the points with rectangles gives a variable assignment as follows: variable is set to TRUE if the th staircase sequence has a horizontal covering, and FALSE otherwise. Similar to the square case, we add one more point for each clause. This point can only be covered by a unit rectangle if the corresponding variable assignment satisfies the clause. Figure 4: As G(F) is planar, we can transform any plane embedding of G(F) into a rectilinear drawing such that each rectilinear tree has N−2 bends and non-adjacent bends do not have the same x- or y-coordinates.

Recall that is planar, thus there exists a planar embedding of such that all edges can be drawn as rectilinear arcs in the unit grid. For simplicity, we first consider the case in which there is at least one negated and one non-negated literal in each clause (we will show how to deal with the other types of clauses later). We call the union of all rectilinear arcs that connect some variable to the clauses containing a rectilinear tree. That is, we consider the variable node as the root, and the clause nodes as the leaves, and we choose an embedding for each tree such that the root and each internal node has degree exactly three and the whole tree has exactly bends. As is planar, and we can choose sufficiently large, this is always possible. Consider now the rectilinear arc connecting variable with clause . We modify the embedding such that the component of a tree incident to clause is vertical if the literal is negated in , and horizontal otherwise, which is also always possible. We then further perturb the embedding such that no two non-successive bends of any rectilinear arcs have the same - or -coordinate. Finally, to avoid overlap when thickening the trees (as explained in the next paragraph), we scale the embedding by a factor , see Figure 4 for an illustration. Figure 5: Thickening of rectilinear trees results in a staircase sequence. For each endpoint or bend of the tree two new points at distance √2δ are generated. When an edge is split (dashed segments) we add unit squares until no non-adjacent edges of the sequence have the same x- or y-coordinate. We ignore the points that lie on the boundary of another thickened path (grey squares).

We now replace each rectilinear tree containing bends and endpoints (one of them a variable, the others clause nodes) by a staircase sequence of points as follows (see Figure 5). We arbitrarily assign to each of the rectilinear trees in a unique number and replace it by a path that is the Minkowski sum of the tree and a square of side length . Each rectilinear tree becomes a set of thickened paths that form a rectilinear polygon. Note that at any internal node (or the root), one of the vertical or horizontal components will split into two parts. When this happens, we add unit squares to the polygon until no non-consecutive edges of the polygon have the same - or -coordinate, without changing the number of polygon vertices which is always possible. Furthermore, two endpoints of one thickened path will lie on the boundary of one of the other thickened paths. These two points can be ignored. We then walk along the boundary of the generated polygon, and number the vertices in clockwise order; let be the sequence of generated vertices.

###### Lemma 7.

The sequences of vertices generated as above form mutually independent staircase sequences, each of them containing points.

###### Proof.

With the above transformation, we get the following new coordinates for the vertices of a tree. Let be a node of the tree before both the scaling and the thickening, with integer coordinates. After the scaling with factor it has the coordinates . After the thickening with factor , the node transforms into a pair of vertices , that lie on a circle with radius centered at . Depending on whether is an endpoint (i.e., the root or a leaf) or a bend of the original tree, these two vertices either lie on a quadrant or on a diameter of . As all the numbers involved are integer, we get for each node of the tree a vertex pair with coordinates . Here, and are integers, is the thickening factor, is a factor describing the possible addition of unit squares to avoid having the same coordinates in non-adjacent edges, and . Therefore, two points can be covered by a unit rectangle if and only if they share one coordinate. This can only happen when both points are adjacent on the generated staircase sequence. ∎ Figure 6: Local transformation around clause cj (corresponding to point pj). Staircase before (light grey) and after (dark grey) moving points to avoid intersection with other staircase sequences.

By construction, the generated staircase sequences do not intersect, except at the clause variables. To remove these intersections, we modify the sequences locally around each clause node. Consider only a small neighborhood of clause , and assume that we have a segment of length connecting to from the left (see Figure 6). We add a point at the position of node to the staircase sequence.

Assuming that , we define (where is the thickness of the path) and move the three points located at , and to the new coordinates , and . When connecting from below, right, or above, we use appropriately rotated versions of the transformation described above.

Points and are called the links between clause and variable . The main property of the construction is that we can cover both link points and the point with a single rectangle of area one. It is easy to see that the new coordinates of the three moved points are rational and that the staircase sequences remain mutually independent. Figure 7: Local transformation for clause cj=ℓ1∨ℓ2∨ℓ3: using a negation gadget (inside the grey box) we can negate a literal in cj.

Finally, we need to show how to deal with clauses with all three literals either negated or not. This is important, as we cannot have three horizontal or vertical connections to the same clause node. Let be such a clause, then we can transform it into the following three clauses: . Here, is a literal of a new variable, and the two last clauses assure that has the opposite truth assignment of .

For each such clause, we additionally generate only one variable and two clauses, thus the asymptotical size of the transformation as well as its planarity are not affected (see Figure 7). This transformation needs only constant space, hence can be done independently for each literal. After transforming all such clauses we can proceed as before.

Let be the set of points of the staircase sequences generated by the transformation of a 3-SAT formula with variables and clauses. We have arrived at the following lemma.

###### Lemma 8.

A planar 3-SAT formula in variables is satisfiable if and only if the set of points generated as above can be covered with unit rectangles.

###### Proof.

() Given a unit covering of , we generate a variable assignment as follows: each variable is set to TRUE if its associated staircase sequence has a horizontal covering, FALSE otherwise. As any unit covering of is a unit covering of the mutually independent staircase sequences, this assignment is valid by Corollary 1.

We now show that this variable assignment satisfies all clauses; by construction, any rectangle that covers at least four points has area larger than one, thus no such rectangle can be in a unit covering. Since there are points in the construction and we want to cover them with rectangles, there must be exactly rectangles, each covering three points. No three points from a variable gadget can be covered with a unit rectangle, thus each of the rectangles must cover two variable points and the point corresponding to clause .

By construction of the clause node , such a covering is only possible if and any two links are covered by the same rectangle. Let be the variable with two links that are covered together with by one unit rectangle. If the literal of is not negated in , the links share the -coordinate. Since both links are covered by the same rectangle, the gadget of must be horizontally covered, which corresponds to setting variable to TRUE in our variable assignment. Since is set to TRUE and literal is not negated, clause is satisfied. The case with negated is analogous.

(): Given a variable assignment, we generate a corresponding covering for the gadget variables. Each clause is satisfied at least once, thus we can cover point together with the link points of the variable that satisfies with one unit rectangle. ∎

For the -Rectangle Covering problem we can give the following inapproximability result:

###### Lemma 9.

If the 3-SAT formula is not satisfiable, any covering of the staircase sequences with rectangles has at least one arbitrarily large rectangle.

###### Proof.

We scale the transformation by an arbitrarily large, constant factor before the local transformation in the neighborhood of the variables is done. If the 3-SAT formula is satisfiable, a unit covering is possible. However, consider any covering of a non-satisfiable 3-SAT instance: since the thick paths become arbitrarily thick, horizontal and vertical coverings are forced, and thus each covering still gives a valid variable assignment.

We must enlarge the rectangles such that they cover all clause points . Since the instance is non-satisfiable, for any variable assignment there exists a clause with vertically covered variables if the literal is not negated, and horizontally covered variables otherwise. The minimum area rectangle that includes and two points sharing a -coordinate (if the literal is not negated) includes the points and , and it has area , which is arbitrarily large. ∎

###### Theorem 2.

Given points in the plane, let be part of the input and be any fixed integer with . Then, the -Rectangle Covering problem is NP-hard. Moreover, the -Rectangle Covering problem admits no constant-factor polynomial time approximation algorithm.

## 4 Exact Algorithms for p≤3

In this section, we present algorithms to efficiently compute the solution for the -Box Covering problem for small values of . For simplicity, we assume throughout the following sections that no two points have the same - or -coordinate, and we assume furthermore in the description of our algorithms that we want to cover exactly points. An adaptation to cover at least points is straightforward. Note that for , we can always find an axis parallel line that separates one box from the others. We exploit this property for a divide-and-conquer type of approach.

### 4.1 Covering Points with Squares

We first want to cover points of with squares. With a simple observation, we can improve an existing algorithm for computing the optimal solution of the -Square Covering problem, which will function as our base case. Using certain monotonicity properties, we can apply binary search.

#### 4.1.1 (1,k)-Square Covering

Previously, an expected time algorithm for the -Square Covering problem was presented by Chan . We make use of Chan’s algorithm as a subroutine of our algorithms.

A point is called -extreme if either its - or -coordinate is among the smallest or largest in . Let be the set of all -extreme points of .

###### Lemma 10.

For a given set of points in the plane, we can compute the set of all -extreme points of in time.

We can use the standard selection algorithm  to select the point of with -st smallest -coordinate in linear time. We then go through again to find all points with -coordinate smaller than . Finding the points and computing the rest of is symmetric.

The following lemma shows that the left side of the optimal solution of the -Square Covering problem lies on or to the left of the vertical line through , and that the right side lies on or to the right of the vertical line through . Similarly, the top side of the optimal solution lies on or above the horizontal line through , and the bottom side lies on or below the horizontal line through .

###### Lemma 11.

The optimal square that solves the -Square Covering problem is determined by the points of only.

###### Proof.

The covering square is convex, hence all outliers must come from outside the optimal square. As we want to minimize the area, there exists an optimal square such that at least three edges of each contain one point of . If one edge, say the top edge, is determined by a point , it means that there are at least outliers above , which is not allowed. ∎

Using this lemma, we obtain an improved running time as follows:

###### Theorem 3.

Given a set of points in the plane, the -Square Covering problem can be solved in expected time using space.

###### Proof.

We first compute the set of extreme points in linear time and then run Chan’s algorithm on the set . The time bound follows directly, since . ∎

#### 4.1.2 (2,k)-Square Covering

The following observation is crucial to solve the -Square Covering problem, where we look for two disjoint squares that cover points.

###### Observation 1.

For any two disjoint axis-aligned squares in the plane, there exists an axis-parallel line that separates them.

This observation implies that there is always an axis-parallel line that separates the two optimal squares of the solution of a -Square Covering problem. Let be the halfplane defined by that contains . Let be the set of points of that lie in (including points on ), and let be the number of outliers admitted by the solution of the -Square Covering problem that lie in . Then there is always an optimal solution of the -Square Covering problem for with size smaller than or equal to that of . The same argument also holds for the other halfplane , where we have , and . Thus, the pair of optimal solutions of of the -Square Covering problem and of the -Square Covering problem is an optimal solution of the original -Square Covering problem. Figure 8: For given k′ and m, the optimal m∗ lies on the side with the larger square.
###### Lemma 12.

There exists an axis-parallel line and a positive integer such that an optimal solution of the -Square Covering problem for consists of the optimal solution of the -Square Covering problem for and the -Square Covering problem for .

We assume w.l.o.g. that is vertical, and we associate with , the number of points that lie to the left of (or on) . Let be the list of points in sorted by -coordinate. Then partitions the points of into two subsets, a left point set, and a right point set, , see Figure 8. The optimal left square is a solution of the -Square Covering problem for for , and the optimal right square is a solution of the -Square Covering problem for .

We can efficiently compute the optimal solutions for and in each halfplane of a vertical line using the above -Square Covering algorithm. However, as we have to consider many partitioning lines, it is important to find an efficient way to compute the -extreme points for each and corresponding to a particular line . For this we use Chazelle’s segment dragging query algorithm .

###### Lemma 13 ().

Given a set of points in the plane, we can preprocess it in time and space such that, for any axis–aligned orthogonal range query , we can find the point p of P that has the highest -coordinate of all points inside the query range in time.

We repeatedly apply Lemma 13 as follows: We start to query with a rectangle that has upper boundary at to find the topmost point. We then set the upper boundary of the rectangle to the -coordinate of the topmost point and query again with the new rectangle. Doing this times gives the points with highest -coordinate in any halfplane. We rotate the set to find all other elements of in the according half plane, and we get the following time bound.

###### Corollary 2.

After preprocessing time, we can compute the sets and in time for any given .

Before presenting our algorithm we need the following lemma:

###### Lemma 14.

For a fixed , the area of the solution of the -Square Covering problem for is an increasing function of .

###### Proof.

Consider the set and the optimal square of the -Square Covering problem for . Clearly, is a superset of , as it contains one more point . Since is fixed, the square has outliers in . If the interior of intersects the vertical line through , we translate horizontally to the left until it stops intersecting . Let be the translated copy of , then lies in the left halfplane of and there are at most outliers admitted by among the points in . Therefore we can shrink or translate and get a square inside the left halfplane of that has exactly outliers and a size at most that of . Thus, the optimal square for has a size smaller or equal to that of . ∎

Lemma 14 immediately implies the following corollary.

###### Corollary 3.

Let be the solution of the -Square Covering problem with separating line with index . Then, the index of the optimal separating line is at most if the left square is larger than the right square ; otherwise it holds that .

To solve the -Square Covering problem, we start with the vertical line at the median of the -coordinates of all points in . For a given , we first compute the sets and . Then we use these sets in the call to the -Square Covering problem for and the -Square Covering problem for , respectively, and solve the subproblems independently. The solutions of these subsets give the first candidate for the solution of the -Square Covering problem, and we now compare the areas of the two obtained squares. According to Corollary 3, we can discard one of the halfplanes created by (see Figure 8), hence, we can use binary search to find the optimal index for the given . As the value of that leads to the overall optimal solution is unknown, we need to do this for every possible . Finally, we also need to examine horizontal separating lines by reversing the roles of - and -coordinates.

###### Theorem 4.

For a set of points in the plane, we can solve the -Square Covering problem in expected time using space.

###### Proof.

After preprocessing time, we have different queries, each of which takes time, which gives a total running time of . We can show that this is equal to by distinguishing the following two cases:

If , then it holds for the second term that , so the second term is asymptotically smaller than the first, and we have .

If , then , so the second term is asymptotically bounded by , and altogether we have in this case . Hence, in both cases the asymptotic time bound is . ∎

#### 4.1.3 (3,k)-Square Covering

The above solution for the -Square Covering problem suggests a recursive approach for the general -Square Covering case: Find an axis-parallel line that separates one square from the others and recursively solve the induced subproblems. We can do this for , as Observation 1 can be generalized as follows.

###### Observation 2.

For any three pairwise-disjoint, axis-aligned squares in the plane, there always exists an axis-parallel line that separates one square from the others.

Again we assume that the separating line is vertical and that the left halfplane only contains one square. Since Corollary 3 can be generalized to -Square Covering, we solve this case as before: fix the amount of outliers permitted on the left halfplane to and iterate from to to obtain the optimal . For each possible , we recursively solve the two subproblems to the left and right of and use the solutions to obtain the optimal index such that the area of the largest square is minimized. Preprocessing consists of sorting the points of in both - and -coordinates and computing the segment dragging query structure, which can be done in time.

In the left halfplane, we solve the subproblem as before; its running time is subsumed by the time needed to solve the subproblem in the right halfplane. Each -Square Covering subproblem is solved as described above, except that preprocessing in the recursive steps is no longer needed: The segment dragging queries can be performed directly since the preprocessing has been done in the higher level. Also, for the binary search, we can use the sorted list of all points in , which is a superset of .

This algorithm has a total time complexity of (as before by distinguishing from ).

###### Theorem 5.

For a set of points in the plane, we can solve the -Square Covering problem in expected time using space.

### 4.2 Covering Points with Rectangles

We now look at the -Rectangle Covering problem, where we want to cover points with pairwise–disjoint rectangles. It is straightforward to extend Lemma 11 as well as Observations 1 and 2 to rectangles, so we can use the same approach to solve the -Rectangle Covering problem as for the -Square Covering problem when .

Chan’s algorithm , however, does not apply to the -Rectangle Covering problem, that means that once we have computed the set of -extreme points, we need to test all rectangles that cover points. Our approach is an exhaustive search: We store the points of separately in four sorted lists, the top points in , the bottom points in , and the left and right points in , and , respectively. Note that some points may belong to more than one set.

We first create a vertical slab by drawing two vertical lines through one point of and each. All points outside this slab are outliers, which leads to outliers that are still permitted inside the slab. We now choose two horizontal lines through points in and that lie inside the slab, such that the rectangle that is formed by all four lines admits exactly outliers. It is easy to see that whenever the top line is moved downwards, also the bottom line must move downwards, as we need to maintain the correct number of outliers throughout. Inside each of the vertical slabs, there are at most horizontal line pairs we need to examine, hence we can find the smallest rectangle covering points in time when the sorted lists of are given. This preprocessing takes time. We get the following theorem:

###### Theorem 6.

Given a set of points in the plane, we can solve the -Rectangle Covering problem in time using space.

Note that this approach leads to the same running time we would get by simply bootstrapping any other existing rectangle covering algorithm [1, 21] to the set , which has independently been done in . Note further that for the case of squares, it is possible to reduce the number of vertical slabs that need to be examined to only, which would lead to a total running time of .

The -Rectangle Covering problem for can be solved with the same recursive approach as the according -Square Covering problem, and by using the -Rectangle Covering algorithm described above as base case. The running times change as follows.

###### Theorem 7.

Given a set of points in the plane, we can solve the the -Rectangle Covering problem in time, and the -Rectangle Covering problem in time. In both cases we use space.

## 5 Concluding remarks Figure 9: Counterexamples. Left: In R2, no splitting line may exist for p≥4. Right: In R3, no splitting hyperplane may exist for p≥3.

In this paper we have extended the well examined axis-aligned box covering problem to allow at most outliers.

Our algorithms for can be generalized to other functions than minimum area (e.g., minimizing the maximum perimeter of the boxes) as long as this function has some monotonicity property that allows us to solve the subproblems induced by the boxes independently.

To solve the -Square Covering problems we use the randomized technique of Chan  as a subroutine, and thus our algorithms are randomized as well. Chan  mentioned that his algorithm can be derandomized adding a logarithmic factor. Thus, our algorithms can also be made deterministic, adding an factor to the second term of their running times, see the proof of our Theorem 4.

We can generalize all algorithms to higher dimensions where the partitioning line becomes a hyperplane. However, there is a simple example (see Figure 9, right), showing that neither the -Square Covering, nor the -Rectangle Covering problem admits a partitioning hyperplane for , hence our algorithm can only be used for in higher dimensions.

Our algorithms do not directly extend to the case , as Observation 1 does not hold for the general case, see Figure 9, left. Although no splitting line may exist, there always exists a quadrant separating a single box from the others. This property again makes it possible to use recursion to solve any -Square Covering or -Rectangle Covering problem.

A natural extension of our idea is to allow either arbitrarily oriented squares and rectangles or to allow them to overlap. Both appears to be difficult within our framework, as we make use of the set of -extreme points, which is hard to maintain under rotations; also we cannot restrict our attention to only these points when considering overlapping squares or rectangles.

Acknowledgements: We thank Otfried Cheong, Joachim Gudmundsson, Stefan Langerman, and Marc Pouget for fruitful discussions on early versions of this paper, and Jean Cardinal for indicating useful references.

## References

•  A. Aggarwal, H. Imai, N. Katoh, and S. Suri. Finding points with minimum diameter and related problems. J. Algorithms, 12:38–56, 1991.
•  H.-K. Ahn and S. W. Bae. Covering a point set by two disjoint rectangles. In Proc. 19th Int. Sypos. Alg. Comput. (ISAAC), pages 728–739, 2008.
•  R. Atanassov, P. Bose, M. Couture, A. Maheshwari, P. Morin, M. Paquette, M. Smid, and S. Wuhrer. Algorithms for optimal outlier removal. J. Discrete Alg., to appear.
•  S. Bespamyatnikh and M. Segal. Covering a set of points by two axis–parallel boxes. Inform. Proc. Lett., pages 95–100, 2000.
•  T. M. Chan. Geometric applications of a randomized optimization technique. Discrete Comput. Geom., 22(4):547–567, 1999.
•  T. M. Chan. Low-dimensional linear programming with violations. SIAM J. Comput., 34(4):879–893, 2005.
•  B. Chazelle. An algorithm for segment-dragging and its implementation. Algorithmica, 3:205–221, 1988.
•  B. Chazelle and J. Matoušek. On linear-time deterministic algorithms for optimization problems in fixed dimension. J. Algorithms, 21(3):579–597, 1996.
•  T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, Cambridge, MA, 2nd edition, 2001.
•  S. Das, P. P. Goswamib, and S. C. Nandy. Smallest k-point enclosing rectangle and square of arbitrary orientation. Inform. Process. Lett., 94(6):259–266, 2005.
•  M. Dyer, N. Megiddo, and E. Welzl. Linear programming. In J. E. Goodman and J. O’Rourke, editors, Handbook of discrete and computational geometry, pages 999–1014. CRC Press, 2nd edition, 2004.
•  R. J. Fowler, M. S. Paterson, and S. L. Tanimoto. Optimal packing and covering in the plane are NP-complete. Inform. Process. Lett., 12(3):133–137, 1981.
•  J. W. Jaromczyk and M. Kowaluk. Orientation independent covering of point sets in with pairs of rectangles or optimal squares. In Abstracts 12th European Workshop Comput. Geom., pages 77–84. Universität Münster, 1996.
•  M. J. Katz, K. Kedem, and M. Segal. Discrete rectilinear -center problems. Comput. Geom. Theory Appl., 15:203–214, 2000.
•  D. Lichtenstein. Planar formulae and their uses. SIAM J. Comput., 11(2):329–343, 1982.
•  J. Matoušek. On geometric optimization with few violated constraints. Discrete Comput. Geom., 14:365–384, 1995.
•  J. Matoušek and P. Škovroň. Three views of LP-type optimization problems. manuscript, 2003.
•  N. Megiddo and K. J. Supowit. On the complexity of some common geometric location problems. SIAM J. Comput., 13(1):182–196, 1984.
•  C. Saha and S. Das. Covering a set of points in a plane using two parallel rectangles. In ICCTA ’07: Proceedings of the International Conference on Computing: Theory and Applications, pages 214–218, 2007.
•  M. Segal. Lower bounds for covering problems. Journal of Mathematical Modelling and Algorithms, 1:17–29, 2002.
•  M. Segal and K. Kedem. Enclosing points in the smallest axis parallel rectangle. Inform. Process. Lett., 65:95–99, 1998.
•  M. Sharir and E. Welzl. A combinatorial bound for linear programming and related problems. In Proc. 9th Sympos. Theoret. Aspects Comput. Sci., volume 577 of LNCS, pages 569–579. Springer-Verlag, 1992.
•  M. Sharir and E. Welzl. Rectilinear and polygonal -piercing and -center problems. In Proc. 12th Annu. ACM Sympos. Comput. Geom., pages 122–132, 1996.
You are adding the first comment!
How to quickly get a good reply:
• Give credit where it’s due by listing out the positive aspects of a paper before getting into which changes should be made.
• Be specific in your critique, and provide supporting evidence with appropriate references to substantiate general statements.
• Your comment should inspire ideas to flow and help the author improves the paper.

The better we are at sharing our knowledge with each other, the faster we move forward.
The feedback must be of minimum 40 characters and the title a minimum of 5 characters   