1 Introduction

Maximum Weight Independent Set of Convex Polygons (MWISCP) is a natural but algorithmically very challenging problem. We are given a set of convex polygons \(\mathcal {P}\) in the plane and our goal is to select a subset \(\mathcal {P}'\subseteq \mathcal {P}\) such that the polygons in \(\mathcal {P}'\) are pairwise non-overlapping. Each input polygon \(P_{i}\in \mathcal {P}\) is described by its vertices and additionally by a weight \(w_{i}\). The objective is to maximize the sum of the weights of the selected polygons (note that the weight is independent of the shape of the polygon). The problem and its special cases arise in many settings such as map labeling [5, 12, 23], cellular networks [11], unsplittable flow [6, 8], chip manufacturing [18], or data mining [16, 20, 21].

On the one hand, the best known polynomial time approximation algorithm has an approximation ratio of \(n^{\epsilon }\) [15]. On the other hand, the best complexity result shows only strong \({\mathsf {NP}}\)-hardness [14, 19] which leaves an enormous gap. Even more, there is a QPTAS [3, 17] which suggests that much better polynomial time approximation results are possible.

When dealing with a very difficult problem it is useful to first study simplified settings or relaxations of the original question in order to gain understanding. In this paper, we consider a relaxation of MWISCP in which we are allowed to shrink the input polygons slightly while the compared optimal solution cannot do this. We assume that there is a small constant \(\delta >0\) such that we can shrink each polygon by a factor \(1-\delta \) and the new polygon lies in the center of the original one (see Fig. 1): when we consider the rectangular bounding boxes of the original and the shrunk polygon then the height and the width of the box of the shrunk polygon are by exactly a factor \(1-\delta \) smaller than the respective values of the box of the original polygon. The reader may think of editing a polygon in a vector graphics program like Adobe InDesign or Inkscape and shrinking it by dragging two opposite corners of its bounding box slightly towards the center point. This yields the Maximum Weight Independent Set of \(\delta \)-Shrinkable Convex Polygons problem (\(\delta \)-MWISCP).

We believe that allowing to shrink the input polygons does not change the nature of the problem very much and, thus, insights for \(\delta \)-MWISCP can be useful for the general case as well. Also, in many applications it is justified to shrink the input objects slightly without losing much benefit, e.g., in map labelling.

Fig. 1
figure 1

The black lines denote the boundaries of the input polygons P and \(P'\). The gray areas denote their shrunk counterparts \(\mathrm {sr}(P)\) and \(\mathrm {sr}(P')\). The values \({\mathrm {width}} (P)\) and \({\mathrm {width}} (P')\) denote the widths of the bounding boxes of P and \(P'\), respectively

1.1 Our Contribution

We present a polynomial time \((1+\epsilon )\)-approximation algorithm for \(\delta \)-MWISCP. This generalizes a previous result for the special case of axis-parallel rectangles [1] to the much larger class of arbitrary convex polygons. Thus, we show that if we are allowed to shrink the input polygons by a little bit then we can improve the best known approximation ratio from \(n^{\epsilon }\) to \(1+\epsilon \). This is the best possible approximation ratio since \(\delta \)-MWISCP is \({\mathsf {NP}}\)-hard, even for unit squares [1]. Note that \(\epsilon \) and \(\delta \) are two independent parameters where \(\delta \) controls only how much the polygons are allowed to be shrunk and \(\epsilon \) controls only the approximation ratio.

Core of our reasoning is that there exists a \((1-\epsilon )\)-approximative shrunk solution for which there is a special cutting sequence. This sequence recursively cuts the input plane into smaller and smaller pieces until each piece either coincides with a polygon from the solution (i.e., the polygon is “cut out”) or it has empty intersection with all polygons from this solution. Importantly, each piece arising in this sequence and each recursive cut has only constant complexity, i.e., a constant number of vertices and edges. This allows us to design a dynamic program that recursively guesses the above cut sequence and then outputs the corresponding \((1-\epsilon )\)-approximative shrunk solution.

A key difficulty when approximating independent set in the geometric setting is that the input objects can have very different angles. Note that for Independent Set of (axis-parallel) Rectangles there is a polynomial time \(O(\log n/\log \log n)\)-approximation algorithm [10] but for straight line segments (with possibly very different angles) we know only a \(n^{\epsilon }\)-approximation [15]. Also in our argumentation we need to control the angles of the polygons, or more precisely the angles of the polygon’s edges with an underlying grid that guides the construction of our cutting sequence. We need that these angles are bounded away from \(\pi /2\). To achieve this we give our grid a random rotation. We are not aware of any prior work in which a randomly rotated grid was used and in our setting case it turns out to be exactly the right tool to address one of our key difficulties.

1.2 Other Related Work

Many cases of geometric independent set have been studied, being distiguished by the types of the objects arising. For axis-parallel squares of arbitrary sizes there is a PTAS due to Erlebach et al. [13]. For axis-parallel rectangles, prior to the mentioned \(O(\log n/\log \log n)\)-approximation algorithm [10], several \(O(\log n)\)-approximation algorithms were known [5, 7, 20, 22]. In the unweighted case there is even a \(O(\log \log n)\)-approximation by Chalermsook and Chuzhoy [9]. For curves in the plane Fox and Pach give a \(n^{\epsilon }\)-approximation, assuming that any two curves intersect only O(1) times [15]. This improves and generalizes an earlier \(n^{1/2+o(1)}\)-approximation due to Agarwal and Mustafa for straight line segments [4].

Going beyond polynomial time results, for independent set of arbitrary polygons there is a QPTAS [3, 17], i.e., a \((1+\epsilon )\)-approximation in time \(n^{(\log n)^{O_{\epsilon }(1)}}\), building on an earlier QPTAS for axis-parallel rectangles [2]. This implies that all the above problems are not \(\mathsf {APX}\)-hard, unless \({\mathsf {NP}}\subseteq \mathsf {DTIME}(n^{\mathrm {poly}(\log n)})\).

2 Shrinking Model and Preliminaries

We assume that there is a value \(N\in {\mathbb {N}}\) such that each of the n given input polygons \(P_{i}\in \mathcal {P}\) is specified by vertices \(v_{i,1},v_{i,2},\ldots \in \{0,\ldots ,N\}^{2}\) and a weight \(w_{i}\in \mathbb {N}\). Note that for arbitrary rational input data we can always translate and scale the input polygons such that all of their vertices have non-negative integral coordinates. For any set of polygons \(\mathcal {P}'\subseteq \mathcal {P}\) we define \(w(\mathcal {P}'):=\sum _{P_{i}\in \mathcal {P}'}w_{i}\). For each polygon \(P\in \mathcal {P}\) we define its midpoint \(\mathrm {mid}(P)\) to be the centroid of its (rectangular) bounding box, see Fig. 1. For any two points \(p,p'\) we define by \(\ell (p,p')\) the line segment connecting p and \(p'\) and we define \(\mathrm {dist}(p,p'):=\left\| \ell (p,p')\right\| _{2}\). In our shrinking model for each polygon \(P_{i}\in \mathcal {P}\) we define a new polygon \(\mathrm {sr}(P_{i})\) defined by vertices \(v'_{i,1},v'_{i,2},\ldots \) such that \(v'_{i,k}\in \ell (v_{i,k},\mathrm {mid}(P))\) for each k and such that \(\mathrm {dist}(\mathrm {mid}(P),v'{}_{i,k})=(1-\delta ) \,\mathrm {dist}(\mathrm {mid}(P),v{}_{i,k})\). Observe that if P is convex then \(\mathrm {sr}(P)\subseteq P\) and also \(\mathrm {sr}(P)\) is convex.

In \(\delta \)-MWISCP our task is to compute a set of polygons \(\mathcal {P}'\subseteq \mathcal {P}\) such that for any two polygons \(P,P'\in \mathcal {P}'\) we have that \(\mathrm {sr}(P)\cap \mathrm {sr}(P')=\emptyset \). We compare the value of our (almost feasible) solution to the value of an optimal feasible solution \(\mathrm {OPT}(\mathcal {P})\subseteq \mathcal {P}\) which can not shrink the polygons, i.e., \(\mathrm {OPT}(\mathcal {P})\) is a subset of \(\mathcal {P}\) of maximum total weight \(w(\mathrm {OPT}(\mathcal {P}))\) with the property that \(P\cap P'=\emptyset \) for any two polygons \(P,P'\in \mathrm {OPT}(\mathcal {P})\). Thus, an \(\alpha \)-approximation algorithm for \(\delta \)-MWISCP computes a solution \(\mathcal {P}'\subseteq \mathcal {P}\) such that \(w(\mathcal {P}')\ge \alpha ^{-1}\cdot w(\mathrm {OPT}(\mathcal {P}))\).

Note that for a non-convex polygon P we cannot guarantee that \(\mathrm {sr}(P)\subseteq P\). Thus, for arbitrary polygons we no longer obtain a relaxation to the original problem. In particular, the optimal solution for the shrunk polygons might be worse than the optimal solution for the original polygons. Therefore, in this paper we allow only convex polygons.

For technical reasons we assume w.l.o.g. that the width of the bounding box of each input polygon is larger than its height. This can be ensured by stretching the input plane horizontally. Note that also in our shrinking model this yields an equivalent instance and that this increases each coordinate by at most a factor of O(N).

3 Preprocessing and Shrinking

In this section we describe preprocessing steps in which we remove some of the input polygons and shrink the remaining ones. While doing this, we lose at most a factor \(1+\epsilon \) in our approximation ratio. Also, we ensure that the shrunk polygons are “well-behaved” so that our main algorithm (described in the next section) has an easier task. First, we ensure that each polygon has only few, i.e., constantly many vertices and edges.

Lemma 1

There exists a constant \(K=O_{\delta }(1)\) such that by shrinking each polygon by a factor \(1-\delta \) we can assume that it has at most K vertices.

Proof

Let \(P\in \mathcal {P}\) and assume w.l.o.g. that \(\mathrm {mid}(P)\) is the origin, see Fig. 2. For each of the four quadrants, we shrink the intersection of P with the quadrant separately. Consider \(P\cap [0,\infty )\times [0,\infty )\). Let \(p_{0}\) be the point on the boundary of \(P\cap [0,\infty )\times [0,\infty )\) with maximum y-coordinate. We assume w.l.o.g. that \(p_{0}=(0,1)\). Similary, let \(p_{0}'\) be the point on the boundary of \(P\cap [0,\infty )\times [0,\infty )\) with maximum x-coordinate and we assume w.l.o.g. that \(p_{0}'=(1,0)\). We define a set of \(O_{\delta }(1)\) points \(p_{1},p_{2},\ldots \) on the boundary of P in \([0,\infty )\times [0,\infty )\), see Fig. 2 for a sketch. For each \(k\in {\mathbb {N}}\) such that \((1-\delta )^{k}\ge (1-\delta )\cdot \frac{1}{2}\) we define the horizontal line \(L_{k}:={\mathbb {R}}\times \{(1-\delta )^{k}\}\). Note that there are \(O_{\delta }(1)\) such lines. For each such line \(L_{k}\) we define the point \(p_{k}\) to be the point on the boundary of P in \([0,\infty )\times [0,\infty )\) that intersects \(L_{k}\).

Similarly, we define a set of \(O_{\delta }(1)\) points \(p'_{1},p'_{2},\ldots \) on the boundary of P in \([0,\infty )\times [0,\infty )\). Let \(x_{\max }\) denote the maximum x-coordinate of a point \(p_{0},p_{1},\ldots \) . Note that by convexity of P we have that \(x_{\max }\ge 1/2\). For each \(k\in {\mathbb {N}}\) such that \((1-\delta )^{k}\ge x_{\max }\) we define a vertical line \(L'_{k}:=\{(1-\delta )^{k}\}\times {\mathbb {R}}\) and for each such line \(L'_{k}\) we define the point \(p'_{k}\) to be the point on the boundary of P in \([0,\infty )\times [0,\infty )\) that intersects \(L'_{k}\). This way, we define a collection of points \(p_{0},p'_{0},p_{1},p'_{1},\ldots \) . Note that by construction their clock-wise order is \(p_{0},p_{1},\ldots ,p_{f},p'_{f'},p'_{f'-1},\ldots ,p'_{0}\) for two integers \(f,f'\). Doing this construction for each of the four quadrants, we define a new polygon \(P'\) as the convex hull of all these \(O_{\delta }(1)\) points.

Fig. 2
figure 2

Left shrinking the polygons so that they have only \(K=O_{\delta }(1)\) vertices each. The thick lines show the boundary of P, the gray polygon is the smaller polygon \(P'\) with only K vertices. Right the placement of the points \(p,p',{\bar{p}},{\tilde{p}},{\tilde{p}}'\) in the proof of Lemma 1. The thick line shows the boundary of P.

We claim that \(\mathrm {sr}(P)\subseteq P'\subseteq P\). It is clear that \(P'\subseteq P\). We prove now that \(\mathrm {sr}(P)\subseteq P'\). It suffices to show that for any two consecutive vertices \(p,p'\) of \(P'\) inside one quadrant we have that \(\ell (p,p')\subseteq P{\setminus }\mathrm {sr}(P)\). Consider two such vertices \(p=(p_{x},p_{y})\) and \(p'=(p'_{x},p'_{y})\) of \(P'\) in \(P'\cap [0,\infty )\times [0,\infty )\) and assume w.l.o.g. that they are in clock-wise order. Note that by construction we have that \(p'_{y}\ge (1-\delta )p_{y}\) or \(p_{x}\ge (1-\delta )p'_{x}\). Assume w.l.o.g. that \(p'_{y}\ge (1-\delta )p_{y}\).

In order to show that \(\ell (p,p')\subseteq P{\setminus }\mathrm {sr}(P)\) it suffices to show that \(\ell (p,p')\cap \mathrm {sr}(P)=\emptyset \) since \(p,p'\in P\) and P is convex. Let \({\bar{p}}\in \ell (p,p')\) be a point. Let R be the ray that starts in \(\mathrm {mid}(P)\) and goes through \({\bar{p}}=({\bar{p}}_{x},{\bar{p}}_{y})\). Let \({\tilde{p}}=({\tilde{p}}{}_{x},{\tilde{p}}{}_{y})\) be the (unique) point on the boundary of P that lies on R. Similarly, let \({\tilde{p}}'=({\tilde{p}}'{}_{x},{\tilde{p}}'{}_{y})\) be the (unique) point on the boundary of \(\mathrm {sr}(P)\) that lies on R. It suffices to show that \({\bar{p}}_{y}\ge {\tilde{p}}'_{y}\). We have that \(p_{y}\ge {\tilde{p}}{}_{y}\ge {\bar{p}}_{y}\ge p'_{y}\ge (1-\delta )p_{y}\). Also, it holds that \({\tilde{p}}'_{y}=(1-\delta ){\tilde{p}}{}_{y}\). Therefore we have that \({\bar{p}}_{y}\ge (1-\delta ){\tilde{p}}{}_{y}={\tilde{p}}'_{y}\). \(\square \)

We group the polygons by their diameters. For each polygon P denote by \(\mathrm {diam}(P)\) its diameter. We do our grouping to achieve two goals: we want that within each group the diameters of the polygons differ by at most a factor \(O_{\delta ,\epsilon }(1)\) and between two groups the diameters differ by at least a factor \(\frac{1}{K^{2}\delta }\).

Lemma 2

By losing a factor of \(1+\epsilon \) in the value of the optimal solution, we can assume that there is a partition of the polygons \(\mathcal {P}\) into \(O_{\delta ,\epsilon }(\log N)\) groups \(\mathcal {P}_{i}\) and values \(\mu '_{i},\mu _{i}\in {\mathbb {N}}\) for each group \(\mathcal {P}_{i}\) such that

  • \(\mu '_{i}\le \mathrm {diam}(P)<\mu _{i}\ \) for each \(P\in \mathcal {P}_{i}\) and

  • \(\delta \epsilon ^{2}/K^{2}\cdot \mu '_{i}=\mu _{i+1}\) and \(\mu _{i}/\mu '_{i}=(1/(\delta K^{2}))^{1/\epsilon }\) for each i.

Proof

We first group the polygons in \(\mathcal {P}\) into groups \({\bar{\mathcal {P}}}_{1},\ldots ,{\bar{\mathcal {P}}}_{m}\) for \(m=O(\log N)\) based on their diameters, where for each \(j\in \{1,\ldots ,m\}\) we have that

$$\begin{aligned} {\bar{\mathcal {P}}}_{j}=\left\{ P_{i}:\mathrm {diam}(P_{i})\in \left[ \left( \frac{K^{2}}{\delta \epsilon ^{2}}\right) {}^{j-1},\left( \frac{K^{2}}{\delta \epsilon ^{2}}\right) ^{j}\right) \right\} . \end{aligned}$$

Then, we group every \(1/\epsilon \) consecutive groups \({\bar{\mathcal {P}}}_{j}\) together to obtain supergroups. We define supergroups with respect to different values of “shifts” as follows. For each shift \(s\in \{0,\ldots ,1/\epsilon -1\}\) and for each \(i\ge 1\) we define the supergroup \(\mathcal {T}_{s,i}:=\bigcup _{j=s+(i-1)/\epsilon +1}^{s+i/\epsilon -1}{\bar{\mathcal {P}}}_{j}\). Notice that for each fixed s, if we took the union of the supergroups \(\mathcal {T}_{s,i}\), we would get \(\mathcal {T}_{s}=\bigcup _{i}\mathcal {T}_{s,i}=\bigcup _{j:j\ne s \, \text{(mod } 1/\epsilon )}{\bar{\mathcal {P}}}_{j}\).

We claim that \(\sum _{s=1}^{1/\epsilon }\mathrm {OPT}(\mathcal {T}_{s})\ge (1-\epsilon )\mathrm {OPT}/\epsilon \). Let \(\mathcal {P}^{*}\) be an optimal solution. We argue that \(\sum _{s=1}^{1/\epsilon }w(\mathcal {T}_{s}\cap \mathcal {P}^{*})\ge (1-\epsilon )w(\mathcal {P}^{*})/\epsilon \). Notice that each polygon \(P_{i}\in \mathcal {P}^{*}\) appears in \((1/\epsilon )-1\) terms on the left-hand-side. More precisely, only if \(P_{i}\in \mathcal {P}_{j}\) where \(j=s\, \text{(mod } 1/\epsilon )\) the contribution from polygon \(P_{i}\) does not appear. It follows that \(\sum _{s=1}^{1/\epsilon }\mathrm {OPT}(\mathcal {T}_{s})\ge (1-\epsilon )\mathrm {OPT}/\epsilon \). Thus, there must be a shift \(s\in \{0,\ldots ,1/\epsilon -1\}\) such that \(w(\mathcal {T}_{s}\cap \mathcal {P}^{*})\ge (1-\epsilon )w(\mathcal {P}^{*})\). For each supergroup \(\mathcal {T}_{s,i}\) this yields values \(\mu '_{i},\mu _{i}\) such that \(\mu '_{i}\le \mathrm {diam}(P)<\mu _{i}\ \) for each \(P\in \mathcal {T}_{s,i}\) and additionally for each i we have that \(\delta \epsilon ^{2}/K^{2}\cdot \mu '_{i}=\mu _{i+1}\) and \(\mu _{i}/\mu '_{i}=(1/(\delta K^{2}))^{1/\epsilon }\). Finally, we define \(\mathcal {P}_{i}:=\mathcal {T}_{s,i}\) for each i. \(\square \)

3.1 Hierarchical Grids

We define a family of hierarchical vertical grids \(G_{0},G_{1},\ldots ,G_{m}\) with \(m=O(\log N)\). For each \(i\in \{0,\ldots ,m\}\) we define \(G_{i}:=\{\{x\}\times {\mathbb {R}}|\exists k\in {\mathbb {N}}\,\mathrm {s.t.}\,x=k\cdot g_{i}\}\) with \(g_{i}:=\frac{\delta \epsilon }{4K^{2}}\cdot \mu '_{i}\). Observe that the grids are hierarchical, i.e., each grid line of \(G_{i}\) is also grid line of \(G_{i'}\) for each \(i'>i\). We give these grids a random rotation. We rotate all of them by the same angle \(\alpha \). This angle \(\alpha \) is drawn uniformly at random from the range \([\pi /4,\pi /2]\). Let \(\ell \) be a line of the grids. We are interested in the angle between \(\ell \) and the edges of the polygons. We say that \(\ell \) and a line segment \(\ell '\) have a good angle if the angle between \(\ell \) and the line containing \(\ell '\) have an angle of at least \(\epsilon /K^{2}\) and at most \(\frac{\pi }{2}-\epsilon /K^{2}\), otherwise we say that they have a bad angle.

Lemma 3

Let \(P\in \mathcal {P}\). With probability at least \(1-O(\epsilon )\) all line segments connecting two vertices of P and all line segments connecting \(\mathrm {mid}(P)\) with a vertex of P have a good angle with all grid lines.

Proof

The polygon P has at most K vertices. Thus, there are at most \(K(K-1)/2\) line segments connecting two of its vertices. Also, there are at most K line segments connecting \(\mathrm {mid}(P)\) with a vertex of P. This gives \(O(K^{2})\) segments in total. The probability that one of these segments has a bad angle with \(\ell \) is at most \(O(\epsilon /K^{2})\). By the union bound, with probability at least \(1-O(\epsilon )\) each such segment has a good angle with \(\ell \). \(\square \)

We delete all polygons P that have two vertices \(v,v'\) such that \(\ell (v,v')\) or \(\ell (v,\mathrm {mid}(P))\) has a bad angle with the grid lines. Next, we give the grids a random shift upwards without changing their angles. Let \(\ell \) denote an arbitrary vertical line. We observe that \(\ell \) intersects all lines in \(G_{0}\). Denote by L the distance of any two consecutive points on \(\ell \) which intersect a point of \(G_{0}\). We draw a value \(L'\in [0,L)\) uniformly at random and shift all grid lines up by \(L'\) units. For simplicity, denote by \(G_{0},G_{1},\ldots ,G_{m}\) the grid lines after this shift.

Lemma 4

Every \(P\in \mathcal {P}_{i+1}\) intersects a grid line of \(G_{i}\) with probability at most \(2\epsilon \).

Proof

Since \(P\in \mathcal {P}_{i+1}\) we have that \(\mathrm {diam}(P)\le \mu _{i+1}\). The spacing between two grid lines of \(G_{i}\) is \(g_{i}=\frac{\delta \epsilon }{2K^{2}}\cdot \mu '_{i}\) and \(\mu '_{i}=\mu _{i+1}\cdot \frac{K^{2}}{\delta \epsilon ^{2}}\). Thus, \(\mathrm {diam}(P)\le \mu '_{i}\cdot \delta \epsilon ^{2}/K^{2}=2\epsilon \cdot g_{i}\) which implies that P intersects a grid line of \(G_{i}\) with probability at most \(2\epsilon \). \(\square \)

For each \(i\in {\mathbb {N}}\) we delete all polygons \(P\in \mathcal {P}_{i+1}\) that intersect a grid line of \(G_{i}\). Due to Lemma 4 this costs at most a factor of \(1-2\epsilon \) in the objective. Since the grids are hierarchical, if a polygon \(P\in \mathcal {P}_{i+1}\) does not intersect a grid line of \(G_{i}\) then it does not intersect a grid line of \(G_{i'}\) for any \(i'\ge i\).

3.2 Shrinking

Next, we want to shrink the polygons. Intuitively, for each polygon \(P\in \mathcal {P}_{i}\) let \(v^{\uparrow }(P)\) and \(v^{\downarrow }(P)\) denote the top-most and bottom-most vertices “relative to the grid lines”. Formally, we define \(v^{\uparrow }(P)\) and \(v^{\downarrow }(P)\) to be the two vertices of P for which there exists a line \(\ell \) parallel to the rotated grid lines that intersects \(v^{\uparrow }(P)\) (intersects \(v^{\downarrow }(P)\)) and no point in the interior of P, see Fig. 3.

We shrink P to a polygon \(P'\) such that \(v^{\uparrow }(P')\) and \(v^{\downarrow }(P')\) lie on grid lines of \(G_{i}\). The next lemma shows that this is indeed possible. Heart of this reasoning is that there are at least \(1/\delta \) grid lines of \(G_{i}\) between \(v^{\uparrow }(P)\) and \(v^{\downarrow }(P)\). We do this operation with all input polygons.

Lemma 5

Let \(P\in \mathcal {P}_{i}\). In polynomial time we can compute a polygon \(P'\) with at most \(K+2\) edges such that \(\mathrm {sr}(P)\subseteq P'\subseteq P\) and \(v^{\uparrow }(P')\) and \(v^{\downarrow }(P')\) lie on grid lines of \(G_{i}\). Furthermore, all edges of \(P'\) crossing a grid line of \(G_{i}\) in a non-zero angle have a good angle with this grid line. Furthermore, \(\mathrm {diam}(P')\le \mathrm {diam}(P)\).

Proof

For ease of notation, we define a distance measure given by the grid lines. For any two points \(p,p'\) we define the quantity \(\mathrm {dist}_{\mathrm {grid}}(p,p')\) as the distance between the two lines \(\ell _{1},\ell _{2}\) that are parallel to the grid lines and that go through p and \(p'\), respectively, see Fig. 3.

Let \(\ell _{\mathrm {mid}}\) denote a line parallel to the grid lines that goes through \(\mathrm {mid}(P)\). Recall that we assumed that the width of each bounding box is larger than its height. Due to our range for the angles of the grid, \(\ell _{\mathrm {mid}}\) intersects the top and bottom edge of the bounding box of P but not its left or right edge. Consider a vertex \(v_{L}\) of P that lies on the left edge of the bounding box of P. We know that \(\ell (\mathrm {mid}(P),v_{L})\) has a good angle with the grid. Also, \(\mathrm {dist}(\mathrm {mid}(P),v_{L})\ge \frac{1}{4}\mathrm {diam}(P)\). Therefore, \(\mathrm {dist}_{\mathrm {grid}}(\mathrm {mid}(P),v_{L})\ge \frac{\epsilon }{4K^{2}}\mathrm {diam}(P)\ge \frac{\epsilon }{K^{2}}\cdot \frac{1}{4}\mu '_{i}\). The line \(\ell _{\mathrm {mid}}\) splits the plane into two sides. Assume w.l.o.g. that \(v^{\uparrow }(P)\) lies on the same side as \(v_{L}\). This implies that also \(\mathrm {dist}_{\mathrm {grid}}(\mathrm {mid}(P),v^{\uparrow }(P))\ge \frac{\epsilon }{K^{2}}\cdot \frac{1}{4}\mu '_{i}\).

Fig. 3
figure 3

Shrinking the polygon so that the points \(v^{\uparrow }(P),v^{\downarrow }(P)\) lie on grid lines (proof of Lemma 5). The bold lines denote the boundary of the polygon P. The light gray areas denote the regions \(S(\ell _{T},\ell _{T}')\) and \(S(\ell _{B},\ell _{B}')\). The dark gray area show the new polygon \(P'\). The bold dashed lines are the lines of \(G_{i}\)

Similarly, consider a vertex \(v_{R}\) of P that lies on the right edge of the bounding box of P. We have that \(v^{\downarrow }(P)\) lies on the same side of \(\ell _{\mathrm {mid}}\) as \(v_{R}\). Also, we can show like above that \(\mathrm {dist}_{\mathrm {grid}}(\mathrm {mid}(P),v^{\downarrow }(P))\ge \frac{\epsilon }{K^{2}}\cdot \frac{1}{4}\mu '_{i}\).

Now let \(\ell _{T}\) be the top-most line of \(G_{i}\) that intersects P. Let \(\ell _{T}'\) be the next higher grid line of \(G_{i}\) above \(\ell _{T}\) and let \(S(\ell _{T},\ell _{T}')\) denote the stripe enclosed by them. We remove all points in \(P\cap S(\ell _{T},\ell _{T}')\) from P. We do the same operation with the bottom-most line \(\ell _{B}\) of \(G_{i}\) intersecting P. Denote by \(P'\) the resulting polygon. Since there are \(1/\delta \) grid lines of \(G_{i}\) crossing \(\ell (\mathrm {mid}(P),v^{\uparrow }(P))\) and \(\ell (\mathrm {mid}(P),v^{\downarrow }(P))\) we have that \(\mathrm {sr}(P)\subseteq P'\). The other claimed properties of \(P'\) follow by construction. \(\square \)

3.3 Horizontal Grids

From now on we do not shrink the polygons any further. Let us assume w.l.o.g. that the grid lines \(G_{0},G_{1},\ldots ,G_{m}\) are exactly vertical and that there is an integer \(N'\) such that the input polygons are contained in the area \([0,N']\times [0,N']\) for some integer \(N'=O(N)\). We add a hierarchy of horizontal grids \({\bar{G}}_{0},{\bar{G}}_{1},\ldots ,{\bar{G}}_{m}\) to the vertical grids \(G_{0},G_{1},\ldots ,G_{m}\). For each \(i\in \{0,\ldots ,m\}\) we define \({\bar{G}}_{i}:=\{{\mathbb {R}}\times \{y\}|\exists k\in {\mathbb {N}}\,\mathrm {s.t.}\,y=k\cdot g_{i}\}\) with (as defined before) \(g_{i}=\frac{\delta \epsilon }{2K^{2}}\cdot \mu '_{i}\). Thus, for each i the grid \({\bar{G}}_{i}\) has exactly the same spacing as \(G_{i}\). We give the horizontal grids \({\bar{G}}_{i}\) a random shift up. Formally, we draw a value \(L'\in [0,g_{0})\) uniformly at random and shift each grid line \({\bar{G}}_{i}\) up by \(L'\) units. Then, for each \(i\in \{0,\ldots ,m\}\) we delete all remaining polygons from \(\cup _{j>i+1}\mathcal {P}{}_{i}\) that intersect a grid line in \({\bar{G}}_{i}\). The following lemma can be proven similarly as Lemma 4. Like in that lemma, the key argument is that for each \(P\in \mathcal {P}{}_{i+1}\) it holds that \(\mathrm {diam}(P)\le 2\epsilon \cdot g_{i}\) and observe here that due to the shrinking procedure the diameter of each polygon did not increase (see the last property of Lemma 5).

Lemma 6

Each \(P\in \mathcal {P}{}_{i+1}\) intersects a grid line of \({\bar{G}}_{i}\) with probability at most \(2\epsilon \).

Denote by \(\mathcal {P}'\) the resulting set of shrunk polygons. For each integer i we define \(\mathcal {P}'_{i}\) to be the sets of polygons we obtain when shrinking each polygon in \(\mathcal {P}_{i}\). Note that we lost only a factor of \((1+O(\epsilon ))\) in our approximation ratio (see Lemmas 2, 4 and 6).

4 Dynamic Program

Our algorithm is a geometric divide-and-conquer algorithm similar to the algorithm used in [1, 3]. It recursively divides the area containing the input polygons into smaller and smaller pieces. When it makes a recursive call for a piece \(A\subseteq [0,N']^{2}\) then it computes a (near-optimal) solution to the subproblem given by all input polygons that are contained in A. To do this, it tries all possibilities to partition A into at most \(k=O_{\delta ,\epsilon }(1)\) subpieces such that the boundary of each of them consists of at most k line segments out of a suitable set \(\mathcal {L}\) defined below. Then, it makes a recursive call on each of these subpieces and obtains a (near-optimal) solution for each of those. By putting them together, it obtains a candidate solution for the original piece A. Additionally, it checks what profit it can obtain by selecting only one polygon that is contained in A. Eventually, it returns the best solution out of all candidate solutions stemming from all partitions of A and all single polygons contained in A. We will show that if the parameter k is sufficiently large then our algorithm will output a set that is at least as profitable as the optimal solution for \(\mathcal {P}'\).

We embed the whole procedure into a dynamic program (DP). Let \(k=O_{\delta ,\epsilon }(1)\) be a parameter to be defined later. Our DP table has one cell for each (not necessarily convex) area \(A\subseteq [0,N']^{2}\) whose boundary consists of at most k line segments such that

  • each line segment is a subset of an edge of a polygon in \(\mathcal {P}'\) or a subset of a grid line in \(\mathcal {G}:=\cup _{i=0}^{m}G_{i}\cup {\bar{G}}_{i}\) and

  • the endpoint of each line segment is

    • the vertex of a polygon in \(\mathcal {P}'\), or

    • the intersection of an edge of a polygon in \(\mathcal {P}'\) with a grid line in \(\mathcal {G}\), or

    • the intersection of two grid lines in \(\mathcal {G}\).

Fig. 4
figure 4

An instance of \(\delta \)-MWISCP. The black circles denote all possible endpoints of the lines in \(\mathcal {L}\): vertices of the polygons, intersections of polygon edges with grid lines, and intersection of two grid lines. Each line in \(\mathcal {L}\) is a subset of an input polygon or a subset of a grid line. Hence, each line in \(\mathcal {L}\) is contained in one of the bold lines in the Figure

We call such an area A a piece. Denote by \(\mathcal {L}\) the set of all line segments that arise on the boundaries of the pieces defined above, see Fig. 4 for an example. Denote by GEO-DP this dynamic program. As the following lemma shows, it has pseudo-polynomial running time. We will explain later how to improve this to polynomial time.

Lemma 7

The number of DP-cells is bounded by \((n+N)^{O_{\delta ,\epsilon }(k)}\). If \(k=O_{\epsilon ,\delta }(1)\) then the overall running time of GEO-DP is also bounded by \((n+N)^{O_{\delta ,\epsilon }(1)}\).

Proof

First, we upper bound the total number of possible endpoints of line segments in \(\mathcal {L}\). Each polygon in \(\mathcal {P}'\) has at most \(K+2\) vertices and edges. The total number of grid lines is bounded by \(O_{\delta ,\epsilon }(N)\). Thus, the total number of endpoints of line segments in \(\mathcal {L}\) is bounded by \(O_{\delta ,\epsilon }(n\cdot K\cdot N+N^{2})\) and therefore \(|\mathcal {L}|\le O_{\delta ,\epsilon }(n^{2}\cdot K^{2}\cdot N^{2}+N^{4})\). Hence, the number of DP-cells is at most \((n\cdot K\cdot N)^{O_{\delta ,\epsilon }(k)}=(n+N)^{O_{\delta ,\epsilon }(k)}\) since \(K=O_{\delta }(1)\). When we compute an entry of a DP-cell for a piece A we need to enumerate all partitions of A into at most k smaller pieces. This can be done in time \((n+N)^{O_{\delta ,\epsilon }(k^{2})}\) which is bounded by \((n+N)^{O_{\delta ,\epsilon }(1)}\) if \(k=O_{\epsilon ,\delta }(1)\). \(\square \)

There is a piece containing all input polygons. Thus, the subproblem corresponding to this piece is identical to the problem we want to solve. Our final output is the solution computed for this piece. We want to show that its solution is at least as profitable as the optimal solution for \(\mathcal {P}'\). In order to show this we assume w.l.o.g. that the input to GEO-DP consists only of this optimal solution for \(\mathcal {P}'\). We denote it \(\mathcal {P}''\). We define \(\mathcal {P}''_{i}:=\mathcal {P}'_{i}\cap \mathcal {P}''\) for each i.

In the remainder of this section, we prove that GEO-DP computes a solution whose profit is at least \(w(\mathcal {P}'')\ge (1-O(\epsilon ))\cdot \mathrm {OPT}(\mathcal {P})\). To this end, we describe a recursive sequence of cuts that subdivides the input area \([0,N']\times [0,N']\) into smaller and smaller pieces such that (i) for each arising piece there is a DP-cell, (ii) no polygon in \(\mathcal {P}''\) is intersected by any of these cuts, and (iii) each of the pieces obtained at the end has non-empty intersection with at most one polygon from \(\mathcal {P}''\). In Sect. 4.1 we formalize such a sequence and prove that if it exists then GEO-DP computes a solution of weight at least \(w(\mathcal {P}'')\). In Sect. 4.2 we prove that it indeed exists for a suitable choice of \(k=O_{\delta ,\epsilon }(1)\). Finally, in Sect. 4.3 we explain how this yields our main algorithm.

4.1 Cutting Sequence

We describe a sequence of cuts that recursively subdivides the whole area \([0,N']\times [0,N']\) and “cuts out” all polygons in \(\mathcal {P}''\). It ensures that for each piece arising in the sequence there exists a DP-cell according to the above definition and that each cut for such a piece partitions it into at most k smaller pieces.

Formally, we describe this sequence of cuts by a tree T where each node v is associated with a piece \(A_{v}\) in the plane. We say that a tree T is a \((k,\mathcal {P}'')\) -region decomposition if the following holds:

  • For each node v in T and each polygon \(P\in \mathcal {P}''\) we have that if P does not coincide with \(A_{v}\), i.e., \(P\ne A_{v}\), then either P is contained in \(A_{v}\) or P is disjoint from \(A_{v}\).

  • For tree nodes u and v such that v is a parent of u we have \(A_{u}\subseteq A_{v}\). Each node \(v\in T\) has at most \(k'\le k\) children \(u_{1},\ldots ,u_{k'}\) in T and \(\bigcup _{i=1}^{k'}A_{u_{i}}=A_{v}\).

  • For each leaf node v of T the piece \(A_{v}\) contains at most one polygon in \(\mathcal {P}''\) and it has empty intersection with all other polygons in \(\mathcal {P}''\).

  • For each node v in T the area \(A_{v}\) is connected and its boundary can be described by at most k line segments from \(\mathcal {L}\).

Note that a similar type of decomposition was also used in [1].

Lemma 8

If there exists a \((k,\mathcal {P}'')\)-region decomposition then GEO-DP outputs a solution of weight at least \(w(\mathcal {P}'')\) when it is parametrized by k.

Proof

We assume that for the set of (pairwise non-overlapping) polygons \(\mathcal {P}''\) there exists a \((k,\mathcal {P}'')\)-region decomposition. Let T be the tree that represents the region decomposition for \(\mathcal {P}''\). We now prove the following statement by induction on the structure of T from its leaves to the root:

Consider a node \(u\in T\). When GEO-DP processes the instance given by the polygons \(\mathcal {P}'\) that are contained in \(A_{u}\) it outputs a set of polygons \(\mathcal {P}''_{u}\) whose weight \(w(\mathcal {P}''_{u})\) is at least the total weight of the polygons in \(\mathcal {P}''\) that are contained in \(P_{u}\).

In particular, for the root node r with \(A_{r}=[0,N']\times [0,N']\) this implies that GEO-DP computes a set of polygons \(\mathcal {P}''_{r}\) with weight \(w(\mathcal {P}''_{r})=w(\mathcal {P}'')\) as desired. The base case is obvious: for each leaf node v its piece \(A_{v}\) coincides with a polygon \(P_{i}\in \mathcal {P}''\) and thus \(P_{i}\) is contained in \(A_{v}\). Hence, GEO-DP returns a solution whose weight is at least \(w(P_{i})\). For the inductive step consider a node v for which the induction hypothesis holds for all children of v. Let \(\mathcal {P}''_{v}\) denote all polygons from \(\mathcal {P}''\) that are contained in \(P_{v}\). Denote the children of v by \(v_{1},\ldots ,v_{k'}\) for some \(k'\le k\). We have that \(A_{v}=\bigcup _{j=1}^{k'}A_{v_{j}}\) and that the pieces \(A_{v_{1}},\ldots ,A_{v_{k'}}\) are pairwise disjoint. For each \(j\in \{1,\ldots ,k'\}\) let \(\mathcal {P}''_{v_{j}}\) denote the polygons from \(\mathcal {P}''\) that are contained in \(A_{v_{j}}\). The sets \(\mathcal {P}''_{v_{j}}\) form a partition since each polygon in \(\mathcal {P}''_{v}\) is contained in some piece \(A_{v_{j}}\). In particular, this implies that \(w(\mathcal {P}''_{v})=\sum _{j=1}^{k'}w(\mathcal {P}''_{v_{j}})\). Moreover, GEO-DP considers the cut which partitions \(A_{v}\) into \(A_{v_{1}},\ldots ,A_{v_{k'}}\) and returns, by the induction hypothesis, a solution \({\bar{\mathcal {P}}}_{v}\) consisting of one solution \({\bar{\mathcal {P}}}_{v_{j}}\) for each piece \(A_{v_{j}}\) such that \(w({\bar{\mathcal {P}}}_{v})=\sum _{j=1}^{k'}w({\bar{\mathcal {P}}}_{v_{j}})\ge \sum _{j=1}^{k'}w(\mathcal {P}''_{v_{j}})=w(\mathcal {P}''_{v})\). This completes the proof. \(\square \)

The proof of Lemma 8 is identical to the proof of a similar lemma in [1].

4.2 Existence of Region Decomposition

In this section we prove that a \((k,\mathcal {P}'')\)-region decomposition always exists. Formally, we prove the following lemma.

Lemma 9

There exists a universal constant \(k=O_{\delta ,\epsilon }(1)\) such that a \((k,\mathcal {P}'')\)-region decomposition exists.

To construct the \((k,\mathcal {P}'')\)-region decomposition we need to construct its tree T and a piece \(A_{v}\) for each vertex v of T. For the root node \(v_{r}\) we define its region \(A_{v_{r}}\) to be the cell of an artificial grid \(G_{-1}\cup {\bar{G}}_{-1}\) that has exactly one cell that contains \([0,N']\times [0,N']\). Inductively, we describe the procedure to construct T. Assume that we are given a leaf \(v\in T\) whose piece \(A_{v}\) is described as follows: there is a cell C of the grid \(G_{i-1}\cup {\bar{G}}_{i-1}\) for some \(i\in \mathbb {N}_{0}\) and up to two polygons \(P_{1},P_{2}\in \cup _{j=0}^{i-1}\mathcal {P}''_{j}\) such that each of them intersects both the left and the right grid line of C. Also, we assume that \(A_{v}\) does not intersect any polygon in \(\cup _{j=0}^{i-1}\mathcal {P}''_{j}\). We denote these conditions as the invariant. Observe that \(v_{r}\) fulfills it. If \(A_{v}\) contains at most one polygon from \(\mathcal {P}''\) and has non-empty intersection with all other polygons in \(\mathcal {P}''\) then we do not do anything further with v. Otherwise, we describe how to divide \(A_{v}\) step by step into smaller and smaller pieces, until each arising piece \(A_{v'}\) satisfies the invariant for some cell \(C'\) of \(G_{i}\cup {\bar{G}}_{i}\) and up to two polygons \(P_{1}',P_{2}'\). To describe this partitioning of \(A_{v}\) we create a subtree rooted at v, i.e., for each vertex \(v'\) of the subtree there is a region \(A_{v'}\) which corresponds to one piece of this partitioning. Observe that \(A_{v}\) is the connected component of \(C{\setminus }\{P_{1},P_{2}\}\) that is adjacent to \(P_{1}\) and \(P_{2}\). Note that there is a DP-cell for \(A_{v}\). Assume w.l.o.g. that \(P_{1}\) crosses the left and right grid lines of C below \(P_{2}\). One or both polygons \(P_{1}\) and \(P_{2}\) might be undefined and in this case the bottom and/or top boundaries of C take the role of \(P_{1}\) and/or \(P_{2}\).

We define a cut through \(A_{v}\), see Fig. 5 for a sketch. Let \(\ell _{1}\) be a grid line of \(G_{i}\) such that \(\ell _{1}\) intersects the interior of \(A_{v}\). Let p be the bottom-most point of \(\ell _{1}\cap A_{v}\). Note that at this point \(\ell _{1}\) intersects the boundary of \(P_{1}\). Our cut starts in p and moves up along \(\ell _{1}\). If we do not hit any polygon of \(\mathcal {P}''\) contained in \(A_{v}\) on the way up then we are done with our cut. Otherwise, suppose that we hit an edge e of a polygon P. Let \(p'\) denote the point on e that is hit by \(\ell _{1}\). Due to Lemma 3 we know that e has a good angle with \(\ell _{1}\). Also, \(P\in \mathcal {P}''_{i}\) since otherwise it would have been deleted before as it intersects a grid line of \(G_{i}\). Our cut moves along e in the direction that goes up. We continue along the boundary of P in the same direction until we arrive at the leftmost or rightmost point of P. Let \(p''\) denote this point. Due to our shrinking, \(p''\) lies on a grid line \(\ell '\) of \(G_{i}\). Since all edges of P have a good angle with the grid, we can prove the following lemma.

Fig. 5
figure 5

Left the first cut Q that separates the piece \(A_{v}\) (given by the area in the cell C between the polygons \(P_{1}\) and \(P_{2}\)) into two smaller pieces. The point p is defined as the bottom-most point of \(\ell _{1}\cap A_{v}\) and \(\ell _{1}\) intersects the boundary of \(P_{1}\) on p. Right a piece (consisting of \(A_{1}\cup P\cup A_{2}\)) for which there is no grid line that intersects \(P_{1}\) on the boundary of the piece (first case in the proof of Lemma 11)

Lemma 10

When moving from \(p'\) to \(p''\) along the edge of P, we move up by at least \(\sin (\epsilon ^{2}/K)\cdot g_{i}=\Omega _{\delta ,\epsilon }(1)\cdot g_{i}\).

Proof

Since all edges of P have a good angle with the grid lines, this angle is at least \(\epsilon ^{2}/K\). Therefore, when we move from \(p'\) to \(p''\) we move up by at least \(\mathrm {dist}(p',p'')\cdot \sin (\epsilon ^{2}/K)\ge \sin (\epsilon ^{2}/K)\cdot g_{i}\) units. \(\square \)

Note that the contructed path from p via \(p'\) to \(p''\) consists of at most \(K+1\le O_{\delta ,\epsilon }(1)\) line segments. We continue iteratively where now \(p''\) takes the role of p. We stop when we hit the upper boundary of \(A_{v}\) (defined by \(P_{2}\) or the top boundary of C). Denote by Q the constructed path. The height of C is bounded by \(g_{i-1}=O_{\delta ,\epsilon }(g_{i})\). In every iteration we move up by at least \(\Omega _{\delta ,\epsilon }(1)\cdot g_{i}\) units. Thus, there are at most \(O_{\delta ,\epsilon }(1)\) iterations and Q can be described with \(O_{\delta ,\epsilon }(1)\cdot (K+1)\) line segments. Observe that we cut only along edges of polygons and along grid lines of \(G_{i}\). Thus, we did not intersect any polygon from \(\mathcal {P}''\).

Our path Q splits \(A_{v}\) into two smaller pieces. Each of the two sides of \(A_{v}{\setminus } Q\) defines a piece and for each of them we append a child node \(u_{i}\) to v such that \(A_{u_{i}}\) equals this piece. Importantly, each such piece is described by only \(C,P_{1},P_{2}\) and Q and thus its boundary has only \(O_{\delta ,\epsilon }(1)\) line segments. We continue with each newly created piece \(A_{u_{i}}\). Assume that there is a grid line \(\ell _{2}\) of \(G_{i}\) such that \(\ell _{2}\) intersects the boundary of \(P_{1}\) at a point \({\bar{p}}\) that lies on the boundary of \(A_{u_{i}}\). Then \({\bar{p}}\) takes the role of p above and we find a path \(Q'\) that split \(A_{u_{i}}\) into two pieces. We append these pieces in T as child nodes of \(u_{i}\). Each such piece is then described by \(C,P_{1},P_{2},Q\) and \(Q'\) and thus its boundary has at most \(O_{\delta ,\epsilon }(1)\) edges.

Consider a child node \(\bar{u}_{j}\) of \(u_{i}\). Similarly as before, assume that there is a grid line \(\ell _{3}\) of \(G_{i}\) such that \(\ell _{3}\) intersects the boundary of \(P_{1}\) at a point that lies on the boundary of \(A_{\bar{u}_{j}}\). We compute a path \(Q''\) though \(A_{\bar{u}_{j}}\) as above. Each connected component of \(A_{\bar{u}_{j}}{\setminus } Q''\) can be described by \(C,P_{1},P_{2}\) and at most two of the paths \(Q,Q',Q''\). Similarly, when we continue further like above in the recursion each resulting piece can be described by \(C,P_{1},P_{2}\) and two paths \(Q_{1},Q_{2}\) through \(A_{v}\) where each of the latter can be described by only \(O_{\delta ,\epsilon }(1)\) line segments.

We can apply the above reasoning as long as there is a grid line \(\ell _{k}\) of \(G_{i}\) such that the boundary of \(P_{1}\) intersects \(\ell _{k}\) at a point that lies on the boundary of the considered piece. Suppose now that this is not possible, i.e, we have a piece \(A_{\tilde{v}}\subseteq A_{v}\) such that at the boundary of \(A_{\tilde{v}}\) there is no grid line of \(G_{i}\) that intersects \(P_{1}\). As the next lemma shows, this piece can then be partitioned into two smaller pieces \(A_{1},A_{2}\) and one polygon \(P'_{1}\), see Fig. 5.

Lemma 11

Assume that in the above construction we obtain a piece \(A_{\tilde{v}}\) such that on the boundary of \(A_{\tilde{v}}\) there is no point where a grid line of \(G_{i}\) intersects \(P_{1}\). Then either \(A_{\tilde{v}}\) is contained in a grid column of \(G_{i}\) or \(A_{\tilde{v}}\) can be partitioned into two pieces \(A_{1},A_{2}\) and one polygon \(P'_{1}\) such that

  • the boundary of \(A_{1}\) consists of two paths \(Q_{1}^{(1)},Q_{1}^{(2)}\) with at most \(O_{\delta ,\epsilon }(1)\) edges each that both connect \(P_{1}\) and \(P'_{1}\), and

  • the boundary of \(A_{2}\) consists of two paths \(Q_{2}^{(1)},Q_{2}^{(2)}\) with at most \(O_{\delta ,\epsilon }(1)\) edges each that both connect \(P'_{1}\) and \(P_{2}\).

Proof

Assume that \(A_{\tilde{v}}\) is not contained in a grid column of \(G_{i}\) (otherwise there is nothing to show). By construction \(A_{\tilde{v}}\) is described by two paths \(Q_{1},Q_{2}\) that both connect \(P_{1}\) and \(P_{2}\). There is no point on the boundary of \(A_{\tilde{v}}\) in which a grid line of \(G_{i}\) intersects \(P_{1}\). Thus, for the points \(p_{1}\) and \(p_{2}\) on which the paths \(Q_{1}\) and \(Q_{2}\) start, there must be two consecutive grid lines \(\ell ^{(1)},\ell ^{(2)}\) of \(G_{i}\) such that \(\ell ^{(1)}\) intersects \(P_{1}\) on \(p_{1}\) and \(\ell ^{(2)}\) intersects \(P_{1}\) on \(p_{2}\), see Fig. 5. Assume that \(\ell ^{(1)}\) is on the left of \(\ell ^{(2)}\). Since \(A_{\tilde{v}}\) is not contained in a grid column of \(G_{i}\) one of the paths \(Q_{1},Q_{2}\) is not completely vertical. Assume that both paths are not completely vertical (the other case can be proven with similar arguments). Let \(p'_{1},p'_{2}\) be the points on which \(Q_{1}\) and \(Q_{2}\) deviate from being only vertical. Assume w.l.o.g. that the y-coordinate of \(p'_{1}\) is not larger than the y-coordinate of \(p'_{2}\).

Assume that on \(p'_{1}\) the path \(Q_{1}\) turns left. Then on \(p'_{1}\) the path \(Q_{1}\) hits a polygon \(P\in \mathcal {P}''_{i}\). Thus, the boundary of P must intersect \(\ell ^{(2)}\) at a point p. Then the y-coordinate of this point p must be lower than the y-coordinate of \(p'_{2}\) (since \(Q_{1}\) goes monotonely upwards). Then we set \(P'_{1}:=P\) and \(A_{1}\) consists of the quadrilateral described by \(p_{1},p'_{1},p,p_{2}\), and \(A_{2}=A_{\tilde{v}}{\setminus }\{A_{1},P\}\). The paths \(Q_{1}^{(1)},Q_{1}^{(2)},Q_{2}^{(1)},Q_{2}^{(2)}\) consist of the parts of \(Q_{1}\) and \(Q_{2}\) surrounding \(A_{1}\) and \(A_{2}\), respectively.

Assume now that on \(p'_{1}\) the path \(Q_{1}\) turns right after hitting a polygon P. Then \(Q_{1}\) must cross \(\ell ^{(2)}\) at a point \(p'\). If the y-coordinate of \(p'\) is smaller than the y-coordinate of \(p'_{2}\) then we define \(P'_{1}:=P\) and we define the pieces \(A_{1},A_{2}\) and the paths \(Q_{1}^{(1)},Q_{1}^{(2)},Q_{2}^{(1)},Q_{2}^{(2)}\) similarly as in the previous case. Finally, suppose that the y-coordinate of \(p'\) is not smaller than the y-coodinate of \(p'_{2}\). Then on \(p'_{2}\) the path \(Q_{2}\) hits a polygon \(P'\) and it must turn right (since otherwise \(P\cap P'\ne \emptyset \)). Then the polygon \(P'\) must cross \(\ell ^{(1)}\) underneath \(p'_{1}\) and we define \(P'_{1}:=P'\) and the pieces \(A_{1},A_{2}\) and the paths \(Q_{1}^{(1)},Q_{1}^{(2)},Q_{2}^{(1)},Q_{2}^{(2)}\) accordingly. \(\square \)

When we continue, for the piece \(A_{1}\) the polygon \(P'_{1}\) takes the role of \(P_{2}\), and for the piece \(A_{2}\) the polygon \(P'_{1}\) takes the role of \(P_{1}\). We continue until all pieces corresponding to leaves are contained in a column of \(G_{i}\). Let \(A_{v'}\) be such a piece. \(A_{v'}\) might not yet fulfill the invariant since it might still span many grid cells of \(G_{i}\cup {\bar{G}}_{i}\). We know that each polygon \(P\in \mathcal {P}''_{i}\) intersects at least two grid columns of \(G_{i}\). Thus, there can be no polygon \(P\in \mathcal {P}''_{i}\) with \(P\subseteq A_{v'}\). Thus, the boundary of \(A_{v'}\) consists of two grid columns and (parts of) the boundary edges of at most two polygons of \(\cup _{j=0}^{i}\mathcal {P}''_{j}\), defining the upper and lower boundary of \(A_{v'}\).

As long as \(A_{v'}\) is not contained in a grid cell of \(G_{i}\cup {\bar{G}}_{i}\) there must be a grid row r of \({\bar{G}}_{i}\) such that r has non-empty intersection with the interior of \(A_{v'}\). Note that r does not intersect any of the remaining polygons in \(\cup _{j\ge i+1}\mathcal {P}''_{j}\) since we have removed such polygons before already. We split \(A_{v'}\) along r into two pieces \(A_{v''},A_{v'''}\) and add the corresponding vertices \(v''\) and \(v'''\) to T as children of \(v'\). We continue this process until each piece is contained in a grid cell of \(G_{i}\). Thus, each of our resulting pieces fulfill the invariant and we can repeat the procedure above. We apply the above procedure to each leaf node of T until for each leaf node v it holds that the piece \(A_{v}\) contains at most one polygon in \(\mathcal {P}''\) and it has empty intersection with all other polygons in \(\mathcal {P}''\). This completes the proof of Lemma 9.

4.3 Main Algorithm

With the above preparation we are ready to describe our main algorithm.

Theorem 1

For any constants \(\epsilon ,\delta >0\) there is a polynomial time \((1+\epsilon )\)-approximation algorithm for the maximum independent set of \(\delta \)-shrinkable convex polygons problem.

Proof

We parametrize GEO-DP by the constant \(k=O_{\delta ,\epsilon }(1)\) due to Lemma 9. Then together with Lemma 8 this implies that GEO-DP outputs a solution of weight at least \(w(\mathcal {P}'')\). Due to our reasoning in Sect. 3 we have that \(w(\mathcal {P}'')\ge (1-O(\epsilon ))\cdot \mathrm {OPT}(\mathcal {P})\), see Lemmas 2, 4 and 6.

It remains to address the fact that in the above form our algorithm has a running time that might be exponential in the input size (since N might be exponential). We argue similarly as in [1]. First observe that there are only \(O(\log N)\) recursion levels, which is polynomial in the length of the input encoding. In each level of the grids, it suffices to introduce only grid cells C for which there exists a polygon \(P\in \mathcal {P}'\) with \(P\subseteq C\). There can be only n such grid cells for each grid \(\mathcal {G}_{i}\cup {\bar{\mathcal {G}}}_{i}\) and thus in total there are only \(O(n\cdot \log N)\) such cells. Hence, the total number of needed grid lines is also bounded by \(O(n\cdot \log N)\).

The preprocessing steps due to Lemmas 1, 2, and 5 can be implemented in time \((n\log N)^{O(1)}\), using that each polygon has at most n vertices and the largest arising number in the input is N. Within the same time bound we can construct the grids \(G_{i},{\bar{G}}_{i}\). Each cell in the DP-table can be decribed by \(k=O_{\delta ,\epsilon }(1)\) line segments connecting two points where each of them is a vertex of a polygon in \(\mathcal {P}'\), the intersection of an edge of a polygon in \(\mathcal {P}'\), or the intersection of two grid lines. For these points there are \(nK+(n\log N)^{O(1)}\) possibilities. Hence, there are at most \((Kn+n\log N)^{O_{\delta ,\epsilon }(1)}\) DP cells in total. To compute the solution for a DP-cell we try all possibilities to split its corresponding piece into at most \(k=O_{\delta ,\epsilon }(1)\) smaller pieces. Therefore, we obtain an overall running time of \((n+\log N)^{O_{\delta ,\epsilon }(1)}\). \(\square \)