We study the following separation problem: Given a collection of colored objects in the plane, compute a shortest “fence” , i.e., a union of curves of minimum total length, that separates every two objects of different colors. Two objects are separated if contains a simple closed curve that has one object in the interior and the other in the exterior. We refer to the problem as GEOMETRIC -CUT, where is the number of different colors, as it can be seen as a geometric analogue to the well-studied multicut problem on graphs. We first give an -time algorithm that computes an optimal fence for the case where the input consists of polygons of two colors and corners in total. We then show that the problem is NP-hard for the case of three colors. Finally, we give a -approximation algorithm.
We are given pairwise interior-disjoint, not necessarily connected, sets in the plane. We want to find a covering of the plane such that the sets are closed and interior-disjoint, and the total length of the boundary between the different sets is minimized.
We think of the sets as having different colors and each set as a union of simple geometric objects like circular disks and simple polygons. Examples are shown in Figure 1 and Figure 2. We call the territory of color . The “fence” is the set of points that separates the territories. (Alternatively, is the set of points belonging to more than one territory.) As we can see, a territory can have more than one connected component.
An alternative view of the problem concentrates on the fence: A fence is defined as a union of curves such that each connected component of intersects at most one set . An interior-disjoint covering as defined above gives, by definition, such a fence. Likewise, a fence induces such a covering, by assigning each connected component of to an appropriate territory . The total length of a fence is also called the cost of and is denoted as .
In our paper, we will focus on the case where the input consists of simple polygons (with disjoint interiors) where the corners have rational coordinates. We denote this problem as GEOMETRIC -CUT, Each input polygon is called an object. We use to denote the total number of corners of the input polygons. We count the corners with multiplicity so that if a point is a corner of more objects, it is counted for each object individually.
The results can be extended to more general shapes as long as they are reasonably well behaved.
Even in this simple setting, the problem poses both geometric and combinatorial difficulties. A set can consist of disconnected pieces, and the combinatorial challenge is to choose which of the pieces should be grouped into the same component of . The geometric task is to construct a network of curves that surrounds the given groups of objects and thus separates the groups from each other. For colors, optimal fences consist of geodesic curves around obstacles, which are well understood. As soon as the number of colors exceeds , the geometry becomes more complicated, and the problem acquires traits of the geometric Steiner tree problem, as shown by the example in Figure 2.
The problem of enclosing a set of objects by a shortest system of fences has been considered with a single set by Abrahamsen et al. . The task is to “enclose” the components of by a shortest system of fences. This can be formulated as a special case of our problem with colors: We add an additional set , far away from and large enough so that it is never optimal to enclose . Thus, we have to enclose all components of and separate them from the unbounded region. In this setting, there will be no nested fences. Abrahamsen et al. gave an algorithm with running time for the case where the input consists of unit disks.
In Section 3, we show how to solve the case with colors in time . The algorithm works by reducing the problem to the multiple-source multiple-sink maximum flow problem in a planar graph. In Section 4, we show that already the case with colors is NP-hard by a reduction from PLANAR POSITIVE 1-IN-3-SAT.
In Section 5, we discuss approximation algorithms. We first compare the optimal fence consisting of line segments between corners of input polygons to the unrestricted optimal fence . We show that . After applying a -approximation algorithm for the -terminal multiway cut problem , we obtain a polynomial-time -approximation algorithm for GEOMETRIC -CUT (Theorem 16).
2 Structure of Optimal Fences
An optimal fence is a union of (not necessarily disjoint) closed curves, disjoint from the interior of the objects. Furthermore, is the union of straight line segments of positive length. Consider two non-collinear line segments with a common endpoint . If is not a corner of an object, then exactly three line segments meet at and form angles of .
We first prove that the curves in are disjoint from the interior of each object. To this end, consider any fence in which some open curve is contained in the interior of an object . Then the domains on both sides of must be part of the territory . Hence, can be removed from while the fence remains feasible. That operation reduces the length, so is not optimal.
We next show that is the union of a set of closed curves. Suppose not. Let be the union of all closed curves contained in and let be a connected component in . Then is the (not necessarily disjoint) union of a set of open curves, which do not contribute to the separation of any objects. Hence, is a fence of smaller length than , so is not optimal.
In a similar way, one can consider the union of all line segments of positive length contained in , and if is non-empty, a standard argument shows that a curve in can be replaced by line segments, thus reducing the total length.
The last claimed property is shared with the Euclidean Steiner minimal tree on a set of points in the plane, and it can be proved in the same way, see for example Gilbert and Pollak : Suppose that the fence contains two non-collinear line segments and sharing an endpoint that is not a corner of an object. If the angle between and at is less than , then parts of and can be replaced by three shorter segments. Hence, the angle between segments meeting at is at least , and there can be at most three such line segments. If there are only two, one can make a shortcut. Therefore, there are exactly three segments, and they form angles of . ∎
As it can be seen in Figure 2, optimal fences may contain cycles that do not touch any object. By the following lemma, such cycles can be eliminated without increasing the length. This will turn out to be useful in our design of approximation algorithms.
Let be the set of corners of the objects in an instance of GEOMETRIC -CUT. There exists an optimal fence with the property that contains no cycles.
Let us look at a connected component of . By Lemma 1, its leaves are in . All other vertices have degree 3, and the incident edges meet at angles of . If contains a cycle , we can push the edges of in a parallel fashion (forming an offset curve), as shown in Figure 2. This operation does not change the total length of . This can be seen by looking at each degree-3 vertex individually: We enclose in a small equilateral triangle whose sides cut the edges at right angles, see Figure 3. It is an easy geometric fact that the sum of the distances from a point inside an equilateral triangle to the three sides is constant. This implies that the length of the fence inside the triangle is unchanged by the offset operation. The portions of outside the triangles are just translated and do not change their lengths either.
As we offset the cycle , an edge of must eventually hit a corner of an object. Another conceivable possibility is that an edge of between two degree-3 vertices is reduced to a point, but this can be excluded because it would lead to an optimal fence violating Lemma 1.
In this way, the cycles of can be eliminated one by one. ∎
3 The Bicolored Case
In this section we consider the case of different colors. Let be the set of all corners of the objects. A line segment is said to be free if it is disjoint from the interior of every object. A vertex of an optimal fence cannot have degree or more unless , as otherwise two of the regions meeting at would be part of the same territory and could be merged, thus reducing the length. We therefore get the following consequence of Lemma 1.
An optimal fence consists of free line segments with endpoints in .∎
Let be the set of all free segments with endpoints in . includes all edges of the objects. Let be the arrangement induced by , see Figure 4. Consider an optimal fence and the associated territories and . Lemma 3 implies that is contained in . Thus, each cell of belongs entirely either to or . The objects are cells of whose classification (i.e., membership of versus ) is fixed. In order to find , we need to select the territory that each of the other cells belongs to. Since , has size and can be computed in time . For simplicity, we stick with the worst-case bounds. In practice, set can be pruned by observing that the edges of an optimal fence must be bitangents that touch the objects in a certain way, because the curves of the fence are locally shortest.
Finding an optimal fence amounts to minimizing the boundary between and . This can be formulated as a minimum-cut problem in the dual graph of the arrangement . There is a node in for each cell and a weighted edge in for each pair of adjacent cells: the weight of the edge is the length of the cells’ common boundary. Let be the sets of cells that contain the objects of , respectively. We need to find the minimum cut that separates from . This can be obtained by finding the maximum flow in from the sources to the sinks , where the capacities are the weights. As is a planar graph, we can use the algorithm by Borradaile et al.  with running time . The running time has since then been improved to . As , we obtain the following theorem.
GEOMETRIC -CUT can be solved in time . ∎
A similar algorithm has been described before in a slightly different context: image segmentation , see also . Here, we have a rectangular grid of pixels, each having a given gray-scale value. Some pixels are known to be either black or white. The remaining pixels have to be assigned either the black or the white color. Each pixel has edges to its (at most four) neighbors. The weights of these edges can be chosen in such a way that the minimum cut problem corresponds to minimizing a cost function consisting of two parts: One part, the data component, has a term for each pixel, and it measures the discrepancy between the gray-value of the pixel and the assigned value. The other part, the smoothing component, penalizes neighboring pixels with similar gray-values that are assigned different colors.
4 Hardness of the Tricolored Case
We show how to construct an instance of GEOMETRIC -CUT from an instance of PLANAR POSITIVE 1-IN-3-SAT. For ease of presentation, we first describe the reduction geometrically, allowing irrational coordinates. We prove that if is satisfiable, then has a fence of cost , whereas if is not satisfiable, then the cost is at least . We then argue that the corners can be slightly moved to make a new instance with rational coordinates while still being able to distinguish whether is satisfiable or not, based on the cost of an optimal fence.
In order to make the proof as simple as possible, we introduce a new specialized problem COLORED TRIGRID POSITIVE 1-IN-3-SAT in the following.
4.1 Auxiliary NP-complete problems
In the POSITIVE 1-IN-3-SAT problem, we are given a collection of clauses containing exactly three distinct variables (none of which are negated). The problem is to decide whether there exists an assignment of truth values to the variables of such that exactly one variable in each clause is true.
In the TRIGRID POSITIVE 1-IN-3-SAT problem, we are given an instance of POSITIVE 1-IN-3-SAT together with a planar embedding of an associated graph with the following properties:
is a subgraph of a regular triangular grid,
for each variable , there is a simple cycle ,
for each clause , there is a path and three vertical paths with one endpoint at a vertex of and one at a vertex of each of ,
except for the described incidences, no edges share a vertex,
all vertices have degree or ,
any two adjacent edges form an angle of or ,
the number of vertices is bounded by a quadratic function of the size of .
The problem is to decide whether has a satisfying assignment.
Mulzer and Rote  showed that another problem, PLANAR POSITIVE 1-IN-3-SAT, is NP-complete, which is similar but uses a slightly different embedding with axis-parallel segments. It trivially follows that TRIGRID POSITIVE 1-IN-3-SAT is also NP-complete, see Figure 5.
Consider an instance of TRIGRID POSITIVE 1-IN-3-SAT. There are some vertices of degree three on the cycles corresponding to each variable in , and these we denote as branch vertices of . There is also one vertex of degree three on the path corresponding to each clause in , which we denote as a clause vertex. Except for branch and clause vertices, at most two edges meet at each vertex.
Let be the set of all clause vertices (considered as geometric points). Removing from (considered as a subset of ) splits into one connected component for each variable of . The idea of our reduction to GEOMETRIC -CUT is to build a channel on top of for each variable . The channel has constant width and contains in the center. The channel contains small inner objects and is bounded by larger outer objects of another color. There will be two equally good ways to separate the inner and outer objects, namely taking an individual fence around each inner object and taking long fences along the boundaries of the channel that enclose as many inner objects as possible. Any other way of separating the inner from the outer objects will require more fence. These two optimal fences play the roles of being true and false, respectively.
At the clause vertices where three regions meet, we make a clause gadget that connect the three channels corresponding to . The objects in the clause gadget can be separated using the least amount of fence if and only if one of the channels is in the state corresponding to true and the other two are in the false state. Therefore, this corresponds to the clause in being satisfied.
In order to make this idea work, we first assign every edge of an inner and an outer color among . These will be used as the colors of the inner and outer objects of the channel later on. We require the following of the coloring:
The inner and outer colors of any edge are distinct.
Any two adjacent collinear edges have the same inner or outer color.
Any two adjacent edges that meet at an angle of at a non-clause vertex have the same inner and the same outer color.
The inner colors of the three edges meeting at a clause vertex are red, green, blue in clockwise order, while the outer colors of the same edges are blue, red, green, respectively.
We now introduce the problem COLORED TRIGRID POSITIVE 1-IN-3-SAT, which we will reduce to GEOMETRIC -CUT.
In the COLORED TRIGRID POSITIVE 1-IN-3-SAT problem, we are given an instance of TRIGRID POSITIVE 1-IN-3-SAT together with a coloring of the edges of satisfying the above requirements. We want to decide whether has a satisfying assignment.
The problem COLORED TRIGRID POSITIVE 1-IN-3-SAT is NP-complete.
Membership in NP is obvious. For NP-hardness, we reduce from TRIGRID POSITIVE 1-IN-3-SAT. Let be an instance of the latter and be the graph obtained from by expanding the vertical paths , so that they have length at least . The cycles and paths are shifted up or down accordingly, see Figure 6. We specify the coloring of below.
We color each triple of edges meeting at a clause vertex so that requirement 4 is met. In each of the paths , we have colored one edge on each side of the clause vertex, and we use the colors of that edge to color the rest of the edges on that side. Next, we choose two distinct colors that we use as the inner and outer colors of all the cycles containing the branch vertices. For each vertical path , the edge adjacent to the cycle has to be colored with the same two colors.
It remains to color some edges of each vertical path . Since the vertical paths have length at least and only the first and last edges have been colored, it is possible to change inner and outer color three times along each of them. The maximum number of changes is needed when the edge adjacent to a clause vertex has the inner and outer colors swapped as compared to the edge adjacent to a branch vertex, in which case exactly three changes are needed. Therefore, it is possible to adjust the colors so that the entire path gets colored. We have hence constructed an instance of COLORED TRIGRID POSITIVE 1-IN-3-SAT based on the same instance of POSITIVE 1-IN-3-SAT that we were given. ∎
4.2 Building a GEOMETRIC -SAT instance from tiles
Consider an instance of COLORED TRIGRID POSITIVE 1-IN-3-SAT that we will reduce to GEOMETRIC -CUT. We make the construction using hexagonal tiles of six different types, namely straight, inner color change, outer color change, bend, branch, and clause tiles. Each tile is a regular hexagon with side length and hence has width . The tiles are rotated such that they have two horizontal edges.
The tiles are placed so that each tile is centered at a vertex of . Let be the part of within distance from (recall that each edge of has length ). Figure 7 shows the tiles and how they are placed according to the shape and colors of .
|straight||inner color change||outer color change|
In order to define the outer objects of a tile, we consider the straight skeleton offset  of at distance . With the exception of the bend tile, this offset is the same as the Euclidean offset. By the outer and inner region, we mean the region of the tile outside, resp. inside, this offset. The outer objects cover the outer region, and every point is colored with the outer color of a closest edge in . The inner region is empty except for the inner objects described in each case below. We suppose that .
The straight tile. If two collinear edges meet at with the same inner and outer color, we use a straight tile. Suppose in this and the following two cases that is the vertical line segment from to —tiles for edges of other slopes are obtained by rotation of the ones described here. There are four axis-parallel squares of the inner color of with side length centered at . This size is chosen so their total perimeter is , which is the length of the common boundary of the inner and outer regions.
The inner color change tile. If two collinear edges meet at with different inner colors, we use an inner color change tile. There are again four squares colored in the inner color of the closest point in . There are also four smaller axis-parallel squares with side length centered at , likewise colored in the inner color of the closest point in . The size of these small squares is chosen so that they can be individually enclosed using fences of total length , which is the width of the inner region.
The outer color change tile. If two collinear edges meet at with different outer colors, we use an outer color change tile. There are four axis-parallel squares of the inner color of with side length . Their centers are . The size of these squares is chosen so that their total perimeter is .
The bend tile. If two non-collinear edges meet at , we use a bend tile. Consider the case where is the vertical line segment from to and the segment of length from with direction . The other cases are obtained by a suitable rotation of this tile. There is an axis parallel square of side length with center and another with side length centered at . The tile is symmetric with respect to the angular bisector of , and so the reflections of the described squares with respect to are also inner objects. Note that there are two outer objects, one of which, , has a concave corner with exterior angle . We place a parallelogram with side length , a corner at , and two edges contained in the edges of incident at . It is easy to verify that the common boundary of the inner and outer regions has a total length of ; the inner objects are chosen such that their total perimeter is also .
The branch tile. If is a branch vertex, we use the branch tile. There are two cases: either contains the vertical segment from to or that from to . We specify the tile in the first case—the other can be obtained by a rotation of . There are axis-parallel squares of side length centered at and their rotations around by angles and . The common boundary of the inner and outer regions has a total length of , and the total perimeter of the inner objects is also .
The clause tile. If is a clause vertex, we use the clause tile (defined in Figure 7). The other clause tiles are given by rotations of the described tile by angles for .
4.3 Solving the tiles
Let an instance of GEOMETRIC -SAT be given together with an associated fence . Consider the restriction of to a convex polygon and the part of the fence inside . Note that consists of (not necessarily disjoint) closed curves and open curves with endpoints on the boundary , such that no two objects in of different color can be connected by a path unless intersects . (An open curve is a subset of a larger closed curve of that continues outside .) We say that a set of closed and open curves in with that property is a solution to . In the following, we analyze the solutions to the tiles defined in Section 4.2 in order to characterize the solutions of minimum cost. We say that two closed curves (disjoint from the interiors of the objects) are homotopic if one can be continuously deformed into the other without entering the interiors of the objects. Two open curves with endpoints on the boundary of the tile are homotopic if they are subsets of two homotopic closed curves (that extends outside the tile).
Figure 8 shows optimal solutions to each kind of tile. The cost in each case is:
Straight tile: .
Inner color change tile: .
Outer color change tile: .
Bend tile: .
Branch tile: .
Clause tile: .555The exact value is complicated due to the coordinates and of no use.
If the cost of a solution to a tile exceeds the optimum by less than , then is homotopic to one of the optimal solutions of in the following sense: For each curve in , there is a curve in homotopic to . If is closed, the distance from any point on to the closest point on is less than . If is open and has an endpoint , there is a corresponding endpoint of with .
We assume that the center of the tile is and in each case, that is rotated as in the description of the tiles and have colors as in Figure 7. We also define to be the two or three half-edges of meeting at as in the description of the tiles.
Consider first the case that is any of the tiles except the clause tile. Note that separates into two or three pieces. The pieces are two pentagons for the straight, inner color change, and outer color change tiles; a pentagon and a heptagon for the bend tile; and three pentagons for the branch tile. We consider each such piece individually and check the minimum cost of a solution to . It is easy to verify that for each such piece , there are two solutions, and they are exactly as shown in Figure 8. One solution corresponds to the outer state and the other to the inner state, and in order to be combined to a solution for all of , each of the two or three pieces needs to be in the same state. It therefore follows that the solutions shown in Figure 8 are all the optimal solutions.
One can also easily verify that any solution that is not homotopic to an optimal solution has a cost that exceeds the optimal cost by more than . Suppose that the cost of a solution exceeds the cost of a homotopic optimal solution by less than . In order to decide how much can deviate from , consider the straight tile as an example, see Figure 9. In the outer state, each curve enclosing an inner object has length at least . Since the total cost is less than , each curve has length less than . An elementary analysis gives that a closed curve of length at most which encloses a square of side length is within distance from the boundary of the square. For the inner state, consider the curve in the right side of the tile that has the inner objects to the left. The length of has to be less than in order for the total cost to be less than . Note that has to pass through the upper right corner of the upper right square. Therefore, has to meet the top edge of at a point within distance from the corresponding endpoint of . The other non-clause tiles are analyzed in a similar way.
The analysis of the clause tile is not as simple, since one does not get a solution to the complete tile by combining optimal solutions of smaller pieces. The proof has been deferred to Lemma 10 and relies on an extensive case analysis.
The largest possible deviation between a closed curve in and can appear for the clause tile, since it contains an inner object with the longest edge of all tiles, namely a triangle with an edge of length . That leads to a deviation of less than . Likewise, the largest possible deviation between open curves is , as realized in the clause tile and described in Lemma 10. ∎
We now analyze the optimal solutions of the clause tile. Here, we define a domain as a connected component of a territory. The names of objects in the clause tile referred to in the following lemma are defined in Figure 10. Indices are taken modulo . The optimal solutions are covered by case 2.3.2 in the proof.
The cost of a solution to a clause tile is at least . Moreover, if the cost is less than , then there is such that contains
a curve from to , where ,
a curve from to , where ,
a curve from to , where ,
a curve from to , where ,
a curve from to ,
a curve from to ,
a curve from to .
Clearly, must contain segments , , and for any since each of these segments are on the shared boundary of two objects of different color. In total, this amounts for the cost . In the following, we argue about the fence needed in addition to that, i.e., the part of contained in the closed pentadecagon . We characterize how the solution looks when the additional cost in is at most . When we say that the solution must contain a curve or a tree with certain properties (such as connecting two specific points), we mean such a curve or tree contained in .
We divide into cases after which objects are in the same domains. After making enough assumptions in one branch of the case analysis, we can either give a lower bound of the cheapest solution above , or it follows that all objects of different colors are separated, and then we state what the optimal solution satisfying the specific assumptions is. We have used Geogebra  to construct the solutions and estimate their costs. Each estimate differs from the exact value by at most .
Note first that for any , in order to separate from , the solution must contain a curve (in ) starting at that has a length of at least , and similarly one from in order to separate from . The prefixes of length of these six fences are disjoint. We therefore charge to each and .
Case 1: For a value of , neither and nor and are in a domain together.
Without loss of generality, suppose that the condition holds for . We consider the solution restricted to the hexagon . In order to separate and in , there must be a connected component of that connects and . The individual cases are shown in Figure 10.
Case 1.1: also separates from and from .
Note that connects and . The shortest connected system of curves that connects , , and is a Steiner minimal tree with vertical edges meeting and . All such trees have the same cost, which is . But adding the charged to , we get more than .
Case 1.2: separates from , but not from .
(The case where separates from , but not from , is analogous.) Note that has minimal length if , which has length . In addition to that comes charged to , and the total is .
Case 1.3: separates neither from , nor from .
In this case, has cost at least , which is the distance between and . In addition comes charged to , which in total is more than .
Case 2: For any value of , and or and are in a domain together.
We may now divide into cases after how many values of satisfy that and are in the same domain. Let denote this number.
Case 2.1: .
In this case, and are in the same domain for each . The individual cases are shown in Figure 11.
Case 2.1.1: For no value of is in a domain with or .
In this case, the solution contains curves from to and to for each , since the objects and are separated from other objects of the same color. Furthermore, there must be a curve from to bounding the domain containing . It follows that the solution connects any two of the nine points . The cheapest solution that satisfies this is , which has cost .
Case 2.1.2: is in a domain with .
Assume without loss of generality that is in a domain with . The mentioned domain separates from and , and it separates from . The boundary of that domain contains a curve connecting and and one connecting and . It follows that the solution contains
a tree connecting ( and are connected since is isolated from the other red objects),
a tree connecting ( and are connected since is separated from the other blue objects),
a curve connecting and (same reasons as above).
The optimal solution of this form consists of segments from to their Fermat point and the segments , and it has cost .
Case 2.1.3: is in a domain with .
Assume without loss of generality that is in a domain with . That domain separates from , and thus any solution contains a curve from to . There must also be a curve connecting and on the boundary of the domain. The solution also contains a curve from to , as is isolated from the other red objects.
Case 220.127.116.11: is not in a domain with or .
Any solution contains a curve from to (bounding the domain of ), one from to (bounding the domain of ), and one from to (bounding the domain of ). To summarize, the solution contains
a tree connecting ,
a curve connecting and , and
a curve connecting and .
The shortest such solution consists of segments from to their Fermat point and the segments , and it has cost .
Case 18.104.22.168: is in a domain with .
This case is covered by case 2.1.2.
Case 22.214.171.124: is in a domain with .
There is a curve bounding that domain connecting and . There are thus curves connecting all pairs and . The shortest solution of that form is , which has total cost .
Case 2.2: .
Assume without loss of generality that and are in the same domain. We thus also know that and are in the same domain, as are and . The domain of separates and from and , so and are in separate domains, and the solution must contain a curve connecting and and one connecting and bounding these domains.
Note that in order to separate from and , the solution either contains a curve from to or curves from and to the boundary segment . We consider the latter option, which is cheaper. It will follow from the analysis that even this is too expensive to get below . The individual cases as shown in Figure 12.
Case 2.2.1: is not in a domain with or .
The solution contains a curve from to bounding the domain containing , and a curve connecting and , and one connecting and on the boundaries of the domains of and , respectively. It follows that the solution contains a tree connecting .
The cheapest such solution is , which has cost . This “second-best” solution is the reason we have chosen the threshold in the lemma.
Case 2.2.2: is in a domain with .
The solution contains a curve connecting and and one connecting and bounding that domain. It also contains a curve connecting and bounding the domain of , since is sepatated from the other blue objects. The optimal solution consists of segments from to their Fermat point and segments , and it has cost .
Case 2.2.3: is in a domain with .
The solution contains a curve connecting and , and one connecting and bounding the domain of . The cheapest solution is similar to that in case 2.2.1, where the domain containing has collapsed to zero width at .
Case 2.3: .
Assume without loss of generality that and are in the same domain, as are and . Furthermore, and are separated, but and are together. As in case 2.2, we assume that and are separated, as are and . Otherwise, the cost of the solution will increase by at least , and as the analysis will show, that is too much to stay below .
The domain containing separates and from and . It follows that there is a curve in the solution that connects and , and one that connects and . Likewise, the domain containing separates and from and . Hence, the boundary of the domain containing contains a curve connecting and . The cheapest solution is obtained as , as shown in Figure 12, and the cost is . This is the optimal solution among all cases.
The segment can be substituted by a curve from to , while keeping the cost below , if and only if . Likewise for the other segments with an endpoint on the boundary of . These are exactly the solutions described in the lemma.
Case 2.4: .
The cheapest solution is obtained when and are separated for each . Furthermore, the solution contains a curve connecting and for each bounding the domain containing . The cheapest such solution is as shown in Figure 12, which has cost . ∎
The problem GEOMETRIC -CUT is NP-hard.
Let an instance of COLORED TRIGRID POSITIVE 1-IN-3-SAT be given and construct the tiles on top of as described. Let be the set of tiles and the area that the tiles cover (i.e., is a union of the hexagons). We will cover any holes in with completely red tiles, and place red tiles all the way along the exterior boundary of . Let be the set of these added red tiles and let be the resulting instance of GEOMETRIC -CUT. It is now trivial how to place the fences in everywhere except in the interior of .
Consider a fence to the obtained instance with cost . Let be the sum of the cost of an optimal solution to each tile in plus the cost of the fence that must be placed along the boundaries of the added red tiles in . We claim that if is satisfiable, then a solution realizing the minimum exists. Furthermore, if , then is satisfiable.
Suppose that is satisfiable and fix a satisfying assignment. Consider a clause tile where , , and meet. Now, we choose the -outer state, where is the variable that is satisfied. For each non-clause tile that covers a part of for a variable of , we choose the outer state if is true and the inner otherwise. It is now easy to see that the curves form a fence of the desired cost.
On the other hand, suppose that . It follows that in each tile in , the cost exceeds the optimum by at most . Hence, the solution in each tile is homotopic to one of the optimal states as described in Lemma 9. We now claim that the states of all tiles representing one variable must agree on either the inner or outer state. Consider two adjacent tiles where one is in the inner state. There are open curves with endpoints on the shared edge of the two tiles with a distance of more than . The other tile cannot be in the outer state, because then there would have to be an extra open curve of length at least to connect those endpoints. It follows that the other tile must also be in the inner state. Thus, both tiles are either in the inner or in the outer state, as desired.
We now describe how to obtain a satisfying assignment of . Consider a clause tile where , , and meet and suppose the tile is in the -outer state. It follows from the above that each tile covering is in the outer state or, in the case of the clause tile, in the -outer state. Similarly, each non-clause tile covering only (resp. ) is in the inner state and each clause tile covering a part of (resp. ) is not in the -outer (resp. -outer) state. We now set to true and and to false and do similarly with the other clause tiles, and it follows that we get a solution to .
For each object with corner with an irrational coordinate, we choose a substitute with rational coordinates such that and such that only requires polynomially many bits to represent. This results in an instance where all objects are subsets of corresponding objects in . Let and be the cost of the optimal solutions to and , respectively, and note that , as any solution to is also a solution to . We claim that . To prove this, consider a solution to . If contains a curve in the interior of an object of , we move to a curve on the boundary of , as follows.
Let be the object in corresponding to . Let be the vertices of in clockwise order and the corresponding vertices of . In the following, indices will be taken modulo . We divide the annulus into a region for each edge and a region for each vertex of , see Figure 13. We make a line segment from to the closest point on and one to the closest point on . We then define quadrilaterals and . We now describe the modification we make on in order to avoid . If intersects , we remove and instead add the segments . Note that these added segments have total length less than . If intersects , we project each point in to the closest point on . This does not increase the length of the curve. It follows that the modification of made to avoid increases the length by less than . Performing the same operation for all objects of , we get a solution to with cost less than . Hence, .
Let , so that is rational and . We conclude by observing that if , then , and thus is satisfiable. On the other hand, if is satisfiable, then . We can thus tell whether is satisfiable or not by evaluating whether . ∎
The approach for from Section 3 does not extend to because Lemma 3 does not apply: The arrangement (formed by the free segments between the corners of the input objects) is no longer guaranteed to contain an optimal fence, see Figure 2. However, we can still search for an approximate solution in : We show that the optimal fence contained in has a cost which is at most times higher than the true optimal fence (Section 5.1). We construct a corresponding lower-bound example with . (This factor is the conjectured Steiner ratio, see Section 5.2.)
The graph-theoretic problem that we then have to solve in the weighted dual graph of is the colored multiterminal cut problem: We have terminals of different colors and want to make a cut that separates every pair of terminals of different colors. This problem is NP-hard, but we can use approximation algorithms, see Section 5.3.
5.1 Upper bound