Locating Guards for Visibility Coverage of Polygons∗
Total Page:16
File Type:pdf, Size:1020Kb
Locating Guards for Visibility Coverage of Polygons∗ Yoav Amity Joseph S. B. Mitchellz Eli Packerx n Abstract trivial b 3 c-approximation that comes from the classical We propose heuristics for visibility coverage of a polygon combinatorial bound. with the fewest point guards. This optimal coverage prob- Our Contribution. We propose heuristics for lem, often called the \art gallery problem", is known to be computing a small set of point guards to cover a given NP-hard, so most recent research has focused on heuristics polygon. While we are not able to prove good worst- and approximation methods. We evaluate our heuristics case approximation bounds for our methods (indeed, through experimentation, comparing the upper bounds on each can be made \bad" in certain cases), we conduct the optimal guard number given by our methods with com- an experimental analysis of their performance. We give puted lower bounds based on heuristics for placing a large methods also to compute lower bounds on the optimal number of visibility-independent \witness points". We give number of guards for each instance in our experiments, experimental evidence that our heuristics perform well in using another set of implemented heuristics for deter- practice, on a large suite of input data; often the heuristics mining a set of visibility-independent witness points. give a provably optimal result, while in other cases there (The cardinality of such a set is a lower bound on the op- is only a small gap between the computed upper and lower timal number of guards.) We show that on a wide range bounds on the optimal guard number. of input polygons, our heuristics work well in practice, often matching our computed lower bounds (in which 1 Introduction case the solution is provably optimal), and always yield- ing at most 2 times the lower bound (for the randomly The art gallery problem was introduced in 1973 when generated instances). To our knowledge, ours is the first Klee asked how many guards are sufficient to \guard" attempt to conduct a systematic experimentation with the interior of a simple polygon having n vertices. Al- guard placement heuristics, together with methods to though it was shown that b n c guards are always suffi- 3 compute lower bounds that give provable performance cient and sometimes necessary [12, 14], and such a set of bounds in terms of approximation ratios. guards can be computed easily, such solutions are usu- Our implementation is built on top of the CGAL ally far from optimal in terms of minimizing the number arrangement package. Our experiments are conducted of guards for a particular input polygon. Moreover, it on a variety of polygons, including many generated was shown that determining an optimal set of guards is \randomly" using the RPG software of [2]. NP-hard, even for simple polygons [23]. Approximation Related Work. Surveys on the art gallery prob- algorithms with logarithmic approximation ratios are lem are given in [1, 25, 26, 27]. A related problem to known ([13, 15, 17]) for somewhat restricted versions of computing a minimum guard cover is the problem of the problem, e.g., requiring guards to be placed at ver- computing optimal partitions of polygons, e.g., into the tices or at points of a discrete grid. Constant-factor ap- fewest convex or star-shaped subpolygons. These prob- proximations are known for guarding 1.5D terrains and lems are theoretically much easier than coverage prob- monotone polygons (see [5, 22, 24]), and exact meth- lems; polynomial-time algorithms based on dynamic ods are known for the special case of rectangle visibility programming are known [3, 21]. Of course, if a polygon in rectilinear polygons [28]. The unrestricted version can be partitioned into k convex or star-shaped sub- of the optimization problem remains open; no approxi- polygons, it can be guarded using at most k guards; mation algorithms are known that are better than the thus, partitioning can serve as a basis for one type of heuristic for guard coverage. We note, however (see ∗ Partially supported by grants from the National Science Section 5.1), that there are simple examples for which a Foundation (ACI-0328930, CCF-0431030, CCF-0528209), Metron Aviation, and NASA Ames (NAG2-1620). constant number of guards are sufficient to cover, while yStony Brook University, Stony Brook, NY 11794-4400. the best partition is of linear size. zStony Brook University, Stony Brook, NY 11794-3600. [email protected]. xStony Brook University, Stony Brook, NY 11794-4400. [email protected]. 2 Preliminaries from which a good guarding set can be extracted. The input is a (possibly multiply connected) polygon P having a total of n vertices on its boundary. We let h be • Criteria for greedily choosing guards G ⊂ S: From the number of holes in P ; if h = 0, P is said to be simple. S we choose a smaller set G that also covers P . For points p; q 2 P , we say that p and q are visible The challenge here is to derive a good heuristic for to each other if the segment pq is contained in P . For choosing guards that results in a small set G. p 2 P , we let V(p) denote the visibility polygon of p, i.e., set of all points q 2 P that are visible to p. Clearly, V(p) 3.1.1 Constructing a Candidate Set. We exper- is star-shaped and p belongs to its kernel. Similarly, for iment with three choices of candidate sets. a set of points P ⊆ P we denote by V(P) = Sp2P V(p) The first one, V (P ), is essentially the set V of the union of all of the visibility polygons of the points vertices of P ; it is easy to see that V guards all of P . of P. We say that a set G ⊂ P of points is a guarding For implementation purposes, we actually used points set of P if V(G) = P . We let g(P ) be the number of arbitrarily close to the vertices of P from inside, in order guards in a minimum-cardinality guarding set of P . to avoid degenerate visibility on the adjacent edges { see We say that a finite set, I ⊂ P , of points in Section 2. The exact position is on the ray that bisects P is a visibility-independent set of witness points if the interior angle of the corresponding vertex. We also the visibility polygons V(p) : p 2 I are pairwise- made sure that each point is actually inside P . disjoint: 8p;q2I V(p) \ V(q) = ;. We let i(P ) denote the In our second choice of candidate set, we place the independence number of P , defined to be the number candidate points at the centers (centers of mass) of the of witness points in a maximum-cardinality visibility- convex polygons in a decomposition of P induced by an independent set. Clearly, g(P ) ≥ jIj for any visibility- arrangement of certain line segments. We consider two independent set I, since no single guard is able to see different arrangements. One arrangement is defined by more than one point of I. Thus, if we find a visibility- edge extensions, extending each edge that is incident to independent set I and a guarding set G such that a reflex vertex v, extending it beyond v until it intersects jIj = jGj, then G is an optimal guarding set (e.g., see the boundary of P at some other point; see Figure 1(a). Figure 13(e)). Not all polygons admit two such sets; The second arrangement is defined by extensions of visi- indeed, there can be an Ω(n) gap between i(P ) and bility graph edges that are incident to at least one reflex g(P ) (see Section 5.1). We say that a polygon for which vertex, v: If v sees vertex u, then we construct a segment i(P ) = g(P ) is a perfect polygon (in analogy with the vw that extends along the line through u and v, away concept of perfect graphs). from u, until it first encounters a point w on the bound- In our experiments, our goal will be to find small ary of P . See Figure 1(b). The arrangement of these vis- guarding sets G and large visibility-independent sets I; ibility extensions also give rise to an arrangement having the set G we produce approximates the optimal guard convex faces within P . Finally, C(P ) is defined to be the number, g(P ) with approximation ratio jGj=jIj. set of centers of mass for the convex faces in the arrange- ment (either of edge extensions or visibility extensions). 3 Algorithms It is easy to see that C(P ) guards P . Note that there 3.1 Greedy Algorithms. A natural approach to are O(n) edge extensions (thus, their arrangement has placing guards is to do so greedily: Add guards one by worst-case complexity O(n2)) and there are O(n2) visi- one until coverage is achieved, choosing at each step bility extensions (with arrangement complexity O(n4)). a guard from among a set of candidates in order to The intuition behind using these partition-based can- maximize its contribution to the coverage (e.g., the didate sets is that different subpolygons will contain \amount" of P that it sees that was not previously points with different combinatorial type with respect to covered). Greedy methods are well known in set visibility within P . For instance, in Figure 1(a), points cover problems, as they yield logarithmic approximation in different subpolygons see different subsets of the re- bounds (which are best possible in some sense).