Separating Colored Points with Minimum Number of Rectangles
Abstract
In this paper we study the following problem: Given disjoint sets of points, on the plane, find a minimum cardinality set of arbitrary rectangles such that each rectangle contains points of just one set but not the others. We prove the NP-hardness of this problem.
1 Introduction
Let be sets of disjoint points on the plain with . We say that a rectangle is -rectangle if contains points from and there is no point of , that lies on the .
The separation problem on with arbitrary rectangles can be defined as follows:
Definition ( Minimum Rectangular Separation (MRS):).
Given , find a minimum cardinality set of -rectangles such that every point in is contained in at least one rectangle of .
Bereg et. al. showed that the Boxes Class Cover problem, a version of MRS, where the rectangles are axis-aligned is NP-hard [1]. They also provide approximation algorithms for some special cases of the problem, for example when the rectangles are axis-aligned squares.
We show the MRS problem is NP-hard for . This implies that MRS is NP-hard for any . We call this version of the problem, MRS for , Arbitrary Boxes Class Cover problem (ABCC). As this can bee seen as a variant of BCC where rectangles can be in any direction.
Bereg et. al showed that BCC-problem is NP-hard by a reduction from the the Rectilinear Polygon Covering problem [1]. This reduction cannot be used to prove the NP-hardness of ABCC. Here we show the NP-hardness of ABCC by a reduction from newly defined version of the 3-SAT problem, the NAS-SAT problem.
1.1 Outline
In section 2, we define a new version of the 3-SAT problem (the NAS-SAT problem), and we prove this problems is NP-hard.
In Section 3, we prove the NP-hardness of BCC by a reduction from the NAS-SAT problem. Then we show how we can modify this and show the NP-hardness of ABCC-problem.
2 NAS-SAT
Not All the Same Satisfication problem (NAS-SAT problem):
We say that a boolean formula is in the form of NAS-CNF if it has the following properties:
-
1.
is in CNF form.
-
2.
All of its clauses has at most 3 literals.
-
3.
All the clauses with more than one literal have at least one literal in negated form and one literal in non-negated form.
-
4.
Any literal appears in at most one clause of size 3.
The satisfication problem on NAS-CNF formulas is called NAS-SAT.
Theorem 2.1.
NAS-SAT is NP-Complete.
Proof.
NAS-SAT is in NP, as for any given truth assignment the value of the formula cna be computed in polynomial time.
To show the NP-hardness of the problem, we reduce 3-SAT problem to NAS-SAT.
Suppose that an instance of 3-SAT is given. By the following transformations, we transform in polynomial time to which is an instance of NAS-SAT.
-
1.
For every clause in form of add the following clauses to :
-
2.
For every clause in form of add the following clauses to :
-
3.
Add other clauses to .
-
4.
For every variable in that is appeared in more than one clause of size three, we replace them by the following instruction:
Suppose that the variable is appeared in different clauses. Therefore we replace them with new variables . For preserving the equivalence of these variables, for every , we insert the following clauses:
is a CNF formula and every clause has at most 3 literals. By the first and second transformations, the third condition of the NAS-SAT problem is satisfied. By the last transformation, the forth condition is also satisfied. Thus, is an instance of NAS-SAT.
This transformation is done in polynomial time. Therefore, for every instance of the 3-SAT problem, we can construct an instance of NAS-SAT problem in polynomial time which the satisfibility of both of them are equivalent. 3-SAT is NP-hard [2]. Thus, the NAS-SAT problem is NP-complete.
∎
3 ABCC
In the rest of this paper, we assume that is the set of blue points, is the set of red points, and . Therefore in ABCC the goal is to cover all the blue points and no red point with minimum number of rectangles.
First we show BCC is NP-hard, then we modify the reduction for ABCC problem.
3.1 BCC
Suppose that we have an instance of the NAS-SAT problem, a boolean formula . For every variable, we add some points as shown in the figure 1. In the figures, circles indicate blue points, and stars indicate red points. We call the points added in this step, Variable Points.

In this structure, points from one variable with points from another variable cannot be covered with a same axis-aligned rectangle. For the points in figure 1, we have different optimal solutions in the BCC problem As in an optimal solution the variable points of each variable can be covered either with the two horizontal or the two vertical rectangles covering these points. We want to use this idea of having exponential possible solutions to reduce NAS-SAT to BCC.
For every clause, depending on the form of the clause we add different points. The position of these points are described below.
-
•
For every clause of size one in the form of , we add a blue point exactly in the middle of the segment that connects the two leftmost variable points of , and we add two red points as shown in the Figure 2. We call the points added in this step equivalent points for .
Figure 2: The equivalence points for -
•
For every clause of size in the form of , we add a blue point exactly in the middle of the segment that connects the two lower variable points of , and we add two red points on its sides as shown in the Figure 3. We call the points added in this step equivalent points for .
Figure 3: The equivalence points for -
•
For every clause of size two in the form of , we add a blue point in the intersection of a vertical line that connects the two leftmost variable points of and a horizontal line that connects the two lower variable points of . Then, we add four red points around it as shown in Figure 4. These points are called equivalence points for .
Figure 4: The equivalence points for -
•
For every clause of size three in the form of , we add two blue points as follows:
Assume the two vertical rectangles (strips) that cover variable points of and the two upper horizontal rectangles that cover the variable points of and . We add a blue point in the intersection region between the leftmost rectangle of and the upper horizontal rectangle of . We also add a point in the intersection region between the rightmost rectangle of and the upper horizontal rectangle of . The position of these points are shown in Figure 5. We call these points the clause points for .
Then, assume the region which is defined by the intersection of the upper rectangle of the red points which are between the upper rectangles of and , and the leftmost rectangle of the red points which are placed on the right side of the leftmost rectangle of . We add a blue point in the upper left corner and a red point in the lower right corner of this region. The position of these points are shown in Figure 5. We call these points the helping points.
Note that, a single blue-rectangle cannot cover the blue helping point and clause points together.
Figure 5: The clause points and helping points for -
•
For every clause of size 3 in the form of , We add points to the similar places described in the previous part, but with a rotation as shown Figure 6.
Figure 6: The clause points and helping points for
To convert any solution for BCC to a solution for NAS-SAT, for any variable , if the blue variable points of are covered by the vertical rectangles in the solution for BCC, then we assign to ‘true’ in the truth assignment for . If the blue variable points of are covered by the horizontal rectangles, then we assign to ‘false’ in the truth assignment for .
To convert any solution for NAS-SAT to a solution for BCC, for any variable , if is assigned to ‘true’ in , then we add two vertical rectangles to the solution for BCC to cover all the blue variable points for . If is assigned to ‘false’ in , then we add two horizontal rectangles to the solution for BCC to cover all the blue variable points for .
Lemma 3.1.
All the blue points can be covered by blue-rectangles if and only if is satisfiable, where is the number of variables and is number of clauses of size three in .
Proof.
For proving this claim, we have to prove following propositions:
-
1.
For covering all the blue points, at least blue-rectangles is needed.
-
2.
If the blue points are covered by exactly blue-rectangles in an optimal solution for BCC, then is satisfiable.
-
3.
If the blue points are covered by more than blue-rectangles in any optimal solution for BCC, then is not satisfiable.
Proof of 1. To cover all the blue points in this instance of BCC, we need at least two rectangles for each variable. This is because no blue-rectangle can cover the blue variable points of two different variables together. To any blue helping points we need at least one rectangle, as no blue-rectangle can cover two of these helping points or a blue helping point and a blue variable point. There are variables and helping points. Thus, covering all the blue points needs at least rectangles.
Proof of 2. By the previous part we know that rectangles are needed. If the blue points in BCC are all covered by rectangles, this means no extra rectangle was used to cover the clause points and equivalence points. This means the two vertical or horizontal rectangles for each variable are compatible with the form of the clauses, and when we convert this solution with rectangles to a truth assignment for all the clauses of are satisfied by this truth assignment.
Proof of 3. Assume is satisfiable, then we could convert this truth assignment for to a solution for BCC. This solution for BCC cannot have more than rectangles. This is because all the variable points are covered by either the two horizontal or the two vertical rectangles. All the blue clause points are covered as the clauses are satisfied by this assignment. All th equivalence points are covered, as or any equivalent clauses at least on of its literals is true in . This means the rectangles for the corresponding literal covers the blue point of that equivalence clause. Thus, only more rectangles are needed to cover all the blue points. This is a contradiction as we assumed that the any optimal solution for this instance of BCC needs more than rectangles.
∎
By Lemma 3.1 this transformation is a reduction, and the transformation is polynomial time. Thus BCC is NP-hard.
3.2 Hardness of ABCC
The idea of the reduction from NAS-SAT to ABCC is similar to the reduction from NAS-SAT to BCC. We add the same points described in the previous section for BCC, then we add more red points to the point set in a way that the rectangles in a solution for this instance of ABCC be all axis-aligned rectangles.
For every blue equivalence point, we add red points around it in any direction that there is a blue point in that direction.
For every blue variable point or blue clause point, we add a red point in the intersection between the line that connects it to another blue point and the nearest red strip but not in any blue strip. Note that such region always exists.
We add new red points in polynomial time. In this structure no arbitrary rectangle can cover two blue points that cannot be covered in the reduction from NAS-SAT to BCC. Thus, the size of the solution for this structure is equal to the size of the solution for BCC in the previous stucture. Therefore, ABCC problem is NP-hard.
References
- [1] S. Bereg, S. Cabello, J.M. Díaz-Báñez, P. Pérez-Lantero, C. Seara, I. Ventura. The class cover problem with boxes, Computational Geometry, Volume 45, Issue 7, August 2012, Pages 294-304, ISSN 0925-7721
- [2] R. M. Karp Reducibility Among Combinatorial Problems Proceedings of a symposium on the Complexity of Computer Computations, 1972 10.1007/978-1-4684-2001-2_9