Abstract 1 Introduction 2 Preliminaries 3 The Algorithm 4 Computing the Shortest Watchman Routes That See All of 𝑷 5 Adaptations for the Floating Variant 6 Conclusion References

Improved Approximation of Two Watchmen’s Routes in Simple Polygons

Anna Brötzner ORCID Faculty of Technology and Society, Malmö University, Sweden    Bengt J. Nilsson ORCID Faculty of Technology and Society, Malmö University, Sweden    Christiane Schmidt ORCID Department of Science and Technology, Linköping University, Sweden
Abstract

We study the watchman route problem for a set of two watchmen for the objective of minimizing the length of the longest route (min-max) inside a simple polygon P having n vertices, which is known to be weakly NP-hard. First, we consider seeing a discrete set of m points in the interior of P. We show that even this problem is weakly NP-hard and present an approximation algorithm with approximation ratio 2+ε that runs in O(m5n) time, assuming that a starting point for each of the two routes is given. We generalize the algorithm to see all of the interior of P in O(n6) time with approximation ratio 2+π/23.571, improving on the previously known best algorithm that has an approximation ratio of 6.922 and runtime O(n2) [8]. Finally, we describe how to extend this algorithm to the case where no starting points are given, this taking O(n8) time, yielding an approximation ratio of 3+π/24.571, improving on the previously known best approximation algorithm with ratio 5.969 also having runtime O(n8) [8].

Keywords and phrases:
Art gallery problem, watchman route problem, multiple watchmen, path planning, polygons
Copyright and License:
[Uncaptioned image] © Anna Brötzner, Bengt J. Nilsson, and Christiane Schmidt; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Computational geometry
; Theory of computation Design and analysis of algorithms ; Theory of computation Approximation algorithms analysis
Funding:
All authors were supported by grant 2021-03810 (Illuminate: provably good algorithms for guarding problems) from the Swedish Research Council (Vetenskapsrådet). Brötzner and Nilsson were also funded by grant 20250562 (Illuminate and Move: provably good algorithms for exploration problems) from the Crafoord foundation.
Editor:
Pierre Fraigniaud

1 Introduction

The problem of finding a shortest watchman route goes back to Chin and Ntafos, who also provided algorithms for rectilinear polygons [2]. Algorithms for simple polygons were first given in [3] and corrected in [10]. The shortest watchman route problem has two variants, the anchored or fixed variant, where the route must pass through a given point sometimes specified to lie on the boundary, and the non-anchored or floating variant with no requirement to pass a specific point. The currently best algorithm for the anchored version requires O(n3) time in the worst case [11], if the anchor point is assumed to lie on the boundary of the polygon. The floating variant can be computed in O(n4) time by combining the result in [11] with the method in [9].

For two watchmen, the so-called two-watchman route problem, Mitchell and Wynters [7] showed that computing routes with the objective of minimizing the length of the longer route (min-max) is weakly NP-hard. Nilsson and Packer [8] recently provided approximation algorithms for computing min-max two-watchman routes with an approximation ratio of 5.969 for the floating case taking O(n8) time, and 6.922 for the case of two given starting points, not necessarily on the boundary, taking O(n2) time.

We first consider the following variant of the two-watchman route problem. We are given m point sized treasures (the set 𝒮) in the simple polygon that need to be guarded [1, 4]. For the single watchman route case, an appropriate modification of the algorithm of Tan and Jiang [11] obtains a shortest route that visits the visibility polygons of the treasures in O(m2n) time for the boundary anchored version and can be extended to O(m3n) time for the floating version using Tan’s technique [9]. We want to compute the shortest two routes Vs and Vs, starting at two points s and s, respectively, not necessarily on the boundary of the polygon, such that every point pi𝒮 is seen from at least one point on one of the routes. Two natural optimization criteria have previously been considered for these problems: the min-max measure and the min-sum measure. For the min-max measure we wish to obtain two routes such that the longer of the two is as short as possible. As we prove, this problem is weakly NP-hard not only for the objective of seeing all of the simple polygons [7], but also for the objective of seeing all points in 𝒮. The min-sum measure on the other hand asks for two routes such that the sum of their lengths is minimized. The complexity status for this version is unknown.

We develop two algorithms for this anchored discrete problem, optimizing on the min-max criterion, one having approximation ratio 2+π/2 and running in O(m5n) time and an improved version that, for any fixed ε>0, gives an approximation ratio of 2+ε, also running in O(m5n) time.

Secondly, we also consider the problem of guarding the complete polygon P and modify the first algorithm developed for a discrete point set using results from Nilsson and Packer [8]. We obtain algorithms having approximation ratio 2+π/2 for the anchored and 3+π/2 for the floating versions of the two-watchman route problem. The algorithm for the anchored version runs in O(n6) time and the algorithm for the floating version runs in O(n8) time.

2 Preliminaries

Let P be a simple polygon with n vertices 𝒱={v1,,vn} labeled in clockwise order, and let 𝒮={p1,,pm} be a set of m points in P​, the treasures. We assume that no three points among the polygon vertices and 𝒮 are collinear. Furthermore, let s and s be the two starting points for the watchman routes in P, not necessarily lying on the boundary.

For a point pP, let VP(p) be the visibility polygon of p, the set of points in P that are visible to p. An edge of VP(p) that is not contained in an edge of P is called a window of p.

Figure 1: Illustration of the visibility polygon of a point and the windows (black arrows). The windows point towards their corresponding top points. For point pj, Csj=Csj, hence pj𝒮1, while for pi, CsiCsi, thus pi𝒮2.

Without loss of generality, we may assume that s,sVP(pi), for any pi𝒮, as those points are already seen from the starting points. Let Csi be the window that separates the subpolygon of PVP(pi) containing s from VP(pi). Analogously, let Csi be the window that separates the subpolygon of PVP(pi) containing s from VP(pi). Now, observe that a watchman who starts walking at s (s) sees point pi as soon as it visits Csi (Csi). We assign a direction to each window Csi (Csi) so that VP(pi) lies locally to the left of Csi (Csi) if the polygon is rotated so that the window is directed upwards, see also Figure 1. We denote the lower endpoint of the window the bottom point of the window and the upper endpoint the top point.

We study the problem of computing two routes such that each of the treasures can be seen from at least one of the routes. We denote the length of a route W by W.

Problem 1 (Min-Max Two-Watchman Route Problem for Treasures).

Given a simple polygon P, a set of points 𝒮 in P, (and two starting points s and sP,) compute two routes W and W (where W passes through s and W passes through s), such that every point of 𝒮 is visible from at least one point on W or W and such that max{W,W} is minimized.

Theorem 1.

Problem 1 is weakly NP-hard.

Proof.

The reduction is from 2-partition [6]. Let A={a1,a2,,an} be a set of integers. We construct a polygon P with points p1,,pn where an optimal watchman route that sees all points has length i=1nai+δ for some small constant δ, and an optimal solution to Problem 1 consists of two tours with length 1/2i=1nai+δ each, corresponding to an optimal partition of A.

Let δminaiAai. We start with a regular convex polygon with n vertices and perimeter δ, which we call the center of P. The starting points s and s are placed on the boundary of the center. On the ith side of the center, we attach a rectilinear tube of width δ/n and length ai/2. At the end of each corridor, there is a small notch that contains point pi such that the window of pi has distance ai/2 to the center. See Figure 2 for an illustration of the polygon.

The shortest watchman route that sees all points p1,,pn runs along the boundary of the center, and thus passes through both s and s, and walks through each tunnel up to the window Csi of point pi, for 1in. For two watchman routes, only one of them needs to visit the window of a point pi. As each route is connected and starts at its corresponding starting point, the watchmen also walk a portion within the center of the polygon. However, note that even walking along all of the boundary of the center extends the total route length only by an additive constant of δ, which does not affect the choice of points assigned to each route. Thus, for an optimal pair of routes Ts, Ts for Problem 1, the points p1,,pn are partitioned into two sets 𝒳s and 𝒳s, such that Ts visits the windows of the points in 𝒳s and Ts visits the windows of the points in 𝒳s. Hence, (𝒳s, 𝒳s) corresponds to a 2-partition of A.

Figure 2: Schematic representation of the polygon constructed from an instance of 2-partition. Each of the two watchmen (red and blue) guards a portion of the points pi, such that the route lengths of both watchmen are (almost) equal.

We can extend this problem and require the whole polygon to be seen.

Problem 2 (Min-Max Two-Watchman Route Problem for a Polygon).

Given a simple polygon P (and two starting points s and sP), compute two routes W and W (where W passes through s and W passes through s), such that every point in P is visible from at least one point on W or W and such that max{W,W} is minimized.

Let Ws (Ws) be the shortest route that sees all the points in 𝒮 and passes through s (s). If s (s) lies on the boundary of P​, we can use the modified algorithm by Tan and Jiang to compute it in O(m2n) time. If s (s) does not lie on the boundary, we need to modify the algorithm to obtain which window is visited first along a clockwise traversal of the tour starting at s (s). By trying all possible windows, we can compute the optimal route in O(m3n) time.

We denote the min-max shortest pair of routes that together see all the points in 𝒮, one passing through s and the other passing through s, by Ts and Ts. We can without loss of generality assume that each of Ts and Ts is as short as possible. Furthermore, we define OPT=defmax{Ts,Ts}.

For each pi𝒮, let tspi be the shortest path from starting point s to VP(pi), i.e., to the window Csi, and analogously let tspi be the shortest path from starting point s to VP(pi), i.e., to the window Csi; these paths are marked in red in Figure 1. Let tminpi=arg min{tspi,tspi} be the shorter of the two paths to see pi and let tmaxpi=arg max{tspi,tspi} be the longer of these two paths.

We remark that finding an (approximate) min-max optimal pair of routes is a question of correctly partitioning the points to be seen between the route passing through s and the route passing through s​. Once the partitioning is obtained, the routes can be computed in O(m3n) time as previously described.

3 The Algorithm

We describe an algorithm to compute two watchman routes to see a set of treasures 𝒮 in a polygon P (Problem 1). This is also the basis for the algorithm for seeing the whole polygon (Problem 2) that we present in Section 4, and then generalize to the floating version in Section 5.

First, compute a shortest watchman route Ws that sees all points in 𝒮 and starts at s, and a shortest watchman route Ws that sees all points in 𝒮 and starts at s. If the two routes Ts and Ts of an optimal two-watchman route intersect, then either of Ws and Ws, together with a route of length 0 at the respective other starting point, gives a 2-approximation. This follows from the fact that we can trace the subpaths of the routes between their intersection points to obtain a route that sees all the points in 𝒮. Thus, max{Ws,Ws}Ts+Ts2max{Ts,Ts}. All the remaining steps use the assumption that the routes Ts and Ts do not intersect.

We partition the points in 𝒮 into two sets, depending on where s and s lie with respect to VP(pi). Let 𝒮1 be the set of points in 𝒮 for which Csi=Csi, and let 𝒮2 be the remaining set of points in 𝒮; see Figure 1 for an illustration. To compute the two watchman routes, we consider 𝒮1 and 𝒮2 separately in Sections 3.1 and 3.2, respectively.

3.1 Handling the Points in 𝓢𝟏

Let tspi and tspi be the shortest paths from s and s​, respectively, to VP(pi). The endpoints of tspi and tspi different from s and s lie on windows Csi and Csi, respectively. If Csi=Csi, then pi belongs to the set 𝒮1 and we denote the window Ci. Our objective in this section is to show how to compute two routes Vs1 and Vs1 of optimal min-max length such that they together see all the points in 𝒮1.

Consider the set PVP(pi) of disjoint subpolygons of P. Let Pi be the subpolygon that contains s and s​, for each point pi𝒮1. If PiPj, we say that pj dominates pi, ij, since any route through s or s that visits VP(pj) must also visit VP(pi). We call any point in 𝒮1 dominating if it is not dominated by any other point in 𝒮1 and assume henceforth that 𝒮1 contains only dominating points.

For the sake of convenience in this section, we relabel each window Ci associated to the point pi𝒮1 based on the first appearance of its bottom point on the boundary of P along a clockwise traversal of the boundary. To do this, start at vertex v1 and traverse the boundary in clockwise direction. Then, relabel the windows to C0,C1,,C|𝒮1|1 in the order as the bottom point of each window is encountered. We order the associated points in 𝒮1 correspondingly.

Let Ts1 and Ts1 be two min-max length routes that together see all points in 𝒮1.

Figure 3: Illustrating the proof of Lemma 2.
Lemma 2.

Let C0,C1,,C|𝒮1|1 be the windows of the dominating points in 𝒮1, ordered as their bottom points appear along the boundary in clockwise order. If Ts1 and Ts1 do not intersect, then there exist at most two indices i and j such that Ts1 visits Ci,Ci+1,,Cj1 and Ts1 visits Cj,Cj+1,,Ci1. (Implicitly assuming that indices are taken modulo |𝒮1|.)

Proof.

For three distinct indices i, i, and i′′, we have that iii′′ if one of the following sequences of inequalities holds: i<i<i′′, or i′′<i<i, or i<i′′<i, i.e., there exists a boundary point on P such that a clockwise traversal of the boundary starting at this point reaches the bottom points of the windows in the order Ci, Ci, Ci′′​.

Assume that there are indices i1j1i2j2i1j1 such that Ts1 intersects Ci1 and Ci2, but not Cj1 and Cj2, and Ts1 intersects Cj1 and Cj2, but not Ci1 and Ci2. Consider the polygonal chain defined by the part of Ci1 between its bottom point and its intersection with Ts1, the part of Ts1 until its intersection with Ci2, and the part of Ci2 until its top point; see Figure 3. This chain separates P into two regions. By definition, s lies in one of these regions Ps. As Ts1 does not visit Cj1, the window Cj1 lies in the other region, P¯s=PPs. Let P^sP¯s be the region enclosed by Ci1, Ci2, Ts1, and, if Ci1 and Ci2 do not intersect, possibly part of the polygon boundary; see Figure 3(b). The region P^s may be empty; see Figure 3(a) for such an example. Since s lies outside the visibility polygons associated to the four windows we consider, s either lies in Ps or in P^s.

If s lies in Ps, then Ts1 has to cross Ci1 or Ci2 in order to visit Cj1, contradicting the stated assumptions; see Figures 3(a) and (b). If s lies in P^s, then in order for Ts1 to visit Cj2, it must cross the boundary of P^s, again contradicting our stated assumptions. Hence, Ts1 (and Ts1) visits an ordered subsequence of the windows as stated. The previous lemma gives us an immediate algorithm to compute Ts1 and Ts1. By trying every index pair 0i,j|𝒮1|1, computing the shortest route starting at s that visits the windows Ci,Ci+1,,Cj1 and the shortest route starting at s that visits the windows Cj,Cj+1,,Ci1, indices always taken modulo |𝒮1|, and selecting the min-max shortest pair of these, we obtain the two desired routes Vs1=Ts1 and Vs1=Ts1. There are O(m2) index pairs, and computing the shortest route takes O(m3n) for each of these pair, as described in Section 2. Thus, the time complexity is bounded by O(m5n). We state this result as a theorem.

Theorem 3.

The shortest min-max pair of routes in P that see the points in 𝒮1 can be computed in O(m5n) time under the assumption that they do not intersect.

3.2 Handling the Points in 𝓢𝟐

Let Csi and Csi​ be the windows of VP(pi) that tspi and tspi reach, respectively. If CsiCsi, then pi belongs to the set 𝒮2. The visibility polygon VP(pi) must intersect the shortest path SP(s,s) since the starting points lie in different components of PVP(pi). Our objective in this section is to show how to compute two routes Vsε and Vsε of almost optimal min-max length such that they together see all the points in 𝒮2.

First, we introduce a concept that we will use extensively in the sequel. Let L be some length LSP(s,s). If pL is the point at distance L from s on SP(s,s), we can trace the geodesic quarter circle QU of radius L upwards from pL, the connected locus of points having shortest paths in P of length L to s, ending the trace if it encounters the polygon boundary. Similarly, we can trace the geodesic quarter circle QD of radius L downwards from pL; see Figure 4(a). Define HsL=QUQD as the geodesic half circle of radius L from s. We call the region FsL={SP(s,p)pHsL} that is bounded by QUQD and the two shortest paths from s to the endpoints of HsL the funnel from s of radius L. We symmetrically define the geodesic half circle HsL and the funnel FsL from s of radius L.

Figure 4: (a) Illustrating the definition of a funnel. (b) Illustrating the proof of Lemma 4.

Recall that tminpi=arg min{tspi,tspi} is the shorter of the two paths from s and s to the visibility polygon VP(pi), for every point pi𝒮. Let B=maxpi𝒮2{tminpi} be the longest among all such paths for the points in 𝒮2, and let FsB and FsB be the funnels of radius B from s and s​, respectively. We can show that for every point pi𝒮2, one of its windows Csi, Csi intersects the funnel (of radius B) from the corresponding starting point.

Lemma 4.

For any point pi𝒮2, either VP(pi)FsB or VP(pi)FsB.

Proof.

Consider the point pi𝒮2. Both windows Csi and Csi of VP(pi) intersect SP(s,s). Without loss of generality assume that tspi=tminpi, the other case is proved in the same way.

If Csi intersects the subpath SP(s,pB), where pB is the point at distance B from s along SP(s,s), then Csi intersects the funnel FsB and the lemma holds. If Csi does not intersect the subpath SP(s,pB), then it intersects the subpath SP(s,pB) at px; see Figure 4(b). The pseudotriangle bounded by tspi, Csi, and SP(s,px) must have an acute angle at px, since the angle between tspi and Csi is right or obtuse. Therefore, Csi must intersect the geodesic half circle HsB, since tspiB and tspi is a subpath of one of the paths FsB={SP(s,p)pHsB}, hence VP(pi) intersects FsB also in this case. Next, we compute an initial solution for which we can bound the min-max length. Let 𝒮sstd and 𝒮sstd be a partitioning of the points in 𝒮2 that we obtain as follows. If for a point pi𝒮2 tspitspi, then pi belongs to 𝒮sstd, otherwise pi belongs to 𝒮sstd​. We call this the standard partitioning of the points in 𝒮2. It follows from Lemma 4 that each visibility polygon VP(pi), for every pi𝒮2, is at distance at most B from one of s or s​.

Let Vsstd and Vsstd be the two shortest routes that see the points in 𝒮sstd and 𝒮sstd, respectively, that we can compute with the modified method of Tan and Jiang [11].

Lemma 5.

The length of the two routes Vsstd and Vsstd is bounded by

max{Vsstd,Vsstd}(1+π2)OPT.

Proof.

Consider the boundary of the funnel FsB​. It consists of two paths of length B and a sequence of connecting arcs of circles having radius at most B; the sum of their lengths is bounded by πB. The perimeter is a route that intersects all the visibility polygons of the points in 𝒮sstd. Since Vsstd is the shortest route that intersects these visibility polygons, its length is bounded by (2+π)B. The length of the perimeter of FsB is bounded in the same way and since OPT2B, the lemma follows. Next, we improve on the previous result by updating the standard partitioning and obtain a (1+ε)-approximation, for any ε>0. We consider ε to be a constant, sufficiently small, and define the integer k=69/ε.

We partition the points into two sets in such a way that for each point the shortest path from the corresponding starting point is within a (1+ε) factor from the optimum. In order to do this, we make a decomposition of the points in 𝒮2 into few subsets such that those points for which their corresponding windows are “similar” are placed in the same subset. By then choosing one representative point from each subset, we can compute the optimal partition of them using brute force, since there are only a few points to partition. The partition of the representative points indicates in which partition each similar point should be in. Once the partition for the full set of points has been computed, we can compute the two shortest watchman routes using the algorithm described in Section 2. We provide the details of the construction below.

For any point pi𝒮2 where tmaxpi>3B, we can immediately assume that pi must be seen by the route from the starting point for which the geodesic is shorter. Otherwise, OPT>6B, as the optimal route must at least be as long as the geodesic tmaxpi, followed to VP(pi) and back. In this case, the standard partitioning together with the optimal routes for 𝒮1, i.e., the solution (Vs1Vsstd,Vs1Vsstd) gives at worst a 2-approximation to our problem, since max{Vsstd,Vsstd}(2+π)B<6BOPT. Let 𝒮2L be the subset of the points in 𝒮2 for which tmaxpi is “too long”, in particular, tmaxpi>3B, and assume they are partitioned according to the starting point of their shorter geodesic tminpi. Furthermore, let 𝒮2S=𝒮2𝒮2L be the remaining points in 𝒮2 for which tmaxpi is “short”. It remains to find an appropriate partition of the points in 𝒮2S. To do this, we define a refinement of the funnel, and partition it into k2 cells.

Define r=defmin{3B,SP(s,s)/2}. For the points pi𝒮2S, we have tmaxpir by definition, giving us that tspi,tspir. Let Fsr and Fsr be the two funnels of radius r from s and s, respectively.

We make a similarity decomposition of the set of points in 𝒮2S into at most k4 distinct subsets 𝒮2(1),𝒮2(2),,𝒮2(k4) as follows. Hsr is the geodesic half circle of radius r centered at s; see Figure 5(a). Consider the k+1 consecutive equidistant points hj, for 0jk, along Hsr, h0 and hk being the two endpoints of Hsr. The points of Fsr between the two geodesics SP(s,hj1) and SP(s,hj), for each 1jk, define a subfunnel of Fsr, denoted Fsr(j), lightly shaded in Figure 5(a). We can further decompose each subfunnel Fsr(j) into k cells csj,j={pFsr(j)|r(j1)/k<SP(s,p)rj/k}, for 1jk, depending on the distance to s. A cell csj,j is more heavily shaded in Figure 5(a). The funnel Fsr thus decomposes into k2 cells. Similarly, we decompose the funnel Fsr into k2 cells csj,j, for 1j,jk.

Figure 5: (a) Description of the cells in the similarity decomposition. (b)-(c) Construction of Vsε (blue) from Vsx (dashed blue).

We say that a window Csi belongs to cell csj,j if the intersection point of tspi and Csi is a point in the cell csj,j. The point pi𝒮2S lies in the subset 𝒮2(κ) if Csi belongs to csjs,js​, Csi belongs to csjs,js​, and κ=js+(js1)k+(js1)k2+(js1)k3​. In this way we have partitioned all the points in 𝒮2S into at most k4 distinct subsets.

For each non-empty subset, we select one point as the representative for the subset and let 𝒮2S be the set of all the chosen representative points. By trying all 2||2k4 partitions of the representative points of into two subsets, we compute the two shortest tours Vsx and Vsx that visit the visibility polygons of the points in 𝒮2L, over all possible partitions of .

Let Vsref and Vsref be the two shortest routes obtained from the partition given by placing each point in a subset 𝒮2(κ) in the same partition as the representative point of this subset. The two routes can be computed in O(m3n) time. To bound the lengths of Vsref andVsref, we introduce two auxiliary routes Vsε and Vsε that are easier to bound and prove that Vsref and Vsref are not longer than Vsε and Vsε, respectively.

Let d=max{Vsx,Vsx}. We construct the route Vsε from Vsx as follows (Vsε is constructed from Vsx in the same way). Let dmax be the supremum value for which the geodesic half circle Hsdmax intersects Vsx​, i.e., dmax=supL>0{HsLVsx}. Let p be a point of contact between Hsdmax and a convex vertex of Vsx; see Figure 5(b). From p follow Vsx in counterclockwise order until a reflex vertex v0 of Vsx is encountered. From p now follow Vsx in clockwise order until a reflex vertex vl+1 of Vsx is encountered, where l is the number of convex vertices on the clockwise path of Vsx from v0 to vl+1. Let pdmax be the point of intersection of Hsdmax and SP(s,s) and let θ be the angle between the tangent of Hsdmax at pdmax and the x-axis. For simplicity of construction, assume P​, Fsdmax, and Vsx to be rotated so that θ=π/2, i.e., the tangent of Hsdmax at pdmax is vertical. Let vl, for some 1ll, be the vertex of Vsx such that the edges [vl1,vl] and [vl,vl+1] lie on the same side of a vertical line through vl, i.e., the rightmost vertex of Vsx, if s lies locally to the left and s lies locally to the right of pdmax. For some 1lUl, assume the edges [vλ1,vλ] have non-negative slope, for all 1λlU. Similarly, for some llDl, assume the edges [vλ,vλ+1] have non-positive slope, for all lDλl. Let the clockwise subpath from s to vlU of Vsx also be the first part of Vsε. Add a vertical edge of length (5r+4d)/k at vlU upward to a new vertex vlU and a vertical edge of length (5r+4d)/k at vlD downward to a new vertex vlD′′. While lUλ<lD, the segment [vλ,vλ+1] has slope angle θλ, and we offset the segment by a distance (5r+4d)/k in the direction θλ+π/2 (increasing angles going clockwise around a circle), which gives the segment [vλ′′,vλ+1]; see Figures 5(b) and (c). We connect vλ with vλ′′ by a circle arc with origin vλ and radius (5r+4d)/k, for each lUλlD and finally connect vlD back to s with the corresponding subpath of Vsx; again see Figures 5(b) and (c). If at some point the construction intersects the polygon boundary we shortcut the path so that it is the shortest to connect to in the free space of the polygon. We show that (Vsε,Vsε) sees all points in 𝒮2 and bound the min-max length.

Lemma 6.

The two-watchman route (Vsε,Vsε) sees all points in 𝒮2 and

max{Vsε,Vsε}d+30r+24dk.

Proof.

Recall that (Ts,Ts) is an optimal min-max solution to the shortest two-watchman route problem for the points in 𝒮, and let (Ts2,Ts2) be an optimal min-max solution for the points in 𝒮2. Since (Vsx,Vsx) is an optimal min-max solution for the problem on the points in 𝒮2L𝒮2, it follows that VsxTs2TsOPT and VsxTs2TsOPT, whereby dOPT.

Let pi be a point in 𝒮2(κ), for some κ, 1κk4, and assume that Vsx sees pi. This implies that Vsx intersects the window Csi at some point p. Consider any other point pj in the same subset 𝒮2(κ) as pi. Since the endpoints of tspi and tspj lie in the same cell, the angle between the windows Csi and Csj is at most π/k and the distance between the two windows within the cell is at most (1+π)r/k as this is an upper bound on the farthest distance between any two points in a cell (the height of the cell plus the width of the cell); see Figure 6. Let p^i be the endpoint of tspi intersecting the window Csi. Thus, the distance from p to Csj is bounded by

p,Csj(1+π)rk+p^i,psinπk(1+π)rk+dπk<5r+4dk.
Figure 6: Bounding the distance between Csi and Csj at p.

Hence, if Vsx sees pi, then Vsε sees all points in 𝒮2(κ) as pj was chosen arbitrarily in 𝒮2(κ)​. We can argue the other possibility when Vsx sees pi in the same way and therefore, since Vsx and Vsx see all representative points in , Vsε and Vsε together see all points in 𝒮2.

It remains to bound the lengths of Vsε and Vsε. We do this only for Vsε as the argument for Vsε is the same. Vsε consists of translated segments from Vsx (recall that Vsxd), two additional segments of length (5r+4d)/k, and circular arcs, also of radius (5r+4d)/k, where the angle sum is at most π; see Figures 5(b) and (c). The total length of Vsε is therefore bounded by

VsεVsx+2(5r+4d)k+π(5r+4d)kd+30r+24dk,

as claimed.

We summarize the results on handling the points in 𝒮2.

Theorem 7.

The pair of watchman routes (Vsref,Vsref), that see the points in 𝒮2, can be computed in O(m3n) time, and has length bounded by

max{Vsref,Vsref}(1+ε)OPT.

Proof.

By construction, the routes Vsref and Vsref visit the same windows as the routes Vsε and Vsε  respectively. As Vsref and Vsref are the shortest routes that visit the windows in this way, VsrefVsε and VsrefVsε. Since r3B3OPT/2 and dOPT, we obtain

max{Vsref,Vsref} max{Vsε,Vsε}d+30r+24dkOPT+45OPT+24OPTk
(1+69k)OPT(1+ε)OPT

by our choice of k. Moreover, we can compute Vsref and Vsref in O(m3n) time, as mentioned in Section 2.

3.3 Putting It All Together

Finally, we chose the shortest two routes among the possible pairs: a watchman route Ws starting at s and a stationary watchman at s; a watchman route Ws starting at s and a stationary watchman at s; and the combined watchman routes Vs1Vsε and Vs1Vsε, where Vs1 and Vs1 are the two routes that see the points in 𝒮1 as defined in Section 3.1, and Vsε and Vsε are the improved routes that see the points in 𝒮2 as computed in Section 3.2. Let

(Vs,Vs)=arg min{max{Ws,s},max{s,Ws},max{Vs1Vsε,Vs1Vsε}}.

By combining the algorithms developed in Sections 3.1 and 3.2 together with the bounds in Theorems 3 and 7, we immediately have the following theorem. Since ε is considered to be a constant, it does not affect the total running time.

Theorem 8.

The two routes Vs and Vs see all points in 𝒮, can be computed in O(m5n) time, and

max{Vs,Vs}(2+ε)OPT,

for any fixed constant ε>0.

We remark that the two routes Vs and Vs given by

(Vs,Vs)=arg min{max{Ws,s},max{s,Ws},max{Vs1Vsstd,Vs1Vsstd}}

using the standard partitioning instead of the improved partitioning can be computed in O(m5n) time, have a min-max length bound of (2+π/2)OPT, but do not require exhaustive search to find the correct partition of the representative points in set .

4 Computing the Shortest Watchman Routes That See All of 𝑷

We can generalize the method obtained in Section 3 to find two watchman routes (Vs,Vs) that together see the whole polygon P​. We assume that the two optimal routes Ts and Ts for Problem 2 do not intersect, as otherwise a shortest watchman route Ws starting at s, or a shortest watchman route Ws starting at s, together with a route of length 0 at the respective other starting point, gives a 2-approximation (as explained in Step 1 in Section 3).

We carefully choose a set 𝒮 of O(n) points along the boundary of P with the property that whenever Vs and Vs see these points, they see all of the boundary of P​, and for two watchmen, this is enough to see the polygon.

Theorem 9 (Lemma 3.1 in [8]).

If two watchmen together see all of the boundary of a polygon P​, then they see all of P​.

Consider a point p on the boundary of P that is not seen from s or s​, and let VP(p) be the visibility polygon of p. We use the notation Psp to denote the subpolygon in PVP(p) that contains s, and Psp to denote the subpolygon in PVP(p) that contains s​. Analogous to before, we call the edge Csp=VP(p)Psp the window of p with respect to s, and the edge Csp=VP(p)Psp the window of p with respect to s​.

We want to see every point on the boundary. To be able to apply the strategy from Section 3, we start by defining two infinite sets 𝒮1 and 𝒮2, and allocate every boundary point into one of them based on the windows of it. Let 𝒮1 be the set of boundary points for which Csp=Csp, and let 𝒮2 be the remaining set of boundary points. This partitions every polygon edge into intervals of points that lie in the same set, 𝒮1 or 𝒮2. We call such an interval a subedge and denote the set of subedges with points in 𝒮1 by 1 and the set of subedges with points in 𝒮2 by 2. The endpoints of the subedges are either vertices of P​, i.e., points in 𝒱, or interior points of the edges. We call these interior points transition points, and denote the set of all transition points by 𝒯​. Observe that each transition point is defined by one of the following:

  • The intersection of the polygon boundary with a line through two polygon vertices

  • A vertex of the visibility polygons VP(s) and VP(s)

We can trivially construct the arrangement of lines through polygon vertices in O(n4) time, using a brute-force algorithm. This arrangement has complexity O(n2), and the polygon consists of n edges. Thus, the intersection points of the arrangement and the polygon edges can be computed in O(n3) time. The visibility polygon of a point in a polygon can be computed in O(n) time, see [5]. With this, 𝒯 can be computed in O(n4) time (note that this is not optimal, but does not affect the final complexity of our algorithm).

The visibility polygon of every point in 𝒮2 intersects the shortest path between the two starting points SP(s,s). Conversely, the visibility polygon of any point in 𝒮1 cannot intersect SP(s,s). As the area seen by a point that moves along a polygon boundary edge changes continuously, we observe the following.

Lemma 10.

If w and w are two points in 𝒮2 that lie on the same edge of P then, every point between w and w is also in 𝒮2.

Proof.

Assume for a contradiction that there exists a point p in the interior of ww that lies in 𝒮1. Then, the shortest path SP(s,s) between the starting points lies fully inside Psp=Psp. Let v be the vertex endpoint on Csp that is closest to p, and consider the segment pv. This segment splits P into two subpolygons, one containing w and one containing w​. Assume w.l.o.g. that the subpolygon P~ that contains w does not contain Psp, see Figure 7(a). Then, VP(w)SP(s,s)=, since no ray emanating from w can intersect both pv and Csp except at v and w then belongs to 𝒮1, a contradiction.

Figure 7: (a) Illustrating the proof of Lemma 10. (b) Determining the split point of a subedge in 1.

Thus, every edge contains at most one subedge in 2 and at most two subedges in 1, and there is at most a linear number of transition points.

To see the polygon boundary, we need to ensure that every subedge is seen. In a first step, we apply the strategy from Section 3 to 𝒯𝒱. This ensures that all points in 𝒯𝒱 are seen. To do so, we partition the points in 𝒱 into two sets 𝒱1=𝒱𝒮1 and 𝒱2=𝒱𝒮2, and consider the two discrete, linear-sized sets, 𝒮~1=𝒱1𝒯 and 𝒮~2=𝒱2𝒯​. We take care of the subedges in 1 and 2 separately. By adding the transition points to both sets 𝒮~1 and 𝒮~2, we ensure that the endpoints of each subedge in 1 lie in 𝒮~1, and the endpoints of each subedge in 2 lie in 𝒮~2.

Again, our goal is to take care of each subedge separately. We assign a direction to Csp so that VP(p) lies locally to the left of Csp​, if the polygon is rotated so that the window is directed upwards. The shortest path tsp that visits Csp is fully contained in the subpolygon Psp​, and visits Csp locally from the right. We analogously assign a direction to Csp.

We refine our set of subedges by splitting every subedge in 1 into segments that we call fragments such that for every point on a fragment, the windows of the points have the same orientation, either towards the subedge or away from the subedge.

Lemma 11.

Every subedge ww in 1 is split into at most two fragments, that is, a transition between points with windows of different orientations happens at most once when sliding along ww.

Proof.

Consider the path SP(s,w). Extending the first segment of SP(s,w) (adjacent to s) backwards until it hits the boundary of P gives us a shortest path Π connecting two boundary points of P. The path Π separates P into two simply connected polygons P+ and P​, P+ lying locally to the left of (or on) Π as we move from s towards w along Π and P lying locally to the right of (or on) Π as we move from s towards w. Assume, without loss of generality, that the farthest endpoint qw of Csw lies in P​, otherwise we reverse the roles of P+ and P​. An illustration is given in Figure 7(b). The point qw is a bottom or top point of Csw​. Let p be a point that moves from w to w along the subedge and consider the window Csp​. As p moves from w to w, the corresponding top (bottom) point qp of the window Csp traverses the polygon boundary in P​. If Csp aligns with a segment of Π at p=p​, the point qp moves from P to P+ and Csp flips its orientation, qp goes from being a bottom (top) point in the open ended interval wp to being a top (bottom) point in the open ended interval pw​. We call such a point p a split point. Since Π is a shortest path, the alignment of Csp and a segment of Π can occur only once. Hence, every subedge is split into at most two fragments at a split point.

For an edge ww, the split point is given by the intersection of the polygon boundary and a line through two polygon vertices, and can therefore be computed in the same way as the transition points. We replace the subedge in 1 by these fragments, add the split points to 𝒯​, and update 𝒮~1 and 𝒮~2 accordingly.

With this modification, we handle the points in 𝒮~1 in the same way as described in Section 3.1, and obtain the two routes Vs1 and Vs1. The following Lemma guarantees that every subedge in 1 is seen.

Lemma 12.

Let ww be a fragment in 1. Either Vs1 or Vs1 sees all of ww​.

Proof.

Since w and w lie on the same fragment of 1, one of the two subpolygons Psw,Psw is fully contained in the other, say w.l.o.g. PswPsw. The situation is as depicted in Figure 7(b), with w at p. Thus, if Vs1 visits Csw to see w, it also visits Csw​​​, and since ww is part of a polygon edge, Vs1 sees every point on ww​. The case for Vs1 is analogous.

Next, we handle the points in 𝒮~2 as described in Section 3.2 by computing the standard partitioning of the points. We make use of the following lemma.

Lemma 13 (Lemma 4.1 in [8]).

For a subedge ww2, if a watchman sees w and w then it sees the whole subedge ww.

Thus, only those subedges in 2 where each endpoint is seen by a different watchman, meaning that its two endpoints are separated in the standard partitioning, are not yet seen. Let 2diff be the set of these subedges. For our approximate solution, we aim to find a good way for both watchmen to cooperatively guard the edges in 2diff. To do so, we refine our discretization by splitting every subedge in 2diff into two, and let each watchman guard one of the resulting subedges.

For each subedge ww in 2diff​, we compute the point p on ww for which both watchmen have an equal distance from their starting point to the window of p’s visibility polygon, i.e., tsp=tsp, see Figure 8.

Figure 8: Splitting ww at p where tsp=tsp.

Then, we replace ww with wp and pw. This can be done in O(n) time per subedge, using the strategy described in [8]. We also add p to a third set of points 𝒮~3, and modify the partitioning of 𝒮~2 by adding all points in 𝒮~3 to both partitions. With this, we simultaneously partition the subedges in 2diff based on their endpoints. Finally, we compute the shortest watchman routes (Vsstd,Vsstd) for this new set of points. The two endpoints of a subedge ww2diff are seen by the same watchman. Hence, by Lemma 13, the whole subedge is seen.

Furthermore, recall that we construct the standard partitioning by assigning every point to a starting point based on its distance to the starting point. Putting the points in 𝒮~3 into both partitions does not contradict the bound B=maxp𝒮~2𝒮~3min{tsp,tsp} on the maximum length within each partition, since for every point p𝒮~3, min{tsp,tsp}=tsp=tspB. Therefore, the bound of Lemma 5 also holds for the modified set 𝒮~2, hence we get

max{Vsstd,Vsstd}(1+π2)OPT.

Finally, as in Section 3.3, we choose the shortest set of watchman routes as our solution

(Vs,Vs)=arg min{max{Ws,s},max{s,Ws},max{Vs1Vsstd,Vs1Vsstd}}.

Since the set 𝒯 contains at most O(n) points, we obtain a set of two watchman routes for P of length at most (2+π/2)OPT in O(n6) time.

Theorem 14.

The two routes Vs and Vs see all of P​, can be computed in O(n6) time, and

max{Vs,Vs}(2+π2)OPT.

5 Adaptations for the Floating Variant

Nilsson and Packer [8] show how to compute two points s and s having the property that: for any point p on the boundary of P​, the shortest of the paths tsp and tsp has length bounded by OPTF/2, where OPTF is the min-max length of the optimum floating two-watchman route. Recall that in Section 4, we defined a set of points 𝒯 on the boundary. Therefore, for the two points s and s, the stated property holds in particular for the points in 𝒯​. The computation of s and s takes O(n8) time.

Using the method derived in Section 4, we split the points in 𝒯 into 𝒮1 and 𝒮2 and can obtain a pair of watchman routes VF and VF through the points s and s, respectively, in additional O(n6) time. These two routes consist of two subroutes VF=Vs1Vsstd and VF=Vs1Vsstd, where Vs1 and Vs1 see the points in 𝒮1, and the subroutes Vsstd and Vsstd see the points in 𝒮2. The length of each of Vs1 and Vs1 is bounded by 2OPTF​​, since the optimal routes are not guaranteed to pass through s and s but there is some point on each of the two optimal routes at a distance at most OPTF/2 from s and s, respectively. The length of Vsstd and Vsstd is bounded by the length of the perimeter of its funnel, i.e., (1+π/2)OPTF​; see Lemma 5. We therefore conclude

Corollary 15.

For a polygon P​, the pair (VF,VF) of watchman routes that see all of P can be computed in O(n8) time, and

max{VF,VF}(3+π2)OPTF,

where OPTF is the maximum length of an optimal pair of watchman routes for the floating two-watchman route problem in P​.

6 Conclusion

We have addressed the two-watchman route problem in simple polygons by providing an approximation algorithm that is based on a discretization of the polygon boundary. The hardness in finding a good solution lies in determining a partition of the polygon boundary pieces into two subsets, such that each piece is seen by one of the two watchmen. For more than two watchmen, to see a discrete point set, a generalization of our partitioning scheme could be a promising strategy. However, to see the whole polygon with three (or more) watchmen, seeing the polygon boundary is not sufficient. Obtaining such approximation algorithms therefore requires different methods.

Since optimal watchman routes for the min-sum objective behave differently than for the min-max objective, our strategy does not apply, except for the crude observation that the longest of two min-max optimal routes is at most as long as the longest of two min-sum optimal routes. This adds a multiplicative factor of 2 on our results for the min-max measure, giving an approximation factor of 7.142 for the anchored version, and a factor of 9.142 for the floating version – better than the currently best known factors of 13.844 for the anchored version and 11.939 for the floating version [8]. Nilsson and Packer’s approximation factor for the anchored version is larger than for the floating version as their anchored routes result from enforcing the floating routes to pass through the starting points, while in our algorithms the anchored routes are constructed from the starting points. Finally, the computational complexity of the min-sum two-watchman route problem in simple polygons remains open.

References

  • [1] Svante Carlsson and Håkan Jonsson. Guarding a treasury. In Proceedings of the 5th Canadian Conference on Computational Geometry, Waterloo, Ontario, Canada, pages 85–90. University of Waterloo, 1993.
  • [2] Wei-pang Chin and Simeon C. Ntafos. Optimum watchman routes. Inf. Process. Lett., 28(1):39–44, 1988. doi:10.1016/0020-0190(88)90141-X.
  • [3] Wei-pang Chin and Simeon C. Ntafos. Shortest watchman routes in simple polygons. Discr. Comput. Geom., 6:9–31, 1991. doi:10.1007/BF02574671.
  • [4] Linda L. Deneen and Shashikant Joshi. Treasures in an art gallery. In Proceedings of the 4th Canadian Conference on Computational Geometry, St. John’s, Newfoundland, Canada, pages 17–22. Memorial University of Newfoundland, 1992.
  • [5] Barry Joe and R. B. Simpson. Corrections to Lee’s visibility polygon algorithm. BIT, 27(4):458–473, 1987. doi:10.1007/BF01937271.
  • [6] Richard M. Karp. Reducibility among combinatorial problems. In Raymond E. Miller and James W. Thatcher, editors, Proceedings of a symposium on the Complexity of Computer Computations, held March 20-22, 1972, at the IBM Thomas J. Watson Research Center, Yorktown Heights, New York, USA, The IBM Research Symposia Series, pages 85–103. Plenum Press, New York, 1972. doi:10.1007/978-1-4684-2001-2_9.
  • [7] Joseph S. B. Mitchell and Erik L. Wynters. Watchman routes for multiple guards. In Proceedings of the 3rd Canadian Conference on Computational Geometry, pages 126–129, 1991.
  • [8] Bengt J. Nilsson and Eli Packer. Approximation algorithms for the two-watchman route in a simple polygon. Algorithmica, 86(9):2845–2884, 2024. doi:10.1007/S00453-024-01245-0.
  • [9] Xuehou Tan. Fast computation of shortest watchman routes in simple polygons. Inf. Process. Lett., 77(1):27–33, 2001. doi:10.1016/S0020-0190(00)00146-0.
  • [10] Xuehou Tan, Tomio Hirata, and Yasuyoshi Inagaki. Corrigendum to "An Incremental Algorithm for Constructing Shortest Watchman Routes". Int. J. Comput. Geom. Appl., 9(3):319–323, 1999. doi:10.1142/S0218195999000212.
  • [11] Xuehou Tan and Bo Jiang. Efficient algorithms for touring a sequence of convex polygons and related problems. In Proceedings of Theory and Applications of Models of Computation, TAMC 2017, pages 614–627. Springer Verlag, Lecture Notes in Computer Science 10185, 2017. doi:10.1007/978-3-319-55911-7_44.