Sweeping a Domain with Line-Of-Sight Between Covisible Agents
Abstract
We consider sweeping a polygonal domain using variable-length segments whose endpoints can be considered to be mobile agents moving with bounded speeds; a point in the domain is swept when it belongs to one of the segments. The objective is to sweep the domain as quickly as possible. We show that the problem is NP-hard even in simple polygons and even for a single segment (two agents), and give constant-factor approximation algorithms, both for simple polygons and polygons with holes.
Our approximations are obtained by introducing a new type of “window partition” of the polygon, which may find other applications. For domains with holes, our results are based on a non-trivial topological argument proving a surprising fact: a connected subset of the domain, whose points are swept but not directly touched by the agents, may contain at most one hole.
Keywords and phrases:
Polygon sweeping, collaborating agents, motion coordination, makespan optimizationCopyright and License:
2012 ACM Subject Classification:
Theory of computation Design and analysis of algorithmsAcknowledgements:
We thank the anonymous reviewers for their helpful comments.Funding:
This work is partially supported by the Swedish Research Council and the Swedish Transport Administration.Editors:
Pat Morin and Eunjin OhSeries and Publisher:
Leibniz International Proceedings in Informatics, Schloss Dagstuhl – Leibniz-Zentrum für Informatik
1 Introduction
We study sweeping a polygonal domain using mobile line segments whose lengths can change. Consider agents starting at a given point (the depot or the base, or the door through which the agents enter) on the boundary of a polygonal domain . Each agent moves within , with maximum speed 1. (We do not impose an acceleration bound.) The agents form pairs and each pair defines a sweeping segment whenever the agents see one another; when this is the case, the points along the segment are seen by both agents, and we say that the points of the segment have been swept. The goal is to compute motions (trajectories) for the agents, such that all of is swept and the agents return to the depot as soon as possible, i.e., minimizing the makespan of the sweep, or the time when the agents return to the base after all points of are swept. See Figure 1 and videos [1, 2].
Search and surveillance are recurring applications of computational geometry: sweeping geometric domains is both a fundamental (in particular, minimum-length sweeping with a line is Problem CG-Open26 in the complexity class compendium [34]) and a practical (e.g., shaving is sweeping the skin area with a segment) problem, which has been studied for decades. Sweeping with a disk or a square is known as milling/lawnmowing [8, 5, 18], and sweeping with a visibility polygon of a mobile observer(s) is the watchman route problem (WRP) [29, 30, 10]. Both in WRP and in our problem, the sweep can catch (see) any static target in , while a mobile target can escape being seen. This is different from, perhaps, a more standard notion of sweeping (by agents with no speed bounds), which ensures that swept points cannot be “recontaminated”: here, the archetypal problem is 2-walkability [21, 17, 9, 37] (Can 2 guards sweep a simple polygon by walking along its boundary while always seeing each other?), which was generalized to sweeping with a curve [25, 28, 33] and a chain of guards [12], also in terrains [13, 14]. (Problems in which the target, usually non-static, needs to be “touched,” not only seen, in order to be caught, are known as pursuit-evasion games, cops and robbers, lion and man, etc. [36, 16, 22, 26, 23, 24, 32, 11, 3].) Sweeping problems may be viewed as far-going extensions of computing the Frechét distance [4] – a classical motion coordination problem. Our solutions apply also to the Laser Tripwire Sensor Deployment for indoor localization and tracking (tripwire localization methods are common and well studied [27, 6]): suppose you have 2 robots that want to deploy a set of tripwire sensors (pairs of points that see each other) – the robots stop every so often (at step length ) to place the pairs of sensors, and the goal is to complete the deployment as soon as possible.
Our Contributions
We formulate and give the first study of the algorithmic complexity and approximation of the sweeping problem with variable-length line segment(s):
-
Problem 1. Given a polygonal domain , an agent depot , and pairs of agents: find a motion plan to sweep all points in and minimize the total time (makespan). Here, each pair of agents have to be covisible at all times (the line segment connecting the pair must stay within ). We call this the “unbreakable” constraint. This problem has two versions:
-
–
SweepWithReturn: The agents have to return to (we call this the default version).
-
–
SweepWithNoReturn: The agents can end anywhere in .
-
–
-
Problem 2. The setting and objective are similar to Problem 1. However, in this problem, we do not require the agents to always be covisible but they can only sweep something in if they become covisible. In addition, the agents themselves also need to stay within . We call this the BreakableSegmentSweeping problem.
The results in this paper can be seen as contributing to the broader class of optimal coordinated motion planning problems involving mobile agents moving within a domain, with constraints (e.g., covisibility), and an objective to accomplish a covering task.
Specifically,
-
Section 2 provides a proof of NP-hardness (from 3-Partition) for all versions, even in the case of an orthogonal, -monotone simple polygon (and even if the sweeping segment is required to be vertical at all times).
-
Section 3 presents a constant-factor approximation for sweeping simple polygons for Problem 1. Our main technical contribution is the solution for the case of segment, based on a “window” partition of that we work out specifically for our purposes (we believe the worked-out decomposition may find also other applications, e.g., when considering similar search problems in terrains); the solution for (Section 3.2) is obtained by assigning different parts of to be swept by different pairs of agents.
-
In Section 4 the approximation for 1 segment is extended to polygons with holes. The algorithm is simple: turn the domain into a simple polygon by bridging together the holes and the outer boundary of the domain; then apply the algorithm for simple polygons. However, proving that this is an -approximation (i.e., giving a lower bound) is highly non-trivial (and crucially uses the fact that the segment is unbreakable). We leave open sweeping with segments in polygons with holes.
-
Section 5 considers Problem 2. We prove that in a simple polygon relaxing the covisibility constraint does not improve the makespan by more than a factor of 2, and we show that this bound is tight; thus, our constant-factor approximation algorithm for the unbreakable case applies for the breakable case as well. (We note that our NP-hardness proof (Section 2) for unbreakable sweeping of a simple polygon applies as well to breakable sweeping of .) In the case that has holes, we give a polylog approximation algorithm in the special case that is a polyomino and we sweep with a vertical segment.
2 NP-Hardness
We show that even in the very special case of sweeping an orthogonal, monotone simple polygon with 2 agents and , computing an optimal sweeping schedule is strongly NP-hard. This is in contrast with sweeping a simple polygon with a visibility polygon (WRP), which has a polynomial-time exact algorithm [30, 10], and the sweeping of a simple polygon with a disk or square (the milling problem), which is conjectured to have a polynomial-time exact algorithm [8], as the closely related problems of determining Hamiltonicity of a simple triangular or square grid graph are decidable in polynomial time [7, 40].
Theorem 1.
It is NP-hard to compute an optimal sweeping for SweepWithNoReturn, even if is an -monotone, orthogonal simple polygon.
Proof.
We first consider the SweepWithNoReturn version where the agents do not have to return to the depot (so we are minimizing the time when the last point of is swept). We then show how to modify the reduction to prove hardness of the SweepWithReturn version in which the agents must return to (and the time of the return defines the makespan). Given an instance of 3-Partition (Can given integers be partitioned into triples with equal sums?), we construct a polygon with vertices, as shown in Figure 2, consisting of a tall and very narrow rectangular room (whose width is exaggerated in the figure, to show details) with a staircase on the right and with two corridors (each of which has length ) extending from the room as shown. The height of the room is where is the target sum in each of the sought triples of the given numbers; the width, , is very small (e.g., ).
The corridors ending with and are very thin and long (). Thus, in any optimal sweeping schedule each of the corridors is swept exactly once: the sweep starts at (by definition) and ends with one of the agents at (recall that for now we do not restrict where the agents are at the conclusion of the sweep). The top of the room has a chimney for each number in the set. The chimneys are very narrow (width ) and chimney has height . Finally, the height of each step in the staircase is .
If the 3-Partition instance is feasible, then can be swept as follows (with both and moving at the maximum, unit speed, and the segment staying vertical throughout the motion): the top agent will visit and ascend chimneys corresponding to triples in the solution. While is in chimney (either ascending or descending), the bottom agent moves down by . After finishes a triple that sums to , has moved down by . (Note that apart from the duration during which the segment sweeps the horizontal corridor, horizontal movements are not particularly relevant for the analysis, since the room is so narrow, and chimneys are even narrower, implying that the sweep segment must be nearly vertical at all times.) Finally, in this first pass, moves all the way to the right, arriving with length so that it is just long enough to sweep the top step of the staircase (including ) without spending further time having agents move vertically. See the left of Figure 2 for an example of this motion to sweep the first step. Next, will move to the left of the polygon and sweep more chimneys before moving back to the right to sweep (Figure 2, right). Such sideways sweeps are repeated until all of the stairs are swept. (Again, all horizontal motion of agents is not relevant to the overall makespan, since left-to-right motions are still much less than length 1.) The time to sweep the room, along with the staircases, is at most . The total time to sweep everything is .
Conversely, suppose the stairs are swept in any other way, then either has to wait for at least a duration of 1 before aligning with a stair tread, or has to waste time by not going into a chimney with a single up-and-down pass. The first case occurs when the agents pick a triplet of chimneys () with a sum larger than , then agent still needs to trace the boundary of the chosen chimneys to sweep them completely. Even if can already reach the depth of the next staircase vertex (say, ), it must still wait for to finish sweeping the last chimney in the triplet so that it can finally move to sweep , which takes longer than . In the second case, the chosen triplet of chimneys has a sum smaller than . In this case, agent will have to wait for agent to reach the depth of the next staircase vertex. This still costs the agents a time of while leaving taller chimneys for other triplets (which leads back to the previous case). Note that there is no reward for to partially sweep a chimney, since must exit the chimney and align vertically with when touches so that the both of them can sweep the vertical edge incident to . Agent can technically move diagonally downward to save time, but in that case, the most it can save is , which is chosen to be much smaller than (so in total it can save at most ).
We now modify the above gadget to show the hardness of our SweepWithReturn version. See Appendix A for the modified gadget. As in the proof for the version without return to , the segment will sweep the top chimneys (solving the 3-Partition) and sweep the convex vertices on the right in parallel. Once the segment is done with the right convex vertices and the top chimneys, the segment sweeps the inverted chimneys (also solving the same 3-Partition instance); each time it sweeps 3 bottom chimneys that make a sum , the segment will retract itself (top endpoint moving down) so that it could reach the convex vertices on the left (). The overall makespan will then be . As in the reduction for the version without return to , any deviation from the described schedule incurs a wait of at least 1 by at least one of the agents.
3 Approximation Algorithm for Simple Polygons
We begin with a simple observation (see Appendix B for the proof):
Lemma 2.
Every convex vertex of must be visited by at least one agent.
We first consider the case when there are two agents, and , starting at the same point : we present an -approximation algorithm to sweep any simple polygon using an unbreakable segment. As with our hardness proof (Section 2), we will first provide algorithmic results for the SweepWithNoReturn version. We show that in linear time, one can find a schedule, for a single unbreakable segment, with makespan where is the optimal makespan. Let denote the Euclidean length of any 1D structure. From Lemma 2,
Lemma 3.
Proof.
By Lemma 2, the union of paths for and visits all convex vertices; thus, the union is at least as long as any path within visiting all convex vertices, implying that the union cannot be shorter than . This is because in a simple polygon, is the shortest tour that visits all convex vertices, and any path that does so must be at least half as long.
Our algorithm partitions the polygon into subpolygons, each of which has a simple sweeping strategy. The dual of the partition is a tree, which allows the line segment to sweep all the subpolygons, traversing the tree recursively.
The details of the partition are as follows. Consider any edge of the polygon. We first compute the histogram polygon with base , , which is defined to be the union of all interior chords perpendicular to and having an endpoint on (a chord is a line segment connecting two points of and stays completely within ). Let be such a chord anchored at . We then compute the visibility polygon of restricted to points that are left of ; call the polygon . Similarly, we compute another visibility polygon to the right of , called . Then, is one subpolygon in our partitioning scheme. See Figure 3 for an example of . Notice that the boundary of includes some new “shadow chords,” each of which becomes a histogram base for subsequent subpolygons in the partition. We will order these chords counterclockwise. The process is complete when every shadow chord that has been generated has been utilized as a histogram base for a subpolygon adjacent to the subpolygon that generated the shadow chord. For the first subpolygon, we will simply use the visibility polygon of . The overall partitioning of can be done in linear time, utilizing a triangulation of (similar to computing window partition trees [35] for link distances in simple polygons).
We now describe the recursive process to sweep a subpolygon and its descendants, for an edge of (refer to Figure 3). The agents start at the endpoint of ; once the process is completed, i.e. when the segment finishes sweeping and its descendants, both agents return to . First, sits at while travels clockwise around the boundary of until reaching ; this way the rotating segment sweeps . Next, is swept by the segment perpendicular to : travels along the top polygonal path of the histogram while moves along ( slows itself in order that remains perpendicular to ). Then, the segment rotates clockwise around to sweep ; at this point is completely swept and the segment will move to the furthest (w.r.t. ) endpoint of the first “shadow chord” (see in Figure 3). After the segment completely sweeps (and its descendants), it will move to the next child of . This will be repeated until all descendants of are swept. Notice that while sweeping the children, the segment will at times move counterclockwise along the boundary of . Once the segment is done with all children of , both of its endpoints will regroup at .
Lemma 4.
The sweeping algorithm above produces a schedule with makespan .
Proof.
We will first perform analysis on any subpolygon other than the root. Without loss of generality, we assume that the segment always starts sweeping from the left vertex of (i.e., in the figure). First, the endpoints sweep by traveling from to , this will incur a cost of . This is because will move along with a speed at most that of . Second, the endpoints travel counterclockwise to visit all children of . The cost of this counterclockwise traversal is at most . Overall, the cost of sweeping and moving counterclockwise to visit all of its children is
where are the portions of that belong to the boundary of , and are the base edges of children of . For the root subpolygon , the cost to sweep it and visit all of its children is at most
Here, is the set of all chords generated and associated with .
Let be the set of all additional chords created during the partition process. The total cost to sweep will be the sum of the two terms above:
We have for each because is an orthogonal projection of onto . Thus overall, the sweeping cost of is at most
The first inequality holds because the portions of each that belong to , i.e. , are pairwise disjoint for different . Thus, . The second inequality follows directly from Lemma 3.
3.1 Sweeping with return (default version)
The algorithm above works also when and must return to . The only modification is that at the end of the schedule, both agents must return to . The analysis remains the same, except that the lower bound of Lemma 3 becomes .
Theorem 5.
A sweeping schedule, for a single unbreakable segment, with makespan can be found in linear time.
3.2 Sweeping with multiple segments with return
Suppose now that we have agents who start and return to the depot (the makespan is when the last agent returns to the depot; for we do not have a solution for the version in which the agents are not required to return to ). Here we have two lower bounds:
-
where is the perimeter – this follows from Lemma 2 (the agents have to visit all convex vertices).
-
Let be the geodesic distance from the depot to the convex vertex furthest from ; then – an agent has to visit this furthest convex vertex and go back to the depot.
Partition into parts as follows: Pick points on the boundary of so that these points, together with , split the boundary of P into parts of equal perimeter. From the depot, draw the geodesic shortest path to each of these points; the paths decompose into subpolygons. (Some subpolygons may have very small areas, since the geodesic paths might collapse onto themselves and share edges.)
Because each drawn shortest path is no longer than , each subpolygon has perimeter at most . We now simply reuse the approximation algorithm for the single segment case: there, the makespan is at most 4 times the perimeter of the polygon, so for segments, the makespan will be .
4 Approximation Algorithm for Polygonal Domains with Holes
If the domain has holes, for sweeping with 1 segment , we can leverage the result for simple polygons from the preceding section, provided we can reduce the multiply connected case to the simply connected case, via an appropriate bridging of holes to each other and to the outer boundary of . The main technical challenge is proving lower bounds (Lemma 10) on that enable this approach to yield the desired result – a constant-factor approximation. The version that we shall describe in this section is SweepWithReturn, but the approximation algorithm will also work for SweepWithNoReturn (with a larger multiplicative factor).
First, we compute an approximation of the minimum Steiner tree, , within that spans all connected components of the boundary of (both the holes and the outer boundary). This can be done using the PTAS in [31]. The computed tree and the boundaries can be viewed as bounding a degenerate simple polygon (these polygons are sometimes called “weakly” simple; the boundary cycle of such polygons may go through some points more than once). In the second phase, we apply the algorithm from Section 3 to compute a sweeping solution for with makespan , where includes the boundaries of the holes and the outer boundary of , as well as the edges of the spanning tree.
To prove a lower bound of on , we will need some definitions. A vertex of is convex or reflex depending on whether its angle interior to is less than or greater than . Note that all vertices of a convex hole are actually reflex vertices of . A maximal reflex chain is a chain on between two consecutive convex vertices; in particular, any edge with two convex endpoints is a maximal reflex chain. Unless otherwise stated, all reflex chains we consider will be maximal reflex chains. Note that a convex hole has no reflex chain.
Given a polygonal domain , a subset is geodesically (or relatively) convex if for any points the shortest - path (within ) lies fully within . The geodesic (or relative) convex hull of a set in is the smallest geodesically convex set containing . We will use GCH as a shorthand for geodesic convex hull. Reflex vertices of the hull are reflex vertices of .
We use obstacle to denote a convex hole or a reflex chain. If we need to indicate that we are working with holes or reflex chains, we will use the specific term for them. We say that a set contains some obstacles , if (This containment definition is relaxed from the usual set inclusion definition: since could be a hole and the interior of it does not belong to , is not actually a superset of ). Similarly, we say is a GCH of some obstacles if is the smallest geodesically convex set containing all of these obstacles. Note that if is a reflex chain and then .
The interior of a GCH needs not to be connected: the boundary of the hull may visit a reflex vertex of more than once (so the GCH is a weakly simple polygon) – at some of the visits is a convex vertex of the hull, while at others it is a reflex vertex (Figure 4, left). When this occurs, we say that the hull collapses onto itself at and is a collapsing vertex. Consider the directed, planar straight-line graph (PSLG) formed by walking around the boundary of a GCH counterclockwise (Figure 4, right). When the GCH collapses, it will form more than one cycle in the PSLG (since at least one vertex is repeated during the walk). A cycle in this graph can be degenerate (i.e. a cycle from to to which has an empty area) or non-degenerate. If a region bounded by a cycle contains an obstacle, we will call it a pocket, denoted by . Note that a degenerate cycle can actually be a pocket: it can contain an edge of some obstacle.
Let be the union of the paths for the two segment endpoints, and , in an optimal solution. By Lemma 2, the union of the two agents’ paths touches all convex vertices of . In particular, , together with the reflex chains, partitions into faces (Figure 5, left) such that every convex vertex of every face has at least one incident edge from . Note that in places where follows (hugs) , some faces are degenerate; a degenerate face (a weakly simple polygon) is created also where touches a convex hole or – more generally – a point of other than a convex vertex (See Figure 5, right).
The boundary of any face consists of , the reflex chains of , and convex holes of ; the first two are the outer boundary of . Note that only convex holes of , if any, remain holes inside the faces; any non-convex hole is split into reflex chains that form boundaries of the faces (if a hole has only one convex vertex we treat it as two convex vertices connected by a degenerate, 0-length edge – so the hole contributes two reflex chains to the partition). For any maximal contiguous portion of in , it must be a reflex chain: if it contains a convex vertex of then would need to touch that vertex in order to sweep it.
Starting from here, when we say obstacles in , we refer to convex holes or reflex chains of in . Let be the GCH of all obstacles in a face , we want to prove the following property of this GCH:
Lemma 6.
If contains at least 2 obstacles and does not collapse onto itself anywhere, the segment cannot sweep the interior of .
Proof.
By definition of , both endpoints of never enter the interior of and ; which means the interior of must be swept by interior points of . Since the beginning of the schedule, and are both at so they are outside of (the intersection between the segment and the interior of is empty). Consider the moment when some interior points of enter (Figure 6): the segment is either aligned with an edge of the hull or touches a convex vertex of the hull. If is supported by a (necessarily reflex) vertex of , then the segment will start intersecting the exterior of as it moves. In order to not intersect with the exterior, the vertex must be supported by a reflex vertex of , which may only happen if there is another (reflex) vertex of the hull collocated with . This is due to the fact that any convex vertex of a GCH is either a vertex of , or is supported by padded by another (reflex) vertex. Therefore, must collapse at some vertex.
Now we have the following result based on the fact that has to collapse:
Lemma 7.
If has at least two obstacles and collapses onto itself at some vertices, then it will create at least two pockets.
Proof.
Note that by definition, a pocket must contain at least one obstacle. Let be the set of obstacles in , and let be the only pocket that has, then contains all obstacles in . Consider the PSLG created by walking along counterclockwise: since collapses onto itself at some vertices, it will create more than one cycle in this graph. However, only one cycle (the one bounding ) has any obstacle in it, therefore the rest of the cycles in the PSLG are degenerate and empty. But if the PSLG contains all of these degenerate cycles, it means that was not an actual GCH of the obstacles, since we can get rid of all of these degenerate cycles and only keep to get a smaller set that contains all obstacles, which is a contradiction. Therefore, cannot be the only pocket.
Note that the above lemmas only state that will collapse and create at least two pockets, each having at least one obstacle. Now, for each pocket in , we can reapply the same arguments: let be the GCH containing all obstacles in then must also collapse onto itself somewhere, and create at least two pockets each containing some obstacles. We can keep repeating the same process and each time a GCH collapses it splits the set of obstacles into at least two subsets, each subset belonging to a unique pocket. Since there are a finite amount of obstacles, after a finite amount of these collapsing and splitting steps, each obstacle will be contained in its own pocket (not necessarily a pocket of the first GCH ):
Corollary 8.
Each obstacle in the face is contained in its own pocket of some GCH.
Next, we obtain the following upper bound on the total perimeter of the pockets:
Lemma 9.
Let be the set of all pockets in such that each pocket contains one obstacle:
Proof.
To prove this, we define a tree structure where each node is either a GCH or a pocket. We call the root GCH, and the pockets resulted from the collapsing of its child pockets. For each pocket, we call the GCH containing all of its obstacles its child GCH. Similarly, each child GCH also has its child pockets. Note that a GCH node could have multiple children (pockets) but a pocket can only have one child. In this tree, only pocket nodes can be leaf nodes. A leaf pocket node is one in which there is exactly one obstacle in it. We use to denote the set of children of a node. For any GCH node , we have the inequality
This is because each pocket is a different part of (two pockets share at most one vertex in ), therefore their total perimeter must be less than . Next, for any pocket node:
This is because is a GCH in therefore its perimeter cannot be larger than . The tree we have now is one such that the perimeter of each node is greater than or equal to the total perimeter of its children, therefore we can conclude that the perimeter of any GCH node is greater than or equal to the total perimeter of all of its descendant leaf pocket nodes. This applies to the root GCH as well, which proves the lemma.
We finally prove the lower bound for the approximation algorithm:
Lemma 10.
We have and .
(Recall that is the minimum spanning tree with Steiner points that spans all holes and the outer boundary of .)
Proof.
Let be the set of pockets where each pocket contains exactly one obstacle in . If an obstacle is a convex hole and is its pocket, then . However, if is a reflex chain, then : this is because the perimeter of the GCH of in is twice longer than (a GCH of a reflex chain is simply the chain traversed back and forth). We will denote (resp. ) as the set of convex hole (resp. reflex chain) obstacles in . We acquire the following using Lemma 9:
| (1) |
Let (the portion of in ), then by definition so . Using the above inequality we obtain:
Summing over all , we achieve the first lower bound of the lemma:
Note that because any portion of is counted twice during the sum: any edge of is shared by at most two different faces.
To prove the second bound in the lemma, we introduce a way to connect all of the convex holes to their respective such that the total cost of these connections is bounded by . These connections, along with , will serve as a network connecting all components of the boundary of , and the total length of this network cannot be shorter than the length of (the minimum Steiner tree connecting these components), which will give us the second bound of the lemma. We only consider convex holes in this case because any reflex chain obstacle is already connected to by definition.
Recall that when collapses (and creates pockets), there will be at least one collapsing vertex which is supported by a reflex vertex of either or . Let be any collapsing vertex that belongs to pocket and be the convex hole in , and let be the (geodesic) shortest path from to (see Figure 4 for an illustration). is the shortest path between a point and . We note that is the only point shared between and because if there is another point then is suboptimal (we can simply remove the subpath from to to get a better path). Therefore, if we remove from and compute the shortest path between and it will stay the same. Since is the shortest path between two points in a simple polygon ( without ), it cannot be longer than a half of :
| (2) |
Let (resp. ) be the set of all pockets of the convex holes (resp. reflex chains) in . Note that and . Using (1) and (2):
Recall that for each pocket of a reflex chain obstacle, the perimeter of the pocket is at least double that of the reflex chain so , therefore:
Let be the set of all pockets containing convex holes of every face, by summing the above inequality over all we obtain Finally, the length of the network connecting all boundary components, i.e. the union , is . Since cannot be shorter than :
With the above lemma, the perimeter of the degenerate polygon is for any (note that we need to double to create ), assuming we are using a PTAS to compute the minimum Steiner tree connecting all boundaries of . Based on Lemma 4, the schedule computed on using the approximation algorithm in Theorem 5 would yield a makespan within . Thus, we obtain the theorem:
Theorem 11.
A -approximation for sweeping a polygonal domain with holes where the agents must return to their depot can be computed in polynomial time.
5 Breakable Segment Sweeping
We consider the breakable segment sweeping problem in which the agents defining the endpoints of the sweeping segments must stay within , but we do not require that they remain covisible at all times; however, a point is swept only if lies on the segment at a moment when the agents are covisible (i.e., ).
5.1 Comparison with the unbreakable case
Allowing the sweeping segment to break can allow for a significantly reduced makespan. We first consider the case of a simple polygon , for which we can bound the ratio of makespans between the breakable and unbreakable segment cases.
Lemma 12.
Given a simple polygon , let (resp. ) be the optimal makespan of an unbreakable (resp. breakable) sweeping schedule. Then, .
The proof of this lemma can be found in Appendix C.
The upper bound in the lemma is tight: consider pinwheel polygons in which the edges are angled so that no two convex vertices can see each other (Figure 7). To sweep this polygon, an unbreakable segment has to spend about where is the longest reflex chain. This is because after sweeping one pin, one endpoint has to wait for the other before proceeding into the next pin. For a breakable segment, it only takes to sweep all pins because once an endpoint of the segment reaches a convex vertex in a pin, the other endpoint can start moving into an adjacent pin in parallel. This leaves an unswept region in the center with the shape of a regular gon. The perimeter of this region can be made arbitrarily shorter than the length of the pins so that it only takes a tiny amount of time for the breakable segment to clean it. Overall, the ratio would approach 2 if we keep adding more pins and stretching them.
Note that Lemma 12 does not apply to polygons with holes since a breakable segment is allowed to pass through them while an unbreakable one is not. Figure 8 shows an example in which can be worse than by a factor of where is the set of holes in the polygon. By Lemma 10, the optimal schedule of an unbreakable segment has makespan at least . However, a breakable segment can sweep this polygon in a time of at most : The agents begin at the midpoint of the left side of , move apart vertically to extend along that unit-length side, spend time to sweep the portion of to the left of the holes, including the left sides of the holes, then move to the right side (while not sweeping points, as the segment passes through holes), sweep the portion on the right in time , then reposition in time 1 to lie along the top edge of , and finally sweep downwards in time 1 to complete the sweep of the corridors between holes.
5.2 Hardness and approximation
As in the case of sweeping with an unbreakable segment, the problem of makespan optimization is NP-hard for sweeping a simple polygon with a breakable segment:
Theorem 13.
It is NP-hard to compute an optimal sweeping schedule of a simple polygon using a breakable line segment, even if is an orthogonal simple polygon.
Proof.
We use reduction from 3-Partition, similar to the proof of Theorem 1. We modify the gadget by adding a small notch at the end of each narrow corridors (Figure 9), forcing both agents to travel the entire lengths of these corridors in order to sweep the notches.
The algorithm given in Section 3 applies in the breakable segment sweeping case, yielding a 9-approximation when is a simple polygon, as the same lower bound applies. For the case in which has holes, we take a different approach to obtain a weaker and more specialized approximation result than we obtained in the unbreakable case.
Consider the case in which is a polyomino, a union of integer-coordinate unit squares whose planar dual graph, joining pairs of squares (“pixels”) that share a common unit-length edge, is connected. Consider the case in which we are to sweep with a single breakable vertical segment. The problem is strongly NP-hard, even if is a simply connected polyomino – the polygon in Figure 2 from our hardness proof in Section 2 can be turned into a polyomino. Let be the number of pixels making up :
Theorem 14.
There exists a polynomial-time algorithm (in ) achieving polylogarithmic approximation of the minimum makespan sweep of a polyomino using a breakable vertical sweeping segment.
See Appendix C for details of the proof. As pointed out by a reviewer of a previous version of the paper, this result can be extended to polyominos built from rectangles whose perimeter is bounded by a constant. The above algorithm also applies to sweeping a polyomino with an axis-aligned (horizontal or vertical) breakable segment: in this version, the agents can move arbitrarily but the sweep coverage happens only when the agents are covisible and aligned vertically or horizontally.
6 Conclusion
We introduced a novel motion planning problem where two (or multiple pairs of) agents can sweep a polygonal domain with their line of sight. The problem is strongly NP-hard, and we designed constant-factor approximation algorithms for both simple domains and domains with holes. We intend to improve the constants in these algorithms in our future work, either by a tighter analysis or better methods to decompose the polygon. Many other variants of the problem are to be considered as well, e.g., the starting point can be in the interior of or no starting point was given. One may also want to limit the maximum distance of the pair, as this is a realistic assumption. In the multiple-segment case, if the agents are allowed to change the pairing, the problem will become much more complex as well as interesting (we thank our reviewer for raising this question).
References
- [1] https://emalm.com/?v=38JGp.
- [2] https://emalm.com/?v=8JzrX.
- [3] Mikkel Abrahamsen, Jacob Holm, Eva Rotenberg, and Christian Wulff-Nilsen. Best laid plans of lions and men. In Boris Aronov and Matthew J. Katz, editors, 33rd International Symposium on Computational Geometry, SoCG 2017, July 4-7, 2017, Brisbane, Australia, volume 77 of LIPIcs, pages 6:1–6:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.SoCG.2017.6.
- [4] Helmut Alt and Michael Godau. Computing the Fréchet distance between two polygonal curves. International Journal of Computational Geometry & Applications, 5:75–91, 1995. doi:10.1142/S0218195995000064.
- [5] Esther M Arkin, Michael A Bender, Erik D Demaine, Sándor P Fekete, Joseph S. B. Mitchell, and Saurabh Sethia. Optimal covering tours with turn costs. SIAM Journal on Computing, 35(3):531–566, 2005. doi:10.1137/S0097539703434267.
- [6] Esther M Arkin, Rathish Das, Jie Gao, Mayank Goswami, Joseph SB Mitchell, Valentin Polishchuk, and Csaba D Tóth. Cutting polygons into small pieces with chords: Laser-based localization. In 28th Annual European Symposium on Algorithms (ESA 2020). Schloss Dagstuhl – Leibniz Zentrum für Informatik, 2020. doi:10.4230/LIPIcs.ESA.2020.7.
- [7] Esther M Arkin, Sándor P Fekete, Kamrul Islam, Henk Meijer, Joseph S. B. Mitchell, Yurai Núñez-Rodríguez, Valentin Polishchuk, David Rappaport, and Henry Xiao. Not being (super) thin or solid is hard: A study of grid hamiltonicity. Computational Geometry, 42(6-7):582–605, 2009. doi:10.1016/J.COMGEO.2008.11.004.
- [8] Esther M Arkin, Sándor P Fekete, and Joseph S. B. Mitchell. Approximation algorithms for lawn mowing and milling. Computational Geometry, 17(1-2):25–50, 2000. doi:10.1016/S0925-7721(00)00015-8.
- [9] Binay Bhattacharya, Asish Mukhopadhyay, and Giri Narasimhan. Optimal algorithms for two-guard walkability of simple polygons. In Workshop on Algorithms and Data Structures, pages 438–449. Springer, 2001. doi:10.1007/3-540-44634-6_40.
- [10] Moshe Dror, Alon Efrat, Anna Lubiw, and Joseph S. B. Mitchell. Touring a sequence of polygons. In Proceedings of the thirty-fifth annual ACM symposium on Theory of computing, pages 473–482, 2003. doi:10.1145/780542.780612.
- [11] Adrian Dumitrescu, Ichiro Suzuki, and Paweł Żyliński. Offline variants of the “lion and man” problem – Some problems and techniques for measuring crowdedness and for safe path planning. Theoretical Computer Science, 399(3):220–235, 2008. doi:10.1016/j.tcs.2008.02.039.
- [12] Alon Efrat, Leonidas J Guibas, Sariel Har-Peled, David C Lin, Joseph S. B. Mitchell, and TM Murali. Sweeping simple polygons with a chain of guards. In Proceedings of the eleventh annual ACM-SIAM symposium on Discrete algorithms, pages 927–936, 2000.
- [13] Alon Efrat, Joseph S. B. Mitchell, Swaminathan Sankararaman, and Parrish Myers. Efficient algorithms for pursuing moving evaders in terrains. In Proceedings of the 20th International Conference on Advances in Geographic Information Systems, pages 33–42, 2012. doi:10.1145/2424321.2424327.
- [14] Alon Efrat, Mikko Nikkilä, and Valentin Polishchuk. Sweeping a terrain by collaborative aerial vehicles. In Proceedings of the 21st ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, pages 4–13, 2013. doi:10.1145/2525314.2525355.
- [15] Naveen Garg, Goran Konjevod, and Ramamoorthi Ravi. A polylogarithmic approximation algorithm for the group steiner tree problem. Journal of Algorithms, 37(1):66–84, 2000. doi:10.1006/JAGM.2000.1096.
- [16] Leonidas J Guibas, Jean-Claude Latombe, Steven M LaValle, David Lin, and Rajeev Motwani. A visibility-based pursuit-evasion problem. International Journal of Computational Geometry & Applications, 9(04n05):471–493, 1999. doi:10.1142/S0218195999000273.
- [17] Paul J Heffernan. An optimal algorithm for the two-guard problem. In Proceedings of the Ninth Annual symposium on computational geometry, pages 348–358, 1993. doi:10.1145/160985.161163.
- [18] Martin Held. Survey of direction-parallel milling. In On the Computational Geometry of Pocket Machining, chapter 3, pages 37–52. Springer, 2005.
- [19] Stefan Hertel and Kurt Mehlhorn. Fast triangulation of simple polygons. In Foundations of Computation Theory: Proceedings of the 1983 International FCT-Conference Borgholm, Sweden, August 21–27, 1983 4, pages 207–218. Springer, 1983. doi:10.1007/3-540-12689-9_105.
- [20] Kien C. Huynh. Polygon sweeping with line of sight between covisible agents. Software (visited on 2025-08-19). URL: https://github.com/KienHuynh/polygon_sweeping, doi:10.4230/artifacts.24586.
- [21] Christian Icking and Rolf Klein. The two guards problem. International Journal of Computational Geometry & Applications, 2(03):257–285, 1992. doi:10.1142/S0218195992000160.
- [22] Rufus Isaacs. Differential games: a mathematical theory with applications to warfare and pursuit, control and optimization. Courier Corporation, 1999.
- [23] Bo Jiang and Xuehou Tan. Searching for mobile intruders in circular corridors by two 1-searchers. Discrete applied mathematics, 159(16):1793–1805, 2011. doi:10.1016/J.DAM.2010.10.007.
- [24] Tsunehiko Kameda, Ichiro Suzuki, and Masafumi Yamashita. An alternative proof for the equivalence of -searcher and 2-searcher. Theoretical Computer Science, 634:108–119, 2016. doi:10.1016/J.TCS.2016.04.016.
- [25] Borislav Karaivanov, Minko Markov, Jack Snoeyink, and Tzvetalin S Vassilev. Decontaminating planar regions by sweeping with barrier curves. In CCCG, 2014.
- [26] Steven M LaValle, Borislav H Simov, and Giora Slutzki. An algorithm for searching a polygonal region with a flashlight. In Proceedings of the sixteenth annual symposium on Computational geometry, pages 260–269, 2000. doi:10.1145/336154.336212.
- [27] Kin Sum Liu, Brent Schiller, Jie Gao, Shan Lin, and Joseph SB Mitchell. Optimizing sensor deployment with line-of-sight constraints: Theory and practice. In EWSN, pages 95–105, 2019.
- [28] Minko Markov, Vladislav Haralampiev, and Georgi Georgiev. Lower bounds on the directed sweepwidth of planar shapes. Serdica Journal of Computing, 9(2):151–166, 2015.
- [29] Joseph S. B. Mitchell. Approximating watchman routes. In Proceedings of the twenty-fourth annual ACM-SIAM symposium on Discrete algorithms, pages 844–855. SIAM, 2013. doi:10.1137/1.9781611973105.60.
- [30] Bengt J Nilsson and Eli Packer. An approximation algorithm for the two-watchman route in a simple polygon. In European Workshop on Computational Geometry, EuroCG, Lugano, Switzerland (20160330-20160401), pages 111–114, 2016.
- [31] J Scott Provan. An approximation scheme for finding steiner trees with obstacles. SIAM Journal on Computing, 17(5):920–934, 1988. doi:10.1137/0217057.
- [32] Günter Rote. Pursuit-evasion with imprecise target location. In SODA, pages 747–753, 2003. URL: http://dl.acm.org/citation.cfm?id=644108.644231.
- [33] Dorian Rudolph. Approximating the sweepwidth of polygons with holes. In EuroCG, 2019.
- [34] Marcus Schaefer, Jean Cardinal, and Tillmann Miltzow. The existential theory of the reals as a complexity class: A compendium. arXiv preprint arXiv:2407.18006, 2024. doi:10.48550/arXiv.2407.18006.
- [35] Subhash Suri. On some link distance problems in a simple polygon. IEEE transactions on Robotics and Automation, 6(1):108–113, 1990. doi:10.1109/70.88124.
- [36] Ichiro Suzuki and Masafumi Yamashita. Searching for a mobile intruder in a polygonal region. SIAM Journal on computing, 21(5):863–888, 1992. doi:10.1137/0221051.
- [37] Xuehou Tan and Bo Jiang. Minimization of the maximum distance between the two guards patrolling a polygonal region. Theoretical Computer Science, 532:73–79, 2014. doi:10.1016/J.TCS.2013.03.019.
- [38] The CGAL Project. CGAL User and Reference Manual. CGAL Editorial Board, 5.6 edition, 2023. URL: https://doc.cgal.org/5.6/Manual/packages.html.
- [39] Auer Thomas and Held Martin. Heuristics for the generation of random poly-gons. In Proceedings of the 8th Canadian Conference on Computational Geometry (CCCG’96), pages 38–44. Citeseer, 1996. URL: http://www.cccg.ca/proceedings/1996/cccg1996_0007.pdf.
- [40] Christopher Umans and William Lenhart. Hamiltonian cycles in solid grid graphs. In Proceedings 38th Annual Symposium on Foundations of Computer Science, pages 496–505. IEEE, 1997. doi:10.1109/SFCS.1997.646138.
Appendix A Gadget for NP-hardness proof of SweepWithReturn
Appendix B Proof of Lemma 2
We restate the lemma here:See 2
Proof.
In order for a convex vertex to be swept, the point must at some moment lie on the sweeping segment. If is not visited by an endpoint of the sweeping segment, then it must be visited at some moment by a point interior to the sweeping segment. But this implies that, at that moment, in the neighborhood of the sweeping segment, , enters the exterior of , since the two collinear segments and cannot both lie within the convex cone with apex that is defined by the edges of incident to .
Appendix C Breakable Segment Sweeping
Lemma 12. [Restated, see original statement.]
Given a simple polygon , let (resp. ) be the optimal makespan of an unbreakable (resp. breakable) sweeping schedule. Then, .
Proof.
The first inequality () is immediate. We will now provide proof that : given any sweeping schedule of a breakable segment, we can convert it into a schedule for an unbreakable segment, while at most doubling the makespan. Recall that the two endpoints of the breakable segment might, at some times, not see each other; however, points of are only being swept during times when the endpoints are covisible. Therefore, a schedule of a breakable segment can be seen as a sequence of periods (intervals of time) during each of which the endpoints are either always covisible or always hidden from each other. During a covisible period, an unbreakable segment can simply follow the sweeping schedule of the breakable segment (since it is not broken during this time interval), with no change in makespan. For any hidden period, let be the first position of the breakable segment and be the last. If is the makespan of the breakable segment in this period, then
| (3) |
where and are the geodesic shortest paths from to and to respectively.
There are now three cases (Figure 11):
-
(I)
does not intersect and neither do and . The union will bound a region , which is an hourglass polygon (i.e. a polygon consisting of two reflex chains that are connected by two edges and ). Now, consider the triangulation of the hourglass polygon. Let the triangle containing be and the triangle containing be . If we consider each triangle as a node of a graph and create an edge between two nodes if their corresponding triangles share an edge in the triangulation, then this graph (the dual of the triangulation) is a path from node to node . This is always true for an hourglass polygon. Note that other than and , a triangle in the triangulation consists of exactly two chords of and one edge on its boundary (an edge of or ). To let the unbreakable segment sweep this hourglass, we use the following motion plan:
-
If lines up with an edge of some triangle , this edge must be , or a chord of , but not an edge of or .
-
Assume is lining up with one edge of an unswept triangle , either or must be incident to an edge of or . Whoever is incident to such an edge will move along that edge while the other stays stationary during the whole period. This will sweep and let line up with an edge of the next triangle.
-
Repeat the above step until lines up with .
This whole process will cost no more than .
-
-
(II)
intersects with . Let . and will be two reflex chains visible from . We can view as a self-intersecting polygonal chain, or the boundary of a simple polygon with a degenerate vertex . To move from to using an unbreakable segment, we can rotate the segment around while moves along and moves along in opposite directions. This can be done as follows: we project all vertices from each reflex chain onto the other chain using as a pinhole. The projections decompose the degenerate polygon into smaller double wedges, which can be swept one by one. Each such wedge has two bases, one of which is at least as long as the other. Sweeping a double wedge will require a time equal to the length of the longer base.
-
(III)
and share some vertices. In this case, the two of them will create two funnels whose bottom vertices are attached to the two ends of the shared portion. Similarly to the hourglass case in (I), we can triangulate the funnels and:
-
Let the segment sweep the first funnel polygon by moving from one triangle to another. Both and will eventually meet at the bottom vertex of the first funnel polygon.
-
Since and are now colocated, they can both move along the shared portion of and until both of them arrive at the bottom endpoint of the second funnel polygon.
-
Finally, the segment can sweep the second funnel polygon by moving from one triangle to another until they line up with .
This process also costs at most .
-
In all cases, the produced schedule for the unbreakable segment is at most due to (3).
Theorem 14. [Restated, see original statement.]
There exists a polynomial-time algorithm (in ) achieving polylogarithmic approximation of the minimum makespan sweep of a polyomino using a breakable vertical sweeping segment.
Proof.
At any moment in time, the sweeping segment has a combinatorial type, , indicating the pixel currently containing and the pixel currently containing (possibly ). At time 0, the combinatorial type is , where is the pixel on whose boundary the starting point lies. For each pixel , in order for points in to be swept by , at least one of the set of combinatorial types must be visited, where is the set of combinatorial types for which is a vertical column of pixels within that contains (i.e., ). Over the time window of an optimal sweep, the segment has a sequence, possibly with repeats, of combinatorial types, ; this sequence must contain at least one combinatorial type from , for every . (Note that some of the types may specify vertical columns of pixels that do not all lie within ; we do allow to lie partially outside of in the breakable segment sweeping problem.) By continuity of motion of the agents and , for each , the distance between pixel and , and between and , is at most 1 (it is 0 or 1). We define the distance between and to be . Then, in this metric, we consider the one-of-a-set (generalized) TSP path, to visit every set , for . The optimal makespan must be at least the length of such a TSP path. Further, for any TSP path in the “combinatorial type space” that visits all of the sets , we can, with only an factor greater length, execute a sweep with a vertical segment , with and , shifting the vertical segment (of fixed length) around the boundaries of pixels and , so that all points in the vertical column of pixels within are swept. Since the one-of-a-set TSP has a polylog factor approximation algorithm [15], applying it here will result in Theorem 14.
Appendix D Experiments
Sweeping a simple polygon with 1 segment can be done with the following heuristic which, similar to our approximation algorithm (Section 3), has two phases: first, decompose into convex pieces ( time [19]) – the dual graph of the decomposition is a tree; then, sweep the pieces one-by-one in DFS order around the tree, starting with the component that contains (Figure 12 shows that the heuristic’s makespan can be ). We implemented one-segment sweeping with return both with our algorithm (Section 3) and the above heuristic; Python was used for the main procedures, while C++ was used as a proxy for calling CGAL modules [38]. We generated 3 sets of random simple polygons (the vertices are either within the unit square or unit disk), using the algorithm of [39] (for each polygon, is a random vertex): 1000 polygons with 20 to 100 vertices each, 500 polygons with 500 to 1000 each, and 50 polygons with 5000 to 10000 vertices each. The results of experimenting with the polygons are shown in Fig. 13: it can be seen that although the heuristic algorithm (HA) has no approximation guarantee, it outperforms the (provable) approximation algorithm (AA) in most instances (the heuristic takes better advantage of parallelism during the second step, by moving both agents at maximum speed when they are able to do so; in the approximation algorithm, the agents move in parallel only when sweeping histogram subpolygons , and even then the bottom agent slows down in order to accommodate the top agent).
Table 1 shows the average and maximum ratios of the makespans of AA and HA; the average speedup of HA is about 1.333 and the maximum speedup observed is 1.743. The average ratio of the AA makespans and the theoretical lower bounds is between 3.903 and 4.032. In the worst instance of the experiments, the schedule computed by AA takes 5.116 more time than the proven lower bound; this observed factor is still significantly less than the factor of 8 proved in Theorem 5; we believe that the reason is that the theoretical lower bound is usually unachievable (except for some specific classes of polygons like convex).
| Makespan ratio | AA/LB | HA/LB | AA/HA | |
|---|---|---|---|---|
| Mean | 3.903 | 2.933 | 1.337 | |
| 4.007 | 3.022 | 1.327 | ||
| 4.032 | 3.035 | 1.328 | ||
| All | 3.941 | 2.965 | 1.333 | |
| Max | All | 5.116 | 3.928 | 1.743 |
Figure 14 shows typical sweeping schedules of our algorithms; videos of our sweeps can be viewed at [1, 2]. Teal regions are swept earlier, red regions later. In some cases, red regions are isolated from those of similar color, as in the bottom left region of the top left figure, where the segment backtracks to sweep a region near . Ideally, regions of similar color should be close to each other; however, achieving this requires a better ordering to explore the children of each node (better than the DFS).
