Indian Institute of Technology Kharagpur, [email protected] Institute of Technology Kharagpur, [email protected] Indian Institute of Technology Kharagpur, [email protected] \CopyrightAnubhav Dhar, Subham Ghosh, Sudeshna Kolay \ccsdescTheory of computation Computational geometry \relatedversion \hideLIPIcs
Efficient Exact Algorithms for Minimum Covering of Orthogonal Polygons with Squares
Abstract
The Orthogonal Polygon Covering with Squares (OPCS) problem takes as input an orthogonal polygon without holes where vertices have integral coordinates i.e. a polygon without any holes, and with vertices and axis-parallel edges. Moreover, each vertex has integer-valued - and -coordinates. The aim is to find a minimum number of axis-parallel, possibly overlap** squares which lie completely inside , such that their union covers the entire region inside . Aupperle et. al [3] provide an -time algorithm to solve OPCS for orthogonal polygons without holes, where is the number of integral lattice points lying in the interior or on the boundary of . Moreover, designing algorithms for OPCS with a running time polynomial in (the number of vertices of ) was discussed as an open question in [3], since can be exponentially larger than . In this paper we design a polynomial-time exact algorithm for OPCS with a running time of .
We also consider the following structural parameterized version of the problem. A knob in an orthogonal polygon is a polygon edge whose both endpoints are convex polygon vertices. Given an input orthogonal polygon without holes that has vertices and knobs, we design an algorithm for OPCS with running time . This algorithm is more efficient than the above exact algorithm when .
In [3], the Orthogonal Polygon with Holes Covering with Squares (OPCSH) problem is also studied. Here, the input is an an orthogonal polygon which could have holes and the objective is to find a minimum square covering of the input polygon. This version where the orthogonal polygon is allowed to have holes is shown to be NP-complete (even when all lattice points in the interior or on the boundary of the polygon constitute the input). We think there is an error in the existing proof in [3], where a reduction from Planar 3-CNF is shown. We fix this error in the proof with an alternate construction of one of the gadgets used in the reduction, hence completing the proof of NP-completeness of OPCSH, when all lattice points in the interior or on the boundary of the polygon are given as input.
keywords:
Orthogonal polygon covering, Square covering, Exact algorithm, NP-hardnesscategory:
1 Introduction
We consider the problem of covering orthogonal polygons with a minimum number of (possibly overlap**) axis-parallel squares.
An orthogonal polygon is a simple polygon such that every polygon-edge is parallel to either the x-axis or the y-axis (Figure 1(a)). We wish to cover a given orthogonal polygon with a minimum number of (possibly overlap**) axis-parallel squares, i.e. given an orthogonal polygon we wish to find a minimum number of squares such that every square lies inside the region of and the union of the regions of the plane covered by these squares is the region of the plane covered by polygon itself (Figure 1(b) and Figure 1(c)).
In general, an orthogonal polygon may contain holes. However, for most of the paper, we deal with problems where the input is an orthogonal polygon without any holes. First, we define the problem of Orthogonal Polygon Covering with Squares (OPCS) formally as follows.
Orthogonal Polygon Covering with Squares (OPCS) Input: An orthogonal polygon where its vertices have integral coordinates and does not have any holes Question: Find the minimum number of axis-parallel squares contained in , such that is entirely covered by these squares
Note that for this problem, it is possible that the input polygon is given in terms of its vertices and their coordinates. Since the polygon is such that all vertices have integral coordinates, it is also possible that the input polygon is given in terms of its boundary vertices as well as all lattice points contained inside . Let this set of lattice points lying on the boundary of or inside be of size . Note that there could be an exponential factor difference between the values of and .
We also study a parameterized version of OPCS, called -OPCS. Before we define the problem, let us consider a knob as a structure occurring in an orthogonal polygon . A knob is an edge where both endpoints are convex vertices of (the formal definition of knobs is given in Section 2).
-Orthogonal Polygon Covering with Squares (-OPCS) Parameter: Input: An orthogonal polygon where its vertices have integral coordinates and does not have any holes, a non-negative integer such that has at most knobs Question: Find the minimum number of axis-parallel squares contained in , such that is entirely covered by these squares
The parameterized problem of -OPCS takes the number of knobs in the input orthogonal polygon to be a structural parameter, to be utilized when designing parameterized algorithms.
The final variant that we consider in this paper is the following variant of OPCS where the input orthogonal polygon is allowed to have holes.
Square Covering of Orthogonal Polygons with Holes (OPCSH) Input: An orthogonal polygon (possibly with holes) where all boundary vertices have integral coordinates Question: Find the minimum number of axis-parallel squares contained in , such that is entirely covered by these squares
Once again, the polygon could be described in terms of its boundary vertices, or in terms of the lattice vertices that lie on the boundary of or inside .
Previous Results.
The OPCS problem originates from image processing and further finds its application in VLSI mask generation, incremental update of raster displays, and image compression [9]. Moitra [9] considers the problem of a minimal covering of squares (i.e. no subset of the cover is also a cover) for covering a binary image pixels; and presents a parallel algorithm running on EREW PRAM which takes time with processors.
In [3], exact polynomial time solutions of OPCS are discussed, where the input is considered to be the set of all lattice points inside (in the interior and the boundary of) . The algorithms crucially use following associated graph .
Definition 1.1 (Associated graph ).
A unit square region inside an orthogonal polygon with corners on lattice points is called a block. An associated graph is constructed with the set of nodes as the set of blocks inside ; two blocks and are connected by an undirected edge if there is an axis parallel square lying inside that simultaneously covers and .
Clearly from the definition, we know that any set of blocks covered simultaneously by a single square shall form a clique. Further, [1] shows the converse as well.
Proposition 1.2.
A subset of blocks inside an orthogonal polygon can be covered by a square if and only if they induce a clique in .
In [3], is shown to be a chordal graph (please refer to Definition 2.13 for the definition of a chordal graph) if does not have holes. In [3] it is further shown that using the polynomial time algorithm for minimum clique covering in chordal graphs (discussed in [7]), OPCS can be solved in polynomial time. If the number of lattice points inside is , then the algorithm takes time. In [3], there is also references provided that would result in an algorithm with complexity to solve minimum clique cover in the associated chordal graph using more structural properties of the orthogonal polygon .
Aupperle et. al [3] also prove that OPCSH is NP-Hard if the input orthogonal polygon with possible holes is described in terms if the lattice points lying on the boundary of as well as inside . The paper reduces Planar 3-CNF [8] to this problem in order to prove its NP-Hardness.
Bar-Yehuda [4] describes an -factor approximation algorithm to solve this problem where is the number of vertices and OPT is the minimum number of squares to cover .
Culberson and Reckhow [6] proves that the problem of minimum covering of orthogonal polygons with rectangles is NP-hard. Kumar and Ramesh [2] provide a polynomial time approximation algorithm with approximation factor of for the problem of covering orthogonal polygons (with or without holes) with rectangles. Most of the other geometric minimum cover problems for orthogonal polygons are NP-complete as well [10].
Our Results.
In the results due to [3], the input size is considered to be the number of lattice points inside or lying on the boundary of . However, it is inefficient to represent orthogonal polygons with all the lattice points inside it. Rather, it would be more efficient to take an orthogonal polygon as a sequence of the boundary vertex points of (in either clockwise or counter-clockwise direction). In case has one or more holes, then this kind of input lists the sequence of vertices on the outer boundary, followed by the sequence of vertices on the boundary of each hole of .
As an example, if is itself a large square with vertices , , , , then even though it can be represented by just bits by simply listing down the vertices in order, we would need bits to actually represent all lattice points that lie inside or on the boundary of . Moreover, if OPT is the actual minimum number of squares to completely cover , can also potentially be exponential in the number of bits needed to represent the vertices (e.g. is a rectangle).
In this paper we consider the input size as the number of polygon vertices of and then design efficient algorithms for minimum square covering with respect to . Note that the algorithm in [3] becomes exponential now, as there can be exponentially many points inside . Designing algorithms which are polynomial in the number of polygon vertices was stated as an open question in [3]. To the best of our knowledge, this is the first study to answer these questions. This algorithm with a running time of , where is the number of vertices of the input polygon, and related structural results are given in Section 3 and Section 4. Moreover, our algorithm also works for polygons with rational coordinates as we can simply scale up the polygon by an appropriate denominator without changing the number of vertices .
In Section 5, we consider the -OPCS problem and further optimize the above algorithm, considering the polygon to have vertices and knobs (edges with both endpoints subtending to the interior of the polygon, formally defined in Definition 2.1). We design a recursive algorithm running in time . This algorithm is more efficient than the above exact algorithm if .
Finally in Section 6, we fix an error in the proof discussed in [3] of NP-completeness of minimum square covering of orthogonal polygons with holes. Note that such a result implies that we do not expect an algorithm for OPCSH that has a running time polynomial in the number of boundary vertices of the input orthogonal polygon which may have holes.
All other notations and definitions used in the paper can be found in Section 2.
2 Preliminaries
Orthogonal Polygons.
We denote by our input polygon with vertices. In the entire paper, we always consider the vertices of the polygon to have integral coordinates. Unless mentioned otherwise, the polygon is assumed to not have any holes. Let the vertices of in order be , where with and being integer coordinates. For convenience, we define and . Therefore is a polygon edge of for all . For any natural number , we denote the set by the notation . Next, let the minimum number of squares required to cover be denoted by . We use the terms left, right, top, bottom, vertical, horizontal to indicate greater x-coordinate, smaller x-coordinate, greater y-coordinate, smaller y-coordinate, parallel to y-axis, and parallel to x-axis, respectively. By boundary of a square (rectangle), we mean its four sides. A block lying on the boundary of a square is one which lies inside the square and where the boundary of the block overlaps with the boundary of the square. We assume that arithmetic and logic operations on two numbers take constant time. For any two points , on the plane, we denote the (Euclidean) length of the line segment joining and as .
Given an input polygon of OPCS, the minimum number of squares to cover remains the same, even if is scaled up by an integral factor and/or rotated (clockwise/counter-clockwise).
Let us formally define convex and concave vertices of an orthogonal polygon.
Definition 2.1 (Concave and Convex vertices of ).
A vertex of an orthogonal polygon is a convex vertex if subtends an angle of to the interior of . A vertex of is a concave vertex if it subtends an angle of to the interior of (Figure 2).
For the OPCS problem, we are only interested in maximal squares that are completely contained in the region of the input polygon.
Definition 2.2 (Valid Square).
An axis parallel square is called a valid covering square of of an orthogonal polygon or simply a valid square if is fully contained in the region of .
Definition 2.3 (Maximal Square).
A valid square is a maximal valid square or simply a maximal square, if no other valid square with a larger area contains entirely(Figure 3).
Note that for a given minimum square covering of an input orthogonal polygon , some squares may be maximal squares (Definition 2.2) while the other squares may be valid squares which are not maximal. However, for each such valid square which is not maximal, we can replace it with any maximal square containing (this exists as is not maximal and the interior of is a bounded region with finite area) to obtain another minimum square covering of . Since this process does not change the count of the squares used to cover and since the newly introduced squares cover the entire area of the removed squares, the new covering is a minimum covering with maximal squares. {observation} There exists a minimum square covering of any orthogonal polygon where every square of the covering is a maximal square.
The paper [3] defines a structure called knobs. We define knobs slightly differently but they essentially are the same.
Definition 2.4 (Knob).
A knob in an orthogonal polygon is an edge of such that and are both convex vertices of (Figure 4(a)). Suppose and share the same x coordinate. Then we say that they form a left knob if is a left boundary edge (i.e. all points just to the left of the edge are in the exterior of ), otherwise they form a right knob. Similarly, when and share the same y coordinate, then we say that they form a top knob if is a top boundary edge (i.e. all points just to the top of the edge are in the exterior of ), otherwise they form a bottom knob.
Next, we define a non-knob convex vertex.
Definition 2.5 (Non-Knob Convex Vertex).
Given an orthogonal polygon , a convex vertex is said to be a non-knob convex vertex if neither nor is a knob (i.e. both and are concave vertices).
We further introduce strips as follows.
Definition 2.6 (Strip).
A strip of an orthogonal polygon is a maximal axis-parallel non-square rectangular region lying inside such that each side in the longer set of parallel sides of is contained entirely in a polygon edge of (Figure 4(b)).
We make the following observation
Given an orthogonal polygon , for any pair of parallel polygon edges , , there can be at most one strip with its longer sides lying inside and respectively.
Efficient Representation of Squares.
We introduce the following notations to represent a sequence of squares placed side by side. We start by defining a rec-pack, which is a or rectangle lying inside the given orthogonal polygon , where .
Definition 2.7 (Rec-pack).
Given an orthogonal polygon , a rec-pack of is an axis parallel rectangle (of dimension or ) with integer aspect ratio (i.e. ratio of the lengths of the longer side to its shorter side) that lies completely inside (Figure 5(a)). We define the length of the shorter side of the rec-pack to be the width of and the aspect ratio to be the strength of .
Remark 2.8.
A valid square is a rec-pack of strength . We consider any square to be a trivial rec-pack.
For a rec-pack with width and strength , it can be covered with exactly many valid squares. We formally define this operation in the next definition.
Definition 2.9 (Extraction of rec-pack).
Given an orthogonal polygon and a rec-pack of width and strength in , we define the extraction of , to be the sequence of valid squares of size placed side by side to cover the entire region of (Figure 5(b)). Moreover, for a set of rec-packs , we define its extraction to be the union of the extraction of each rec-pack in .
Remark 2.10.
For a square (a trivial rec-pack), the extraction is a singleton set containing itself, i.e. . Moreover, for any set of squares, we have .
Note that any side-by-side placed sequence of many valid squares covers up a rec-pack of width and strength . Therefore, whenever there is a solution with a side-by-side placed sequence of congruent squares, we can keep track of the rec-pack which gives the set of these congruent squares upon extraction. But first, we need to define a covering using rec-packs.
Definition 2.11.
A set of rec-packs is said to cover the input orthogonal polygon if the set of squares in cover the polygon . Moreover, we say to be a minimum covering, if is a minimum cardinality set of squares covering and no two rec-packs have (i.e. produce some common square).
Remark 2.12.
For any set of squares covering , is also a set of rec-packs covering . Similarly, for any minimum cardinality set of squares covering , is also a set of rec-packs which is a minimum covering of . Finally, if a set of rec-packs is a covering (minimum covering) of , then the set of squares is a set of trivial rec-packs which is also a covering (minimum covering).
We also state the following observation.
A set of rec-packs covers an orthogonal polygon if and only if all the rec-packs in together form a set of rectangles covering .
Graph Theory.
Given a graph , we denote the vertex set by and the edge set by . The neighbourhood of a vertex is denoted by . The closed neighbourhood of is denoted by . Given a graph , a subgraph is an induced subgraph of if and contains all edges of such that both endpoints are in . In this case, we also say that the vertex set induces the subgraph . Recall the definition of chordal graphs and simplicial nodes [5].
Definition 2.13 (Chordal graphs and simplicial nodes).
A chordal graph is a simple graph in which every cycle of length at least four has a chord. A node is simplicial if induces a complete graph.
We get the following result directly from the definition.
Proposition 2.14.
Any induced subgraph of a chordal graph is also chordal.
We now state Dirac’s Lemma on chordal graphs [5].
Proposition 2.15 (Dirac’s Lemma).
Every chordal graph has a simplicial node. Morever, if a chordal graph is not a complete graph, it has at least two non-adjacent simplicial nodes.
We finally reiterate one of the major results of [3].
Proposition 2.16.
For a simple orthogonal polygon (without holes), the associated graph is chordal.
3 Structural and Geometric Results
In this section, we prove some structural and geometric results of a minimum square covering of an orthogonal polygon , as well as a set of rec-packs which is a minimum covering of .
3.1 Structure of Minimum Coverings
Due to Figure 3 we assume that we are looking for a minimum covering where every square is a maximal square. First, let us define how a maximal square can be obtained from a convex vertex of the given orthogonal polygon .
Definition 3.1.
Given an orthogonal polygon and a point , the following process is called growing of a square with one corner fixed at :
-
•
start with being the valid square covering (and has as one of its corners).
-
•
for in , from , which is a square with as one of its corners, construct to be a square by kee** one of its vertex fixed at and changing both the - and -coordinates of the diagonally opposite vertex in by to obtain the corresponding diagonally opposite vertex in . If is a valid square, set ; else terminate the process and set .
is said to be the square grown from the point .
We now discuss the following result.
Lemma 3.2.
Given an orthogonal polygon , the maximal square covering a convex vertex is unique. Further, for a given convex vertex , the unique maximal square can be found in .
Proof 3.3.
Given a convex vertex in an orthogonal polygon , let be the vertex grown from . As all other squares covering strictly lie inside , must be the unique maximal square covering .
Let denote the region defined by the interior of the angle between the rays formed by extending the two edges adjacent to (i.e. a quadrant). To find in time, we can iterate over all polygon edges , and check the following:
-
•
if lies entirely outside , it can never constrain the maximal square covering , so we continue to the next iteration
-
•
if some portion of lies inside , then find in , the largest square in , with one vertex at and the strict interior of the square does not contain any portion of . This can be done in , just by comparing the coordinates of , and .
Finally, the square with the minimum area is the unique maximal square covering , as all other edges allow larger (or equally large) squares.
We now define a maximal corner square of a vertex as follows.
Definition 3.4 (Maximal Corner Square of a vertex).
The Maximal Corner Square of a convex vertex , or is the unique maximal square covering .
Remark 3.5.
Note that any maximal square should be bounded by either two vertical polygon edges or two horizontal polygon edges.
Lemma 3.6.
If is a maximal square of an orthogonal polygon , then either both the vertical sides of overlap fully or partially with some polygon edges in or both the horizontal sides of overlap fully or partially with some polygon edges of .
Proof 3.7.
Assume the contrary. Suppose for some maximal square there is one horizontal edge and one vertical edge which does not overlap fully or partially with any polygon edges of . Further, we can assume that these are the top and the right edges of (we can rotate along with appropriately if this is not the case). Then we can further grow fixing its bottom-left corner, which contradicts that is a maximal square.
3.2 Simplicial Nodes in the Associated Graph and Partial Solutions
We define a partial solution for OPCS to be a subset of a set of rec-packs which is a minimum covering of .
Definition 3.8 (Partial Solution).
Given an orthogonal polygon , a set of rec-packs is a partial solution for OPCS if there is a minimum covering set of rec-packs with .
Now consider a partial solution . We define as follows.
Definition 3.9.
Let denote the induced subgraph of the associated graph consisting of nodes which correspond to blocks in which are not covered by any rec-pack in .
From Proposition 2.16 and Proposition 2.14, we get that is chordal, and from Proposition 2.15 we get that has a simplicial node if is non-empty. Let denote the union of the block and its neighbouring blocks in . By Definition 2.13, induces a clique in and hence in . Therefore, by Proposition 1.2, there exists a maximal square that covers all blocks in . Next, we define unambiguous squares given a partial solution .
Definition 3.10 (Unambiguous squares given a partial solution).
Let be a partial solution for OPCS in an orthogonal polygon . We call a maximal square to be an unambiguous square given , if there is simplicial node in such that covers and all its neighbours in .
Remark 3.11.
For a given simplicial node in , there can be multiple maximal squares that cover and all its neighbours in .
We now justify the naming of unambiguous squares.
Lemma 3.12.
If is a partial solution for OPCS in an orthogonal polygon and is an unambiguous square given , then is also a partial solution.
Proof 3.13.
Let be a simplicial node in such that covers and its neighbours in . Since is a partial solution, there exists a minimum cover covering with . This implies from Definition 2.9. Let be a maximal square covering . We have as is in . This implies that . However, since covers an induced clique of including (Proposition 1.2) and possibly some blocks already covered by squares in , this means that covers and a subset of its neighbours in along with some blocks already covered by squares in . On the other hand, recall that covers and all its neighbours in . This means covers a subset of points covered by . This means is also a minimum cardinality set of squares covering the entire polygon . Let .
We rewrite , where . Consider to be a set of rec-packs (where and are considered to be sets of trivial rec-packs). Since is a minimum cardinality set of squares covering , is a minimum covering. Moreover, as , is a partial solution. Hence, we are done.
Now, we prove that we can always find an unambiguous square which follows a particular structure.
Lemma 3.14.
Let be a partial solution of OPCS in an orthogonal polygon such that does not completely cover . We define and as a set of lattice points as follows.
Then there exists an unambiguous square given which has one corner in .
Proof 3.15.
Let be a simplicial node in with the largest number of neighbours, and such that among the topmost such simplicial nodes it is the leftmost. Let denote the following set of nodes (blocks in ): and its neighbours in . Let be a maximal square that covers all blocks in , such that the position of the top-left corner of is leftmost among the topmost of all such squares covering . By Lemma 3.6, we know that either the horizontal sides of overlaps (completely or partially) with two horizontal polygon edges, or the vertical sides of overlaps (completely or partially) with two vertical polygon edges.
Assume that the horizontal sides of overlaps (completely or partially) with two horizontal polygon edges. We consider two cases.
Case-I: is a square.
Since is a simplicial node with the largest number of neighbours in , all simplicial nodes (in fact all nodes) in must be isolated. Further, is the leftmost among the topmost such simplicial nodes. This means that the immediate left block of is either covered by a rec-pack in or is outside the polygon. Therefore, the left side of is either a polygon edge (if is in the polygon but is not) or a vertical side of some rec-pack in (if is uncovered, but is covered), respectively. Therefore, the top-left corner of must share the x-coordinate of either a corner of a rec-pack in or a polygon vertex. Further, the top-left corner of shares a y-coordinate of a polygon vertex as the horizontal sides (top and bottom) of overlap with polygon edges. This means that the top-left vertex of is in
Case-II: is not a square.
We already know that the horizontal sides (top and bottom) of overlap with polygon edges. If the left (or right) side of shares x-coordinate of some polygon edge or a corner of some rec-pack in , then the top-left (or top-right) corner of is in ; and then we are done.
Now, we assume the contrary. Suppose neither the left or right sides of share an x-coordinate with a polygon edge or a corner of some rec-pack in . In particular, if and are squares congruent to but are shifted one unit to the left and right respectively, then and are maximal valid squares (Figure 6(a)). They are valid as the left and right sides of do not overlap with any polygon edge. They are also maximal as the same polygon edges overlap** horizontal sides of also overlap the horizontal sides of and (this would not be the case if the horizontal polygon edges only overlap horizontal sides of at just a point — i.e. a corner of overlaps with a vertex of ; but then the vertical side of that corner of would share the x-coordinate of the vertex of , contradicting our assumption). We further consider three more subcases.
-
•
Case II(a): All blocks in along its right boundary are also covered by some rec-pack in . This case is impossible as covers the same set of uncovered blocks but has a top-left corner which lies even to the left of contradicting the definition of .
-
•
Case II(b): All blocks in along its left boundary are also covered by some rec-pack in . We keep moving horizontally to the right till one of the following happens:
-
–
(i) it is obstructed by a polygon edge to its right (then the right side would share x-coordinate of a polygon edge)
-
–
(ii) moving it any further uncovers some previously covered portion (then the left side would be overlap** with the right side of some rec-pack in , hence sharing the x-coordinate of a corner of some rec-pack in )
-
–
(iii) it is about to be no longer overlap** with the horizontal polygon edges of which overlapped horizontal sides of (then there would be a corner of the square that overlaps with the endpoint of the horizontal polygon edge which was about to lose overlap and hence they share the x-coordinate)
Since the horizontal sides (top and bottom) of overlap with polygon edges, in each of the above cases there is a corner of the newly moved square which lies in .
(a) Construction of given (b) Blocks given and rec-packs in Figure 6: Cases in proof of Lemma 3.14 -
–
-
•
Case II(c): There is a block in along its left boundary and a block in along its right that are both not covered by any rec-pack in (Figure 6(b)). Let be the block immediately to the left of and be the block immediately to the right of . The blocks and must be uncovered blocks lying inside (as we assumed the vertical sides of to not overlap with the vertical sides of any rec-pack in or any vertical polygon edges). Clearly covers and covers . However if is not on the left boundary of , then is covered by (which also covers ). This implies that and are adjacent in . Otherwise, if is on the left boundary of , cannot be on the right boundary of (as is not a unit square). This implies that is covered by (which also covers ) and this means that and are adjacent in . Therefore in either case there is some node which is not covered by but adjacent to in . This contradicts the definition of and therefore such a case does not arise.
This completes the proof that there is a maximal square with one corner in which covers and all its neighbours in (hence an unambiguous square given ), provided that horizontal sides of overlap with some horizontal polygon edges. Moreover, if vertical sides of overlap with vertical polygon edges, then a similar argument implies the existence of an unambiguous square which has a corner in . This completes the proof.
We now state another result which helps us detect unambiguous squares later on.
Lemma 3.16.
Given an orthogonal polygon , let be a partial solution of OPCS where does not completely cover . Let be any valid square. We define and as a set of lattice points as follows.
Let be a node in where and has a neighbour in . Then there is a neighbour of such that are covered by a maximal square having a corner in .
In other words, and are - and - coordinates appearing in , or as well as the coordinates which differ by at most from coordinate values in the above set and intersect with and coordinates of the polygon vertices.
Proof 3.17.
We observe that all the blocks in the axis-parallel rectangle with and lying on opposite corners lie inside and are also adjacent to in (any square covering and also covers these blocks). Consider we have a token on and we move the token to the block immediately below/above it, whichever decreases the difference of the x-coordinate with , if the block is not covered by any rec-pack in . If this is not possible or if the difference of -coordinates is already , we move the token to the block immediately to the left/right of it, whichever decreases the difference of the y-coordinate with , if the block is not covered by any rec-pack in . We continue to execute these moves till (i) the difference in -coordinates is and a move to reduce the difference in the -coordinates is not possible because of a covered block, (ii) the difference in -coordinates is and a move to reduce the difference in the -coordinates is not possible because of a covered block, or (iii) a move to reduce the difference in the -coordinates is not possible because of a covered block and a move to reduce the difference in the -coordinates is not possible because of a covered block. Note that the token stays in the axis-parallel rectangle with and lying on opposite corners. Let be the block where the token finally ends up, then must be a node in ; and must be adjacent to in . We consider the following cases.
Case I: and differ in both - and -coordinates (Figure 7(a)).
Without loss of generality, we assume has a larger -coordinate and a larger -coordinate than . Let be a maximal square covering both and . Assume that (Lemma 3.6) has horizontal sides overlap** with horizontal polygon edges (a similar argument can be made for a vertical overlap). We keep moving to the left until:
-
•
(i) it gets obstructed by a polygon edge to its left
-
•
(ii) overlaps with some horizontal polygon edge at just a point
-
•
(iii) is on the right boundary of the square
Let this new square be . In the first two sub-cases, a horizontal side of overlaps with some polygon edge (possibly at just a point). In the third case, since the process stopped with the token on , both blocks immediately to the left and the bottom of are covered by some rec-pack in , and hence has its right side one unit to the right of a vertical side of some edge of rec-pack in (the square that covers the immediate left block of but not ). Therefore in all cases, has a vertical side with x-coordinate which is either the same of that of a polygon vertex or differs by at most with x-coordinate of a corner of some rec-pack in . Moreover, as has its horizontal sides overlap** with polygon edges, has at least one corner in , such that contains both and .
Case II: and have the same -coordinate.
Without loss of generality, let have a larger -coordinate than . Let be a maximal square covering both and . If has its horizontal sides overlap** with polygon edges, we have an identical argument as before to prove that there is another maximal square that covers and with a corner in . Therefore, we only consider the case when has vertical sides that overlap with polygon edges (Figure 7(b)). Now, we move to the top until:
-
•
it gets obstructed by a polygon edge to its top
-
•
overlaps with some vertical polygon edge at just a point
-
•
(and hence ) is on the bottom boundary of the square
Let the square obtained be . In the first two cases, has a vertical edge overlap** with some vertical polygon edge (hence would have a corner in , proving what we want). Therefore we only consider the third case: are on the bottom boundary of . We similarly construct by moving to the bottom until either it gets obstructed by (i) a polygon edge to its bottom, (ii) overlaps with some vertical polygon edge at just a point, or (iii) (and hence ) is on the top boundary of the . Again as the first two of these cases already achieve having a corner in , we consider the third case: are on the top boundary of . We observe that the bottom side of lies above or on the bottom side of (as are on the bottom boundary of ), and similarly the top side of lies below or on the top side of . Again if has its bottom side lying on the bottom side of , would have a corner in and we would be done; hence we consider that has its bottom side lying above the bottom side of (and has its top side lying below the top side of ). Further, the top side of must lie above or on the top side of (otherwise both the top side and the bottom edge of lie between the top side and bottom side of ; but covers which lies to the right of the right side of ; which means has its left side lying completely in the interior of , contradicting that has vertical sides overlap** with polygon edges). However, this means if we were to vertically move a square initially positioned as (top side of above or on top side of ) to (top side of below top side of ), there would be a square with its top side lying on the top side of which contains and . Moreover, as has its vertical sides overlap** with polygon edges (same polygon edges which were overlap** with the vertical sides of , and ), has a corner in .
Case II: and have the same -coordinate.
An argument similar to the previous argument works.
This completes the proof.
3.3 Placing Rec-packs given a Partial Solution
We start with a result regarding placement of maximal squares to extend partial solutions.
Lemma 3.18.
Let be a maximal square of an orthogonal polygon with side length such that
-
•
The top and bottom edges of overlaps with horizontal polygon edges and respectively.
-
•
contains the top right corner of and the distance between the top right corner of and the right endpoint is more than .
-
•
contains the bottom right corner of and the distance between the bottom right corner of and the right endpoint of is more than .
-
•
There is a strip between , and the right side of the strip is more than distance away from the right side of .
Let be the square generated by reflecting with respect to its right edge. Then, if there is a set of rec-packs which is a partial solution of OPCS with and if does not overlap with any rec-pack in , then is also a partial solution.
Proof 3.19.
Clearly is a valid square as it is bounded by the region in the polygon in between and . Let be strip the between and .
Let be the block inside which is located at the top-left corner of . Since is in the strip defined by the region between and , any valid square covering must have side length at most . Therefore, must completely lie inside the union of the regions covered by and .
Let be a minimum cover of with . Let . Therefore is also a minimum covering (as ). Since does not overlap with any rec-pack in , there must be a square which covers (top-left block of ). However, covers a superset of the area that covers (as has side length at most ). Therefore, we can remove and add to (giving us ) and this will still be a minimum cover. As , is a partial solution.
Remark 3.20.
This result symmetrically holds true for all four directions.
We can easily extend this result to placing a rec-pack to the right of the given square .
Lemma 3.21.
Let be a maximal square of an orthogonal polygon with side length such that, for some natural number ,
-
•
The top and bottom edges of overlaps with horizontal polygon edges and respectively.
-
•
contains the top right corner of and the distance between the top right corner of and the right endpoint is more than .
-
•
contains the bottom right corner of and the distance between the bottom right corner of and the right endpoint of is more than .
-
•
There is a strip between , and the right side of the strip is more than distance away from the right side of .
Let be the rec-pack of width and strength , such that the the vertical sides of are of length and the right side of the square coincides with the left side of . Then, if there is a partial solution of OPCS, where and does not overlap with any rec-pack in , then is also a partial solution.
Proof 3.22.
We observe that lies completely inside the strip in between and . Further, we generate squares of the same size as as follows: is the square generated by reflecting by its right side, is the square generated by reflecting by its right side, and for any , is the square generated by reflecting by its right side. Therefore, is the square generated by reflecting by its right side. Then clearly, covers the exact area covered by . Precisely, we have . Moreover, as does not overlap with any rec-pack in , none of overlaps with any rec-pack in . This setting now allows us to use Lemma 3.18 repeatedly.
Since , by Lemma 3.18, is a partial solution. Again, as , by Lemma 3.18, is a partial solution. Continuing, for any , as is a partial solution, by Lemma 3.21 is a partial solution. In particular, is a partial solution. This means is also a partial solution.
Remark 3.23.
Again, this result symmetrically holds true for all four directions.
We will use Lemma 3.21 in the subsequent section to efficiently obtain a large number of squares which are also a part of a partial solution.
4 Polynomial Time Algorithm for OPCS w.r.t the Number of Polygonal Vertices
In this Section, we design an algorithm for OPCS such that the input polygon is taken in terms of its vertices. The algorithm runs in time. We first start with some subroutines which we use for our algorithm, followed by the algorithm itself. Finally, we give the running time analysis for the algorithm.
4.1 Checking if a Set of Rec-Packs covers the Input Orthogonal Polygon
We design an algorithm that checks whether a given set of rec-packs completely covers an orthogonal polygon .
Lemma 4.1.
Given an orthogonal polygon and a set of rec-packs, where , there is an algorithm that checks if (equivalently ) completely covers . The algorithm runs in time.
Proof 4.2.
Clearly, if does not completely cover the entire interior of , the uncovered interior of will be a collection of one or more orthogonal polygons themselves. Further the edges of these polygons must be either an edge of or an edge of some rec-pack in . Therefore the vertices must be intersections of two such edges (either of or of some rec-pack in ). Moreover, the number of such intersections is upper-bounded by . Therefore we check for each such intersection , if all four blocks with as a corner are covered by some rec-pack in , then we are done.
Thus, the following algorithm answers whether completely covers the orthogonal polygon in time.
4.2 Detecting Unambiguous Squares
We now discuss an algorithm that takes in a square , a partial solution for OPCS and the input orthogonal polygon and decides if is an unambiguous square given . We crucially use Lemma 3.16 for the correctness of the algorithm.
Lemma 4.3.
Given an orthogonal polygon , a partial solution for OPCS and valid square , there is an algorithm that checks if is an unambiguous square given in time.
Proof 4.4.
We start by constructing the sets and as in Lemma 3.16. By definition, . Definition 3.10 implies that is an unambiguous square given if and only if there is a simplicial node in such that covers and all its neighbours in . From Lemma 3.16, this is not the case if and only if all maximal squares with a corner in which cover some block not covered by , together cover up the entire region inside not covered by . In other words, all blocks in not covered by have an adjacent block in and therefore cannot be a simplicial node in with covering all its neighbours in . Let be the set of maximal squares with a corner in that cover some node in which is not covered by (i.e. we do not consider those maximal squares which lie completely outside the region covered by ). By construction, .
There is some block in , which is not covered by any rec-pack in , if and only if is a simplicial node in with covering and all its neighbours, i.e. is an unambiguous square given (Lemma 3.16). However, we cannot check for simpliciality in all blocks in , as this can potentially be exponential. Nevertheless, let us draw the infinite horizontal and vertical lines from all corners of rec-packs of and from the vertices of . This would form a grid like structure with rectangular regions. Clearly, any two blocks in the same rectangular region would be covered by the same subset of rec-packs in . Therefore it would be sufficient to check for simpliciality in a single block in each rectangular region (we check all the corner blocks of the rectangular regions i.e. blocks having a corner which shares an x coordinate of a vertex in or a corner in as well as the y coordinate). Given the description above, checking for simpliciality will take time.
Therefore, given the following algorithm answers whether is an unambiguous square in time.
4.3 Generating Rec-Packs within a Strip
We wish to use Lemma 3.21 to extend an existing partial solution by adding a rec-pack. In order to do this, we need to construct rec-packs within a strip (between , , Lemma 3.21) which shares its shorter side (perpendicular to and ) with the side of a given square (we call this the ‘seed’). We discuss the following algorithm to construct rec-packs for the setting in Lemma 3.21.
Lemma 4.5.
Given a maximal square (referred to as the ‘seed’) of an orthogonal polygon with side length , there is an algorithm to test if there are horizontal polygon edges and some natural number , such that
-
•
The top and bottom edges of overlaps with horizontal polygon edges and respectively.
-
•
contains the top right corner of and the distance between the top right corner of and the right endpoint is more than .
-
•
contains the bottom right corner of and the distance between the bottom right corner of and the right endpoint of is more than .
-
•
There is a strip between , and the right side of the strip is more than distance away from the right side of .
Moreover, if this exists, the algorithm finds the largest possible and if the algorithm returns the rec-pack of width and strength , such that the vertical sides of are of length and the right side of the square coincides with the left side of . The algorithm runs in total time.
Note that this can be done for all four directions. Therefore, henceforth if we need to apply a similar algorithm in a different direction, we shall still refer to this Lemma.
This essentially tests if Lemma 3.21 can be applied to the setting or not; if yes, this also outputs the rec-pack with the second largest strength for which the setting applies.
Proof 4.6.
Consider the following algorithm.
This algorithm first checks for the existence of polygonal edges and ( loop on all polygon-edge) and further checks if and have right end points lying farther than distance for at least (the minimum value). If any of these do not happen, no such exists and the algorithm outputs ‘NOT-APPLICABLE’.
Moreover, if it is applicable, it finds the largest value of such that have both of their right endpoints more than distance away from the right side of . Finally, the algorithm returns the rec-pack of strength as needed if or returns ‘SHORT-STRIP’ if .
The entire algorithm runs in linear time and can be extended to all directions.
The rec-packs generated in Algorithm 3 leaves at least distance and at most distance from the right side of the strip contained in , and can not intersect with any valid square that covers some region outside the strip containing .
The idea for generating with strength (or returning ‘SHORT-STRIP’ if ) is to ensure that does not intersect with any square that partially lies outside the strip in between and . Moreover, if we get ‘SHORT-STRIP’ as an output, we know that there is no efficient rec-pack representation necessary as the number of squares needed to cover any such region with is at most .
While using this as a subroutine for our final algorithm discussed later, we need to check that given a partial solution with acting as a seed, if the generated rec-pack intersects with any rec-pack in . If there is no intersection, we can say that is also a partial solution.
4.4 Polynomial Time Algorithm: Building up Partial Solutions
Finally, we are ready to state the polynomial time algorithm for OPCS when the input polygon is in terms of its vertices. We use the following framework: Start with an empty partial solution, keep extending the partial solution either by adding unambiguous squares (Lemma 3.12) or by adding rec-packs generated by a seed square (Algorithm 3 and Lemma 3.21). We stop this whenever we have a set of rec-packs which completely covers the polygon (detected using Algorithm 1). This will be guaranteed to be a minimum cover, because throughout the algorithm the set of rec-packs is guaranteed to be a partial solution by Lemma 3.12 and Lemma 3.21.
To find unambiguous squares given a partial solution of OPCS, we generate all possible maximal squares having end points in as defined in Lemma 3.14. We are guaranteed to get an unambiguous square given (due to Lemma 3.14). Next, we test for all such generated squares if it is unambiguous using Algorithm 2.
Formally, the algorithm is as follows.
First, as the generated rec-packs are only added to if they do not intersect with any rec-pack in , we make the following observation.
The only non-trivial rec-packs in are the ones generated by a seed, and no two non-trivial rec-packs in intersect with each other.
From the discussion above, we obtain the following statement.
Lemma 4.7.
Algorithm 1 (Extend-Partial-Solution) terminates in finite time and outputs the minimum number of squares to cover .
Proof 4.8.
Termination. Each iteration of the while loop takes finite time and every other step outside the while loop takes finite time as well. Moreover, the number of while loop iterations is also finite as at each step, as in each step the algorithm is guaranteed to find an unambiguous square (Lemma 3.14) and therefore the size of the partial solution increases at least by one. Further, this unambiguous square added covers at least one currently uncovered block of the polygon, thereby decreasing in the current step the area of the uncovered region of the polygon at least by . Since has a finite area, the number of while loop iterations is finite, and hence Algorithm 4 terminates in finite time.
Minimum Covering. By Lemma 3.12 and Lemma 3.21, is always a partial solution, and therefore if covers completely, it has to be a minimum cover. This means is a minimum cover. Therefore, we have,
which completes the proof.
Our next step is to bound the time for each iteration of the while loop.
Lemma 4.9.
Each iteration of the while loop of Algorithm 4 runs in time.
Proof 4.10.
We analyse the time taken at each step.
-
•
Checking the condition of the while loop takes time, which is clearly bounded by .
-
•
Generating , and checking for all possible squares in if they are ambiguous takes time as
-
•
Generating rec-packs with the seed and the respective checks are only done four times per while loop iteration, and therefore they take up a total overhead of .
Hence, each iteration of the while loop in Algorithm 4 takes time.
We now bound the total time in terms of the size of final set of rec-packs .
Lemma 4.11.
If the final set of rec-packs from Algorithm 4 is , then the running time is .
Proof 4.12.
By Lemma 4.9, we know that each while loop iteration takes at most time. As the size of increases at least by one at each iteration, the number of while loop iterations must be bounded by , the size of the final rec-pack minimum cover. Therefore, the total time for all while loop iterations is . As there is only a total overhead of outside the while loop, the total running time of Algorithm 4 becomes .
Remark 4.13.
If we only extended our partial solutions by unambiguous squares (and not generate rec-packs from a seed), we would finally have a set of trivial rec-packs (squares) which is a minimum cover of with OPCS . This would give us an output sensitive algorithm of
We now proceed to bound the size of the final set of rec-packs in Algorithm 4.
Lemma 4.14.
If be the final set of rec-packs in Algorithm 4, then
Proof 4.15.
Let be the set of rec-packs generated from a seed, and let be the set of unambiguous squares appearing as trivial rec-packs in . Therefore, .
Claim 1.
For any set of squares such that covers , we must have .
Proof 4.16.
Since is a minimum cover (Lemma 4.7), is a minimum cardinality set of squares covering . Therefore, for any set of squares that covers , we must have . In particular, for any set of squares such that covers , we must have . This means that (as and are disjoint).
We now construct such a set of squares of size . Let us draw a vertical line and a horizontal line through each vertex of . Let us call them vertex induced lines of . As has vertices, there are at most vertex induced vertical lines and vertex induced horizontal lines.
These vertex induced lines form a grid like structure resulting in rectangular grid cells formed between two consecutive vertex induced vertical lines and two consecutive vertex induced horizontal lines. Let be a such a rectangular grid cell formed by consecutive vertex induced vertical & horizontal lines, that lies in the interior (possibly overlap** with some of the polygon edges of ), as shown in Figure 8. Let be the top-left corner, be the top-right corner, be the bottom-right corner and be the bottom left corner. Without loss of generality, let the rectangle have its vertical sides no longer than the horizontal sides (i.e. length is along the -axis). We now present a method to cover the entire rectangular region (possibly covering some more portion of the interior of the polygon) with at most more valid squares (if we consider to be already placed).
Consider the two consecutive vertex induced vertical lines , one passing through and the other passing through . There cannot be any vertex of lying strictly between these two lines (otherwise, these would not be adjacent vertex induced lines). As lies inside , the following must hold (Figure 9(a)):
-
•
There must be a horizontal polygon edge of that intersects both and (possibly at its endpoint), and that either overlaps with the line segment or lies above .
-
•
There must be a horizontal polygon edge of that intersects both and (possibly at its endpoint), and that either overlaps with the line segment or lies under .
-
•
The rectangular region enclosed by , , , entirely lies inside the polygon .
Let denote the vertical distance between and . Further, if is the length of an edge , then (, intersect both , ). We now discuss the following cases.
-
•
Case I: . In this case, we can draw at most three squares which cover the entire rectangular region enclosed by , , , and hence covers (Figure 9(b)). Therefore can be covered by at most squares.
-
•
Case II: . In this case, there must be a (unique) strip that is enclosed within , (Section 2). must have an aspect ratio of more than . Let be the first square placed that covers some portion in when Algorithm 4 is run on (there would always be a square placed in as no square with smaller dimension can generate a rec-pack as a seed that overlaps with , and all maximal squares covering any block which is at a distance of more than from the left & right boundary of , have dimension ). Let be the left most square lying inside and be the square obtained by reflecting about its right side. Similarly, let be the right most square lying inside and be the square obtained by reflecting about its left side (Figure 10). Since the aspect ratio of is more than , ,,, are pairwise non-overlap** squares that inside Y. Moreover since is a strip with as the length of the shorter side, there cannot be a valid square that covers some region outside as well as some region inside which is not covered by ,. Consider the portion of lying to the left hand side of . Either is entirely covered by and , or the horizontal distance between the left side of and the left side of is more than . Even if the second case occurs, then Algorithm 1 must generate as the rec-pack lying to the left of the seed which intersects with (as is the first square placed in the strip and hence generates a rec-pack with the left side at most distance from the left side of , and hence cannot intersect with any square or re-pack in the partial solution found before was added, Section 4.3). This means is entirely covered by , and possibly some rec-pack in . Similarly, the portion of to the right of is entirely covered by , and possibly some rec-pack in . Therefore the entire region of (and hence ) is covered by and more squares, .
If we repeat the same process for each rectangular region formed by consecutive vertex induced lines, then we can cover up the entire polygon using just more squares for each such rectangular region lying inside (along with the rec-packs in ). However, the total number of such rectangular region is . Therefore, if is the set of all such squares (at most of them per rectangular region ), then and is a set of squares covering the entire polygon . As discussed in 1, we have .
Moreover, as for each unambiguous square , Algorithm 4 adds at most four rec-packs with seed , the number of rec-packs generated from a seed can be at most times the number of unambiguous squares. Therefore .
Hence, .
This allows us to derive the algorithmic running time purely in terms of .
Theorem 4.17.
For an orthogonal polygon with vertices, Algorithm 4 outputs in time.
Proof 4.18.
The correctness of the algorithm is due to Lemma 4.7. For the analysis of the running time of Algorithm 4, we substitute the bound of obtained in Lemma 4.14 in the time complexity of Lemma 4.11. Therefore,
Running time of Algorithm 4 | ||||
This completes the proof.
Remark 4.19.
To report the solution instead of just the count, we could return the set of rec-packs in Algorithm 4. Here, rec-packs are used to efficiently encode multiple squares (potentially exponentially many) into constant sized information.
Remark 4.20.
Here we assumed that arithmetic operations take constant time. However, even if each arithmetic operation took polynomial time, the total runtime would still be polynomial as there are only polynomially many arithmetic operations done.
5 Improved Algorithm for Orthogonal Polygons with Knobs
In this section, we design an algorithm for -OPCS where along with the number of vertices of the input orthogonal polygon we also have the parameter , which is the number of knobs (Definition 2.4) in . This algorithm works better than Algorithm 4 when are input instances are such that .
First, we define a special structure called separating squares and crucially use it to construct our recursive algorithm. We solve the base cases of the recursive algorithm using Algorithm 4.
5.1 More on Structure of Minimum Covering
We define our crucial structure of a separating maximal corner square (or simply, a separating square) and use the definition to further explore properties of non-knob convex vertices (Definition 2.5).
Definition 5.1 (Separating Maximal Corner Square).
Let be an orthogonal polygon. For a convex vertex , is said to be a separating maximal corner square or simply a separating square if the region inside but not inside is not a connected region (Figure 11).
This gives us the following result.
Lemma 5.2.
If is a non-knob convex vertex (Definition 2.5) of an orthogonal polygon , then is a separating square which separates and .
Proof 5.3.
If is a non-knob convex vertex, then any curve lying in and having end points at and must intersect and hence must be a separating square separating and .
Remark 5.4.
Given an orthogonal polygon , we can find a non-knob convex vertex in time (if it exists) by a simple check on all vertices (or report no non-knob convex vertex exist).
We now use this to recursively obtain simpler instances from an input instance .
5.2 Recursion with Separating Squares
Recall that a separating square separates an input orthogonal polygon into unconnected uncovered regions. We will construct two polygons from these uncovered polygons which still preserves the information about . First, we need the following terminology.
Definition 5.5.
Given an orthogonal polygon , let be a (maximal) separating square which is a maximal square due to a non-knob convex vertex of . We classify the set of connected components of that are separated by as follows,
-
•
be the connected components separated by that only intersect at more than one point with the top side of (and no other side).
-
•
be the connected components separated by that only intersect at more than one point with the bottom side of (and no other side).
-
•
be the connected components separated by that only intersect at more than one point with the left side of (and no other side).
-
•
be the connected components separated by that only intersect at more than one point with the right side of (and no other side).
-
•
be the connected components separated by that only intersect at more than one point with the top side and right side of and also at the top-right corner of .
-
•
be the connected components separated by that only intersect at more than one point with the bottom side and right side of and also at the bottom-right corner of .
-
•
be the connected components separated by that only intersect at more than one point with the top side and left side of and also at the top-left corner of .
-
•
be the connected components separated by that only intersect at more than one point with the left side and right side of and also at the bottom-left corner of .
-
•
be the connected components separated by that only intersect at more than one point with the top side, bottom side and right side of and also at the top-right corner and the bottom-right corner of .
-
•
be the connected components separated by that only intersect at more than one point with the top side, bottom side and left side of and also at the top-left corner and the bottom-left corner of .
-
•
be the connected components separated by that only intersect at more than one point with the right side, bottom side and left side of and also at the bottom-right corner and the bottom-left corner of .
-
•
be the connected components separated by that only intersect at more than one point with the right side, top side and left side of and also at the top-right corner and the top-left corner of .
Let and let .
Lemma 5.6.
Given an orthogonal polygon , let be a (maximal) separating square which is a maximal square due to a non-knob convex vertex of and be as defined in 5.5. Then the following must hold true.
-
•
, is a connected orthogonal polygon without holes.
-
•
Proof 5.7.
First, we observe that since is a separating square which is a maximal square due to a non-knob convex vertex , there cannot be a component that intersects with three vertices of (otherwise would not be maximal and could be grown by fixing a corner at ).
To see that for all , is connected, it is sufficient to observe that we can find a curve in the strict interior of from any point in its interior to any point in its interior; either lying inside a single connected component of (if are in that component), or through (if are in different components of ). Further, cannot have holes as does not have holes.
Moreover, we observe that there cannot be a valid square of that covers two different points from distinct (this would contradict the maximality of ). Also, in a minimum covering with as one of the squares, all other valid squares must cover at least one point from the interior of exactly one (otherwise this square would be completely inside , hence redundant). Therefore if is covered using a set of squares including , we can cover using the squares in that cover some part of and the square itself. If we do this for all this uses squares as is in this cover of all instances , but appear only once in (other squares in appear exactly once in a cover of for exactly one ). Since we start with a minimum cover of and find a valid cover of all polygons with exactly more squares in total, we get,
Given any minimum covering of all , all such instances must contain (as is a maximum corner square in both). So we superimpose these coverings and delete all but one to get a covering of . This time we started from a minimal covering of the individual polygons to get a valid covering of . Including this with the rest of the result, we obtain
Remark 5.8.
in Lemma 5.6. Moreover, there are combinations (like and ) that cannot both be non-empty in .
We now prove a crucial result that such a recursive step does not increase the number of knobs in each individual instance .
Lemma 5.9.
Let be a (maximal) separating square which is a maximal square due to a non-knob convex vertex of an orthogonal polygon with vertices and knobs. Let be defined as in Definition 5.5. Then, is an orthogonal polygon without holes with at most vertices and at most knobs. Moreover, any vertex in which is a corner of is part of a knob in along a side of .
Proof 5.10.
Lemma 5.6 already proves that is an orthogonal polygon without holes. Further, the number of vertices can only decrease because the only time a new vertex (vertex not in ) would be introduced is when already distributes the existing vertices of in each of (causing no total increase in the number of vertices in than in ). We now prove that has at most knobs.
Consider for some . Without loss of generality assume is either or or (all other cases have symmetric arguments). We now show that for all knobs in , there is a distinct knob in (which would show that has at most knobs if has at most knobs. Clearly any (distinct) knob of such that , are not corners in , must be a (distinct) knob in (knob in , in particular). Hence we only need to consider knobs which in such that either or is a vertex of . Without loss of generality, we assume that is a corner in .
-
•
Case I: . In this case the top-left and the bottom-left corners of completely lie inside and hence are not vertices of . Therefore is either the bottom-right corner or the top-right corner of (both are vertices in ). Without loss of generality, assume to be the top-right corner of . Consider to be the horizontal edge of (i.e. the edge overlap** with top edge of ) with as a corner. Since intersects with the right corner of , has to shorter than the side length of . As the entire region inside is inside , the other end point of must be a concave vertex. Therefore . Moreover, as the other end point of the vertical edge of from is the bottom-right corner of , must be the bottom right corner of ; must be a left knob (and the only knob) in (which proves that all vertices in which are corners in are part of knobs in , along a side of ). Moreover, for this knob , can find a left knob of the region (which must be a knob in as intersects only in top, bottom and right edges). Therefore, in this case, for every knob in , we can find a distinct knob in .
-
•
Case II: . We consider four subcases.
-
–
Case II(a): does not touch the top-right corner or the bottom-left corner of . By arguments similar to above, we can show that right side of and the bottom side of are right and bottom knobs of (which proves that all vertices in which are corners in are part of knobs in , along a side of ). By a similar argument must have a right knob and a bottom knob which are also a right knob and a bottom knob of . Therefore, in this case, for every knob in , we can find a distinct knob in .
-
–
Case II(b): touches the bottom-left corner of , but not the top-right corner of . Similar to before, the right side of is a right knob in (which proves that all vertices in which are corners in are part of knobs in , along a side of ) and we can find a right knob in which is also a right knob in . However, there can a bottom knob in which has its right endpoint as the bottom-right corner of , but is a convex vertex in (and hence in ). In this case, either is a bottom knob in (in which case we are done), or there is another vertex of such that lies between and ; therefore, must be vertex in or . Again, if is a a convex vertex in , then is a knob in and we are done. Otherwise there will be a bottom knob in the component containing . Further as can only intersect with in a right or a top edge, the bottom knob of must be a bottom knob of . This completes the argument for this case that for every knob in , we can find a distinct knob in .
-
–
Case II(c): touches the top-right corner of , but not the bottom-left corner of . Symmetric argument similar to the previous case.
-
–
Case II(d): touches the bottom-left corner and the top-right corner of . This means the non-knob convex vertex for much was the maximal square covering must be the bottom-right corner of . However, since touches the bottom-left corner and the top-right corner of , we can extend by fixing its bottom right corner at , contradicting the maximality of . Hence this case can never happen.
-
–
-
•
Case III: . We consider four subcases.
-
–
Case III(a): does not touch the top-left corner or the bottom-left corner of . By arguments similar to Case I, we can show that right side, the bottom side and the top side of are right, bottom and top knobs of respectively (which proves that all vertices in which are corners in are part of knobs in , along a side of ). And by similar argument must have a right knob, a bottom knob and a top knob which are also a right knob, a bottom knob and a top knob of . Therefore, in this case, for every knob in , we can find a distinct knob in .
-
–
Case III(b): touches the top-left corner of , but not the bottom-left corner of . Again similar to Case II(a), the right side and the bottom side of is a right knob and a bottom knob in (which proves that all vertices in which are corners in are part of knobs in , along a side of ); and we can find a right knob and a bottom knob in (and also in ). Moreover, there can be a top knob of which has one vertex in and one vertex in . Again, this case is similar to the second case of Case II(b) and we can find a top knob in which is not entirely contained in . Therefore, in this case, for every knob in , we can find a distinct knob in .
-
–
Case III(c): touches the bottom-left corner of , but not the top-left corner of . Symmetric argument similar to the previous case.
-
–
Case III(d): touches both bottom-left corner and the top-left corner of . By arguments similar to Case I, we can show that right side of is right knob of (which proves that all vertices in which are corners in are part of knobs in , along a side of ) and there is a right knob in which is also a right knob in . Moreover, there can be a top knob of which has one vertex in and one vertex in ; and a bottom knob of which has one vertex in and one vertex in . Again, this case is similar to the second case of Case II(b) and we can find a top knob (bottom knob) in which is not entirely contained in . Therefore, in this case, for every knob in , we can find a distinct knob in
-
–
Therefore in all cases, we can map knobs of for any to distinct knobs in . Therefore the total number of knobs of can be at most , if had at most knobs.
Using the following framework, we find a non-knob convex vertex (if any) in time (Remark 5.4). We construct , construct and use this recursion to recurse into similar instances where the number of knobs do not increase. We observe that each recursive step can also be done in linear time by a simple traversal of the polygon vertices in order.
Lemma 5.11.
If is an orthogonal polygon with vertices and at most knobs, we can either report that no non-knob convex vertex exists, or new smaller instances of orthogonal polygons which individually have at most knobs, in time.
Polygons without non-knob convex vertices.
Lemma 5.11 implies that whenever we have a non-knob convex vertex, we can recurse in linear time. However, we need to analyse what happens if there are no non-knob convex vertices. Our first result is to bound the number of vertices of such polygons.
Lemma 5.12.
There are at most vertices in an orthogonal polygon with at most knobs and no non-knob convex vertex.
Proof 5.13.
Let be the number of convex vertices and concave vertices in respectively. We must because is an orthogonal polygon with no holes. Moreover, as all convex vertices are part of knobs and there are at most knobs (containing two distinct vertices), we must have . Therefore the total number of vertices is .
Therefore, for such polygons, we have . We can detect if this is the case (i.e. does not have a non-knob convex vertex) in time (Lemma 5.11) and apply Algorithm 4 to solve OPCS in time (Theorem 4.17).
Lemma 5.14.
Given an orthogonal polygon with vertices and at most knobs and with no non-knob convex vertices, we can solve OPCS in time.
5.3 A Recursive Algorithm
With the previous results in hand, we can construct an exact algorithm, that solves OPCS on an arbitrary orthogonal polygon with vertices and at most knobs.
The algorithm follows the framework of (i) recurse as in Lemma 5.11 whenever possible and (ii) detect and solve base cases as in Lemma 5.14. We formally state the algorithm as follows.
5.4 Analysis of Separating-Square-Recursion
The correctness of Separating-Square-Recursion (Algorithm 5) is a direct consequence of Lemma 5.6 and the correctness of Algorithm 4, i.e. Theorem 4.17. We now analyse the time complexity of Algorithm 5.
Firstly, all steps of Algorithm 5 take time other than the calls to Algorithm 4 and the recursion step. We now prove some results of this algorithm which helps us bound the number of recursive calls to Algorithm 5.
We observe that if the input polygon is at some recursive step, the chosen separating square for a non-knobbed convex vertex , is and the recursed polygons are , then the vertices of each of are either vertices in or corners of . With this in mind we prove the following result.
Lemma 5.15.
Let an orthogonal polygon with vertices and at most knobs be the original input to the topmost level invocation of Algorithm 5. At some recursive step, let the input be , and let the algorithm choose to be a non-knob convex vertex of . Then must also be a non-knob convex vertex of the original polygon . Moreover, any corner of that is also a vertex of can not be a non-knob convex vertex.
Proof 5.16.
If is a non-knob convex vertex in , then must be a vertex in (and not a vertex introduced by some separating square at some recursive step). This is because all vertices introduced by a separating square at an intermediate recursive step have a knob along the side of the separating square itself (Lemma 5.9).
Next, if is a vertex participating in a knob in , then is a convex vertex. Due to this, at any intermediate recursion step, there cannot a polygon ( in particular) with as a vertex and a concave endpoint to the edge originating from and along . Thus, must be a non-knob convex vertex in .
We now prove that if is chosen as a non-knob convex vertex at some recursive step, then no subsequent recursive steps can again choose to construct their separating square.
Lemma 5.17.
Let be a non-knob convex vertex of the original input polygon . Then is chosen as the non-knob convex vertex in at most one recursive step of Algorithm 5.
Proof 5.18.
If is a non-knob convex vertex of the original input polygon , and let it be chosen at some recursive step for the first time. cannot be chosen as a non-knob convex vertex by any recursive step which does not lie in the subtree of in the recursion tree (as does not even appear as a vertex in those instances). However, once is chosen as the non-knob convex vertex, becomes a part of a knob (Lemma 5.9) in the subsequent steps (and hence not a non-knob convex vertex). Therefore is never chosen a the non-knob convex vertex in the subsequent recursive steps either.
Now, we can bound the number of recursive calls to Algorithm 5.
Lemma 5.19.
Proof 5.20.
Due to Lemma 5.17, the number of recursive steps where Algorithm 5) recurses (i.e. internal nodes in recursion tree), is bounded by the number of vertices in the original input polygon. As any recursive step calls at most more recursive steps, the number of steps where Algorithm 5 achieves the base-case condition (no non-knob convex vertex found) and calls Algorithm 4 is bounded by (i.e. leaf nodes in recursion tree). Therefore we have the above result.
Finally, we complete our algorithm with bounding the running time.
Theorem 5.21.
Separating-Square-Recursion (Algorithm 5) when run on an arbitrary orthogonal polygon with vertices and at most knobs, outputs the value of OPCS in time.
Proof 5.22.
Each internal node of the recursion tree for the algorithm takes time. Therefore, following from the bound in Lemma 5.19, the total time taken by the internal nodes of the recursion tree for the algorithm is .
Each leaf node of the recursion tree is an execution of Algorithm 4, each taking time (Lemma 5.14). Now, as there are leaf nodes in the recursion tree (Lemma 5.19), the base conditions together take time.
Hence, Separating-Square-Recursion runs in time.
Remark 5.23.
Note that we should only prefer Algorithm 5 when , otherwise Algorithm 4 provides better or same asymptotic run time.
Note that we may use any exact algorithm for OPCS to solve the base case.
Corollary 5.24.
If there is an algorithm solving OPCS in time for polygons with vertices, there is also another algorithm solving -OPCS on polygons with vertices and at most knobs in time .
5.5 Discussion on Orthogonally Convex Polygons
We discuss a well-studied special case of orthogonal polygons: orthogonally convex polygons.
Definition 5.25 (Orthogonally Convex Polygon).
An orthogonal polygon is said to be orthogonally convex (Figure 13), if the following hold true.
-
•
is a simply connected polygon with polygon edges parallel to either the x-axis or the y-axis.
-
•
The intercept of any line parallel to x-axis or y-axis with produces one continuous (possibly empty) line segment parallel to x-axis or y-axis.
It is easy to construct a simple orthogonal polygon having arbitrarily large number of knobs. However, we show that for orthogonally convex polygons, the number of knobs must be exactly .
Lemma 5.26.
Any orthogonally convex polygon contains exactly knobs. Moreover, contains exactly one left knob, exactly one right knob, exactly one top knob and exactly one bottom knob.
Proof 5.27.
Existence. Consider the leftmost vertical line that intersects to form a non-empty vertical line segment of intersection. This must intersect with a vertical polygon edge of (otherwise the vertical line can be moved more to the left). Clearly these endpoints of this vertical polygon edge form a left knob (otherwise the vertical line can again be moved more to the left). Hence a left knob always exists. Symmetric arguments yield that a top knob, a bottom knob and a right knob exists as well.
Uniqueness. We will show that there cannot be two left knobs implying that there is exactly one left knob. For the sake of contradiction, consider that there are two left knobs and with (refer to Figure 14). Consider the vertical line . This line intersects at the entire edge with the intercept the y coordinates being . Now consider any curve lying inside with and as endpoints. This curve must also intersect the line (as ) at some y coordinate outside . This means the intersection of the line with is not a single line segment, which contradicts the assumption that is orthogonally convex. Therefore, there can be exactly one left knob. Subsequently, by symmetric arguments this would mean that there is exactly one right knob, exactly one top knob and exactly one bottom knob.
Therefore, if we use Algorithm 5 to solve OPCS on orthogonally convex polygons, we can substitute in the analysis.
Corollary 5.28.
As orthogonally convex polygons have exactly knobs, Separating-Square-Recursion (Algorithm 5) takes time to solve OPCS on orthogonally convex polygons.
6 Hardness Results for Polygons with Holes
In this Section, we consider the OPCSH problem. We consider the setting as described in [3], i.e. we need to solve OPCSH in orthogonal polygons, where the input consists of all lattice points lying in the polygon or on the boundary. In [3], a proof is given to show that OPCSH is NP-complete if the input size is polynomial in . In this section, we fix an issue with the proof and state other results obtained as a consequence.
6.1 Issue with the existing proof
The proof in [3] for NP-completeness of OPCSH gives a reduction from Planar 3-CNF [8]. The reduction gives a polynomial time algorithm to reduce any Planar 3-CNF instance (say ) and transforms it to an instance of OPCSH. First the formula is negated to obtain , which is a formula in disjunctive normal form (DNF) due to De-Morgan’s law. This means that is satisfied if and only if evaluates to false on some truth assignment of the variables. Now, is reduced to an instance of OPCSH using three kinds of gadgets: wires, variable gadgets and junction gadgets. A variable gadget is introduced for each variable of and a junction gadget is introduced for each conjunction in . Further wire gadgets (or simply wires) are introduced to ‘connect’ junction gadgets to variable gadgets.
The variable gadgets, wires and the junction gadgets shall be placed according to the formula . For each variable gadget or each wire, it is easy to compute in polynomial time the minimum number of squares needed to cover the gadget. It is possible that some of the squares used for covering a wire may cover a region inside a junction gadget. Each variable gadget permits two kinds of covering (representing the two kinds of truth assignment to a variable in ). Let us denote these coverings by true-covering and false-covering, respectively - both coverings require the same number of squares. Similarly we can extend this observation to see that there are two ways in which a variable gadget and its adjacent wires can be covered optimally - and both coverings use the same number of squares. A combination of how a variable gadget is covered affects which portions of all its corresponding junction gadgets (i.e. gadgets for the and-clauses containing the corresponding variable in ) will be covered. We will keep the construction of variable gadgets and wires unchanged from the construction in [3]. Let be the number of squares required to cover all variable gadgets and be the number of squares required to cover all wire gadgets.
In [3], the authors claim that the junction gadgets (or simply, a junction) are such that, the minimum number of squares needed to cover a junction gadget is if all three variable gadgets corresponding to the and-clause are covered with a covering which makes the and-clause evaluate to true (i.e. true-covering if the variable appears non-negated in the clause, or false-covering if the variable is negated in the clause); otherwise the minimum number of squares needed is . Therefore, the junctions act similar to and-gates. Now, if the total number of junctions be , then [3] concludes by stating that is satisfiable if and only if the reduced instance can be covered with less than squares; otherwise exactly squares are required. Hence solving OPCSH would also solve Planar 3-CNF.
However, we take a deeper look into this reduction by performing a case work on the evaluated value of for possible truth assignments of variables.
-
•
Case I, is true for all assignments. This implies is false for all assignments. Since is in DNF, all assignments must render all and-clauses as false. Therefore, for all minimum covering of the variable gadgets, coverings all junctions would require squares. This means the minimum number of squares needed to cover such an instance is .
-
•
Case II, is false for all assignments. This implies is true for all assignments. Since is in DNF, all assignments must render at least one and-clauses as true. Therefore, for any arbitrary minimum covering of the variable gadgets, there would be at least one junction that can be covered with squares (while others take at most squares). This means the minimum number of squares needed to cover such an instance is less than .
-
•
Case III, is true for some assignments and false for some. This implies is also true for some assignments and false for some. Consider any such assignment such that is true and cover the variable clauses accordingly. Since is in DNF, this assignments must render at least one and-clauses as true. Therefore, if we cover the variable gadgets corresponding to such an assignment, there would be at least one junction that can be covered with squares (while others take at most squares). This means the minimum number of squares needed to cover such an instance is less than .
Therefore, the minimum number of squares to cover the reduced instance is equal to if and only if is true for all assignments (Case I) and less than otherwise. Therefore, solving OPCSH solves tautology for instead of satisfiablity. Moreover, tautology in a CNF formula can be checked in linear time (Since is a tautology if and only if for all clauses in there is a variable such that both and appear in ). Hence this reduction does not prove NP-hardness of OPCSH.
6.2 Fixing the Construction
The issue in the NP-hardness reduction in [3] arose as the clauses require more number of squares when the literals of a clause do not all evaluate to true even if this assignment sets the clause to true.
We construct such a junction that requires squares if all three of its literals evaluate to false, whereas the junctions require squares when at least one literal evaluates to true. Therefore our modified junction behaves similar to an or-gate.
Recap** the Constructions of Variable Gadgets and Wires.
The construction due to [3] starts by defining even-lines (odd-lines) as horizontal lines with an even (odd) y-coordinate or a vertical line with an even (odd) x-coordinate. The construction of variable gadgets and wires follow the following properties.
-
•
All maximal squares of variable gadgets and wires are in dimension.
-
•
The wires connecting a variable gadget for a variable , to a junction for a clause , where appears non-negated in — connect to the variable gadget (as well as the junction) horizontally, and along two consecutive odd lines (i.e. an even line passes through the middle of such a connection). Refer to diagrams in [3].
-
•
The wires connecting a variable gadget for a variable , to a junction for a clause , where appears negated in — connect to the variable gadget (as well as the junction) horizontally, and along two consecutive even lines (i.e. an odd line passes through the middle of such a connection). Refer to diagrams in [3].
-
•
If a variable gadget for a variable is covered with a true-covering, then all wires connecting it to a junction for a clause where appears non-negated, will be covered in a way such that half a square protrudes out of destination and hence covers a part of the junction. Otherwise, for a false-covering, the entire junction would remain uncovered, even when the variable gadget and the wire are covered. Refer to diagrams in [3].
-
•
If a variable gadget for a variable is covered with a false-covering, then all wires connecting it to a junction for a clause where appears negated, will be covered in a way such that half a square protrudes out of destination and hence covers a part of the junction. Otherwise, for a true-covering, the entire junction would remain uncovered, even when the variable gadget and the wire are covered. Refer to diagrams in [3].
We construct new junction gadgets along with these constructions of wires and variable gadgets in [3].
Modifying the Junction Gadgets.
We construct new junction gadgets as shown in Figure 15. Wires connect to these junction gadgets in the same way as described in [3].
The junctions for clauses of type can be constructed by shifting the gadget in Figure 15(a) vertically up by one square. Similarly the junctions for clauses of type can be constructed by shifting the gadget in Figure 15(b) vertically up by one square.
We now investigate minimal coverings of squares for each of these gadgets.
Lemma 6.1.
Each junction gadget requires squares to be covered when at least one literal in it evaluates to true. Otherwise the junction gadget requires squares to be covered.
Proof 6.2.
The following proof works for both the gadgets in Figure 15(a) and Figure 15(b). Both configurations are such that there are nine maximal squares due to convex vertices present due, and eleven squares necessary for joining with wire gadgets (Remark 3.5). Other than these squares, we analyse other valid squares needed to cover it fully.
In both gadgets, we can find eight blocks ( regions) , as shown in Figure 16, such that these are not covered by any of the previously placed squares (irrespective of the true/false values carried through the wires); and for , and cannot be covered by a single valid square. This means at least more valid squares are required to cover the entire gadget. This means at least squares are required to cover the entire gadget (for any truth values being carried through the wires).
Further, if all wires contain a false value, we can find nine blocks ( regions) , as shown in Figure 17, such that these are not covered by any of the previously placed squares; and for , and cannot be covered by a single valid square. This means at least more valid squares are required to cover the entire gadget. Therefore at least squares are required to cover the entire gadget when all wires contain a false value.
In Figure 18 and Figure 19, we indeed construct a set of valid squares covering the entire gadget when all three wires carry a false value, and a set of valid squares covering the entire gadget when at least one of the wires contain a true value. This construction proves that indeed squares and squares are precisely the minimum number of valid covering squares required to cover the gadgets if all literals are false, and at least one literal is true, respectively. This completes the proof.
Now, we complete the reduction from Planar 3-CNF (refer to [8]).
Completing the Reduction.
We consider an instance (a CNF boolean formula) of Planar 3-CNF. We construct variable gadgets (as in [3]) for each variable in , and set up junctions ( Figure 15) for each clause in (we are working with directly, instead of working with as done in [3]) and connect them with wires (as in [3]). Let be the squares required to cover all variable gadgets and wires.
Now, we analyse the three cases like before. Let be the number of junctions.
-
•
Case I, is true for all assignments (satisfiable). Since is in CNF, all assignments must render all or-clauses as true (i.e. at least one literal in each clause is true). Therefore from Lemma 6.1, for all minimum covering of the variable gadgets, coverings all junctions would require a minimum of only valid squares. This means the minimum number of squares needed to cover such an instance is equal to .
-
•
Case II, is false for all assignments (not satisfiable). Since is in CNF, all assignments must render at least one or-clause as false (i.e. at all literals in at least one clause is false). Therefore from Lemma 6.1, at least one junction requires a minimum of valid squares, where as others require at least valid squares for being covered. This means the minimum number of squares needed to cover such an instance is strictly more than .
-
•
Case III, is true for some assignments and false for some (satisfiable). Consider any such assignment such that is true and cover the variable clauses accordingly. Since is in CNF, this assignments must render all or-clauses as true (i.e. at least one literal in each clause is true). Therefore from Lemma 6.1, for such a minimum covering of the variable gadgets, coverings all junctions would require squares. This means the minimum number of squares needed to cover such an instance is equal to .
This implies that is satisfiable if and only if the reduced instance has a minimum covering with exactly squares. On the other hand, if is not satisfiable, then the minimum number of squares required to cover the reduced instance is strictly more than . Since Planar 3-CNF is NP-hard, OPCSH must also be NP-hard. Finally, as any certificate can be verified in polynomial time using Algorithm 1, OPCSH is NP-complete.
Theorem 6.3.
The problem of covering orthogonal polygons with holes using minimum number of squares (OPCSH) is NP-complete (when the input is the set of all lattice points inside the orthogonal polygon).
Moreover, as both the answer and the numerical value of the coordinates of each of the points is linear (polynomial) in the number of points inside the polygon, the problem is strongly NP-complete. Hence we can conclude the following.
Corollary 6.4.
OPCSH is strongly NP-complete. Therefore, there is no FPTAS scheme for OPCSH unless . That is, there is no -approximation scheme for arbitrarily small , such that runs in time , where is the number of lattice points inside the polygon.
Due to the structure of the reduced instance, we can also infer the following.
Corollary 6.5.
The following problems are NP-complete:
-
•
The problem of finding a minimum square covering of polygons with holes, where all squares are restricted to have a side-length of at most is NP-complete whenever .
-
•
The problem of finding the minimum square covering of polygons, where the squares can take side lengths from a set is NP-complete, even if .
Proof 6.6.
The results follow from the observation that the reduced instance from Planar 3-CNF only contains maximal squares of size and , and from Observation 3.
Another immediate corollary of Theorem 6.3 is that fact that OPCSH is NP-hard when the vertices of the polygon constitute the input, instead of the lattice points lying inside. This is because the reduced instance had . It turns out that OPCSH is in fact in the class NP, with vertices as input. This gives us the following result.
Corollary 6.7.
OPCSH is NP-complete when the input is the vertices.
Proof 6.8.
Theorem 6.3 immediately gives us that OPCSH is NP-hard when the input is the vertices.
To prove that OPCSH with vertices is in NP, we need to show a polynomial time verifier for a certificate. We consider the set of rec-packs to be a certificate, and we can do the following to check if these indeed form a valid covering:
-
•
Check if each rec-pack lies inside the polygon. This can be checked in by checking if an arbitrary point in the rec-pack lies in the polygon, followed by ensuring that no polygon-edge intersects a rec-pack edge non-trivially.
-
•
If all rec-packs lie in the polygon, we can use Algorithm 1 to check if they form a complete covering of the polygon. Algorithm 1 does generalize to polygons with holes as well.
This proves there there is in fact a polynomial time verifier for OPCSH.
7 Conclusion
In this paper, we answer an open problem in [3], of whether OPCS has an exact algorithm running in time polynomial in the number of vertices of the input orthogonal polygon without holes. Our exact algorithm for OPCS runs in time. We further optimize the running time for orthogonal polygons with vertices and a small number of knobs , by designing a recursive algorithm with running time . This gives us an algorithm for solving OPCS on orthogonally convex polygons. We also correct some errors in the NP-hardness reduction for OPCSH given in [3]. A natural future direction is to study the problem with respect to covering of orthogonal polygons with other geometric objects like triangles, line segments, orthogonally convex polygons etc. and try to obtain an algorithm whose running time is polynomial in the number of vertices of the input polygon and not on the total number of interior points of the input polygon. Another interesting question directly related to our current work would be to find tight bounds for the number of rec-packs required to produce a minimum covering of an orthogonal polygon; our paper only proves an upper bound of rec-packs required to produce a minimum covering of an entire polygon.
References
- [1] Michael O. Albertson and Claire J. O’Keefe. Covering regions with squares. SIAM Journal on Algebraic Discrete Methods, 2(3):240–243, 1981. arXiv:https://doi.org/10.1137/0602026, doi:10.1137/0602026.
- [2] V. S. Anil Kumar and H. Ramesh. Covering rectilinear polygons with axis-parallel rectangles. In Proceedings of the Thirty-First Annual ACM Symposium on Theory of Computing, STOC ’99, page 445–454, New York, NY, USA, 1999. Association for Computing Machinery. doi:10.1145/301250.301369.
- [3] L. J. Aupperle, H. E. Conn, J. M. Keil, and Joseph O’Rourke. Covering orthogonal polygons with squares. Proc. 26th Allerton Conf. Commun. Control Comput., 1988. URL: https://www.science.smith.edu/~jorourke/Papers/ConnJORsquares.pdf.
- [4] Reuven Bar-Yehuda. Covering polygons with squares. 2014. URL: https://api.semanticscholar.org/CorpusID:50721774.
- [5] Jean R. S. Blair and Barry Peyton. An introduction to chordal graphs and clique trees. In Alan George, John R. Gilbert, and Joseph W. H. Liu, editors, Graph Theory and Sparse Matrix Computation, pages 1–29, New York, NY, 1993. Springer New York.
- [6] J.C. Culberson and R.A. Reckhow. Covering polygons is hard. In [Proceedings 1988] 29th Annual Symposium on Foundations of Computer Science, pages 601–611, 1988. doi:10.1109/SFCS.1988.21976.
- [7] Fanica Gavril. Algorithms for minimum coloring, maximum clique, minimum covering by cliques, and maximum independent set of a chordal graph. SIAM J. Comput., 1:180–187, 1972. URL: https://api.semanticscholar.org/CorpusID:1111479.
- [8] David Lichtenstein. Planar formulae and their uses. SIAM Journal on Computing, 11(2):329–343, 1982. doi:10.1137/0211025.
- [9] Dipen Moitra. Finding a minimal cover for binary images: An optimal parallel algorithm. Algorithmica, 6(5):624–657, 1991. doi:10.1007/BF01759065.
- [10] J. O’Rourke. Art Gallery Theorems and Algorithms. International series of monographs on computer science. Oxford University Press, 1987. URL: https://books.google.co.in/books?id=aPZQAAAAMAAJ.