Next Article in Journal
Non-Lie Reduction Operators and Potential Transformations for a Special System with Applications in Plasma Physics
Previous Article in Journal
Experimental Investigation on the Symmetry and Stabilization of Ethanol Spray Swirling Flames Utilizing Simultaneous PIV/OH-PLIF Measurements
Previous Article in Special Issue
Tour Route Recommendation Model by the Improved Symmetry-Based Naive Bayes Mining and Spatial Decision Forest Search
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Maximum Coverage by k Lines

1
Department of Computer Science and Engineering, Pohang University of Science and Technology, Pohang 37673, Republic of Korea
2
Department of Computer Science and Engineering, Ulsan National Institute of Science and Technology, Ulsan 44919, Republic of Korea
3
Graduate School of Artificial Intelligence, Department of Computer Science and Engineering, Pohang University of Science and Technology, Pohang 37673, Republic of Korea
*
Author to whom correspondence should be addressed.
Symmetry 2024, 16(2), 206; https://doi.org/10.3390/sym16020206
Submission received: 16 January 2024 / Revised: 2 February 2024 / Accepted: 7 February 2024 / Published: 9 February 2024
(This article belongs to the Special Issue Computer Science and Symmetry/Asymmetry: Feature Papers)

Abstract

:
Given a set of n disks in the plane, we study the problem of finding k lines that together intersect the maximum number of input disks. We consider three variants of this problem with the following constraints on the solution: (1) no constraint on the lines, (2) the k lines should be parallel and (3) the k lines should pass through a common point. For k = 2 , we give O ( n 3 log n ) -time algorithms for all three cases. For any fixed k 3 , we give an O ( n 3 k / 2 ) -time algorithm for (1). For variants (2) and (3), the running times of our algorithms vary from O ( n 4 ) to O ( n 6 ) .

1. Introduction

Given a set of n disks in the plane, we study the problem of finding k lines that together intersect the maximum number of input disks. In other words, we want to maximize the number of disks that intersect at least one output line. We study two other variants of this problem, where the k output lines should be parallel, and where the k lines should pass through a common point. The problems that we consider in this paper are the following. (See Figure 1).
Problem 1
(Maximum Coverage by k Lines). Given a set of n disks in the plane and a positive integer k, find k lines that together intersect the maximum number of input disks.
Problem 2
(Maximum Coverage by k Parallel Lines). Given a set of n disks in the plane and a positive integer k, find k parallel lines that together intersect the maximum number of input disks.
Problem 3
(Maximum Coverage by k Lines through a Point). Given a set of n disks in the plane and a positive integer k, find k lines that together intersect the maximum number of input disks and pass through a common point.
In this paper, we give algorithms for the three above problems. We will assume that k is a constant. A summary of our results is given in Table 1. In particular, for k = 1 , Problem 1, 2 and 3 coincide, and we give an O ( n 2 ) -time algorithm. Given a set of points in the plane, the problem of finding a line that covers the maximum number of points is 3SUM-hard [1], so an O ( n α ) -time algorithm for any α < 2 is currently out of reach for Problem 1, 2 and 3, even when k = 1 .

Related Work

The one-dimensional version of our problem, where we want to find a set of k points that intersect the maximum number of input intervals, is known as the partial interval hitting set problem [2]. Jansen et al. [3] and Chrobak et al. [4] gave an O ( k n 2 ) -time algorithm.
Dumitrescu and Jiang [5] showed that the problem of hitting the maximum number of input points with k lines is APX-hard. In this paper, we consider the more general problem of hitting the maximum number of disks in the plane using k lines. To the best of our knowledge, the problem of finding k lines that together intersect the maximum number of input disks (or other geometric figures) has not been studied yet.
In the most general, combinatorial setting, we are given a collection of subsets of a larger set, and we want to find k such subsets whose union is the largest. This problem is known as the maximum coverage problem, and the simple greedy algorithm provides a 1 1 / e approximation of the optimum [6]. Another maximum coverage problem was studied by Jin et al. They considered the problem of covering a maximum number of input points by k copies of the same rectangle or disk [7]. They provide linear-time approximation schemes, and give references to related problems.
The combinatorics of intersections between lines and balls have also been studied. In particular, Ha et al. showed that, for n disjoint spheres, if n 7 , then at most three different permutations of the spheres can appear along a line that crosses them all [8].
One motivation for studying maximum coverage by lines is to find line patterns in a two-dimensional dataset. Input disks may represent data points, each given with an imprecision that is equal to their radii. Other computational geometry problems have been studied under this imprecision model, such as the Hausdorff distance [9], the Delaunay triangulation [10] and the discrete Fréchet distance [11].
Our problem of finding line patterns is related to edge detection, which is a fundamental problem in image processing and computer vision, where the goal is to extract edges, lines or junctions from images [12]. Therefore, our algorithms could find applications in 3D reconstruction or image registration, by identifying the main lines or edges in the image. Our algorithms for lines through a point, or parallel lines, could help find symmetries in such an image.
Our algorithms could also be used for a facility location problem wherein one wants to place line facilities that are close to a set of demand regions; for instance, we may want to place k satellites at different orbits, that together cover the largest possible number of population centers. Line facility location has been studied by Cheung and Daescu, in the context of weighted regions [13].

2. Preliminaries and Notations

2.1. Partial Interval Hitting Set

In Section 4 and Section 5, we use a reduction to the partial interval hitting set problem [2]. Given a set of n closed intervals I j = [ s j , t j ] for j = 1 , , n on the real line, and a positive integer γ , the partial interval hitting set problem, shortly PIHS , is to find a set H of γ points that together hit the maximum number of intervals. We say that a point q hits an interval I if q I .
Chrobak et al. ([4] Section 3.1) gave a dynamic-programming algorithm for this problem which runs in O ( γ n 2 ) time. Their algorithm uses O ( n 2 ) space for pre-computing O ( n 2 ) values. We show in Section 6 that we can reduce the space usage to O ( γ n ) while keeping the same time bound. In addition, when γ = 2 , we show that we can maintain the solution for intervals with moving endpoints in O ( n ) time per event using O ( n 2 ) space.

2.2. Notations

We denote by D a set of n closed disks in the plane. We will consider that a point is a disk of radius 0. We will assume that D = , as otherwise, a trivial solution to our problem is to take a line that intersects D .
The orientation  θ of a line is the angle that it forms with horizontal. More precisely, it is the angle swept from a horizontal line to in counterclockwise direction. Therefore, we have θ [ 0 , π ) . Given an orientation θ π / 2 , and a disk D D , the lowest line with orientation θ that is not below any point of D is called the upper tangent to D with orientation θ . Similarly, the highest line with orientation θ that is not above any point of D is called the lower tangent to D with orientation θ . When θ = π / 2 , the upper tangent to D is the leftmost vertical line that is not to the left to any point of D, and the lower tangent to D is the rightmost vertical line that is not to the right to any point of D. A line is said to be tangent to D if it is either the lower or the upper tangent to D for some orientation. A line that is tangent to two different disks in D is called a common tangent of D .
Given a directed line in the plane, the orientation of denotes the angle swept from the x-axis to in the counterclockwise direction. The orientation of a directed line is in [ 0 , 2 π ) . Given a disk D and an angle θ [ 0 , 2 π ) , the directed line tangent to D with orientation θ is the directed line with orientation θ that intersects the boundary of D and that has no point of D to its right.
For a disk D and a line tangent to it, we refer to the process of rotating around D while keeping it tangent to D as rotating ℓ tangentially around D.
We say that two disks D 1 and D 2  cross if D 1 D 2 , and neither D 1 D 2 nor D 2 D 1 . In this case, D 1 and D 2 have two common tangents. Two disks in D have at most four common tangents, which happens when D 1 and D 2 are disjoint and have a positive radius. Two disks are said to be tangent if their boundaries intersect at exactly one point. We allow disks to be points, and hence have radius 0.

3. Maximum Coverage by k Lines

Given a set D of n disks in the plane and a positive integer k, we would like to find k lines that together intersect the maximum number of input disks. In this section, we give efficient algorithms for this problem by reducing it to the problem of computing the depth of a collection of boxes, which is related to Klee’s problem [14].

3.1. A First Algorithm

We begin with the observation below.
Lemma 1.
Let ℓ be a line tangent to a disk D D . Suppose that there is no common tangent between D and any other disk in D . Then, there is a common tangent between two disks in D such that any disk intersected by ℓ is intersected by .
Proof. 
As there is no common tangent between D and any other disk in D , each disk in D is either contained in D or contains D. There must be more than one disk contained in D, as otherwise, D or the disk that it contains, if it exists, is a subset of D , which we assumed to be empty (see Section 2.2), a contradiction.
There must be a pair of disks D 1 and D 2 that are both contained in D, and either cross or are disjoint. Otherwise, the j disks contained in D would form a chain of inclusions D i 1 D i 2 D i j , and we would have D i 1 D . This is a contradiction, as we assumed that D = .
We take to be a common tangent to D 1 and D 2 . Then, intersects all the disks that contain D 1 , and since only intersects these disks, the set of disks intersected by is a superset of those intersected by . □
It follows that we can choose the k lines of our solution to be common tangents between disks in D :
Lemma 2.
There exists an optimal set of k lines, each of which is a common tangent of D .
Proof. 
Let 1 be a line in an optimal set of k lines. We translate 1 in a direction orthogonal to itself until it first becomes tangent to some disk D 1 D . Let 2 denote this translated line.
Suppose that there is a common tangent between D 1 and some other disk in D . We rotate 2 tangentially around D 1 until it first becomes a line 3 tangent to some other disk D 2 . Then, the set of disks intersected by 3 contains the set of disks intersected by 1 . Therefore, we can replace 1 with 3 in our optimal solution.
On the other hand, if there is no common tangent between D 1 and any other disk in D , then by Lemma 2, we can replace 1 in our solution with a line that is a common tangent. We repeat this process until all the lines in our solution are common tangents. □
Therefore, the maximum intersection problem can be solved as follows. We first compute all the common tangents of D . Among these O ( n 2 ) lines, we choose k of them and count the number of disks that are intersected by the chosen lines. Then, we return the k lines that intersect the largest number of disks. It takes O ( n 2 k + 1 ) time in total. In the two sections below, we present more efficient algorithms.

3.2. Maximum Coverage by One Line

In this section, we assume that k = 1 . We give an O ( n 2 ) -time algorithm to solve the maximum coverage problem, which improves on the O ( n 3 ) -time algorithm described above. By Lemma 2, we only need to find a common tangent of D that intersects the maximum number of disks in D . Using the duality transformation, we can find an optimal line and the set of disks intersected by this line in O ( n 2 ) time as follows:
Theorem 1.
Given a set D of n disks in the plane, we can find a line that intersects the maximum number of disks in O ( n 2 ) time.
Proof. 
We use a standard point-line duality transformation ([15] Chapter 8). A line : y = a x b in the primal plane corresponds to a point * = ( a , b ) in the dual plane. For a disk D, let U D be the set of all upper tangents to D. Then, the set of points U D * = { * : U D } forms a curve in the dual plane. Analogously, we define V D to be the set of all lower tangents to D and consider the curve V D * formed by the points { * : V D } . We compute these two dual curves for all disks in D and compute the arrangement of them. As these curves are algebraic curves of constant degree, their arrangement A has a O ( n 2 ) size, and we can compute A in O ( n 2 ) time [16].
Let D D . We rotate an upper tangent of D tangentially around D and update the number of disks intersected by each time it becomes tangent to another disk, or ceases to be tangent to it. In the dual plane, this simply means that we follow the dual curve U D * in A , and add or remove the disk corresponding to any dual curve that we cross. Therefore, it can be achieved in O ( 1 ) time per vertex of A that is along U D * , and an additional O ( n ) time to find the number of disks that are intersected when we start rotating .
We perform the same traversal for each disk in D , and we perform it for lower tangents as well. In total, it takes time O ( n 2 ) as A has a size O ( n 2 ) . During this traversal, we record the best line that was found so far, and we return it after all the traversals are completed. □

3.3. Maximum Coverage by k 2 Lines

By Lemma 2, there is a subset D ¯ = { D 1 , , D k } D of size k and an optimal solution 1 , , k such that each line i is tangent to D i . We show that, if we know D ¯ , we are able to find an optimal solution by reducing the problem to the depth problem [17]: Given a set of n boxes in R d , find a point p R d that maximizes the number of boxes containing p. It is known that the depth problem can be solved in O ( n log n ) time when d = 2 [18], and in O ( n d / 2 ) time when d > 2 using linear space [17].
Lemma 3.
Given a subset D ¯ = { D 1 , , D k } D of size k, we can find k lines 1 , , k such that each line i is tangent to D i and the number of intersected disks in D is maximized in O ( n log n ) time when k = 2 and in O ( n k / 2 ) time when k 3 .
Proof. 
We first show that finding k such tangent lines can be reduced to the depth problem. For a disk D D ¯ , let ( θ ) be the directed line tangent to D with orientation θ . Let D be another disk in D \ D ¯ . While increasing θ from 0 to 2 π , the tangent ( θ ) intersects D in at most two intervals of angles in [ 0 , 2 π ] . We say that these intervals are induced by  ( D , D ) .
For each disk D D \ D ¯ , we compute the intervals induced by ( D , D ) for every D D ¯ . Then, there are at most 2 k such intervals corresponding to D .
Let i { 1 , , l } and let S i , S i be the intervals induced by ( D i , D ) , where S i is possibly empty. We associate to these intervals S i and S i the slab consisting of the points ( θ 1 , , θ k ) [ 0 , 2 π ] k such that min S i θ i max S i , and if S i , the slab consisting of the points that satisfy min S i θ i max S i . These slabs are orthogonal to the θ i -axis. As k = O ( 1 ) , the union of these slabs for all disks in D ¯ has constant complexity. More precisely, the union of these slabs is the union of O ( 1 ) interior-disjoint boxes. (See Figure 2). We replace the union of the slabs by these boxes.
We repeat this for every disk D D \ D ¯ and obtain O ( n ) boxes. Then, for any sequence of angles ( θ 1 , , θ k ) of the directed tangent lines, the number of boxes containing ( θ 1 , , θ k ) is the number of disks in D \ D ¯ intersected by the k tangent lines. Therefore, finding an optimum solution for a fixed D ¯ reduces to the depth problem for O ( n ) boxes.
One issue here is that we should count only once the boundary between two boxes corresponding to the same disk D , but in degenerate cases where the boundaries of two boxes overlap, we need to count twice their common boundary. The maximum depth algorithm by Chan [17] can handle this situation. □
For every subset of k distinct disks of D , we find a set of k lines such that each line is tangent to a different disk in this subset, and that together intersect the maximum number of disks in D . Among those O ( n k ) sets of lines, we choose one with the largest number of intersected disks, which is an optimal solution. It follows that:
Theorem 2.
Given a set of n disks in the plane and a positive integer k, we can find k lines that together intersect the maximum number of disks in D in O ( n 3 log n ) time for k = 2 and in O ( n 3 k / 2 ) time for k 3 , using O ( n ) space.

4. Maximum Coverage by k Parallel Lines

Given a set D of n disks in the plane and an integer k 2 , we would like to find k parallel lines that together intersect the maximum number of disks in D . We first show that this problem can be solved by reducing it to the partial interval hitting set problem. Then, we show how to improve the running time for small k.
We begin with an observation about optimal sets of k parallel lines. Given an optimal set { 1 , , k } of k parallel lines, it is always possible to translate a line of this optimal solution so that the line becomes tangent to an input disk, while keeping the same set of intersected disks. Therefore, we may assume that each line i is tangent to a disk D i , for i = 1 , , k .
For each i { 1 , , k } , we may assume that there exists a common tangent between D i and some other disk in D . Otherwise, for each D D \ { D i } , we must have D D i or D i D . Therefore, without loss of generality, the disks D 1 , , D k form a chain of inclusion D 1 D k . In addition, all the other disks are either contained in D 1 or contain D k . No disk in D \ { D 1 , , D k } can be contained in D 1 , as otherwise we could improve the solution by translating 1 until it crosses this disk. It follows that D 1 = D , contradicting our assumption that D = .
We then rotate i tangentially around D i simultaneously for all i = 1 , , k until one of the k lines becomes tangent to another disk or ceases to be tangent to it. Let 1 , , k denote the k lines after the rotation. As the set of disks intersected by i contains the set of disks intersected by i for all i = 1 , , k , we can replace our optimal set of parallel lines with { 1 , , k } . Thus we have the following observation.
Observation 1.
There exists an optimal set of k parallel lines such that every line is tangent to an input disk and at least one of them is a common tangent of D .
Once we know the direction of an optimal set of lines, we project the disks in D onto a line orthogonal to this direction. We obtain n closed intervals on this line. The problem of finding k lines with this orientation that intersect the maximum number of disks is equivalent to the problem of finding k points that together intersect the maximum number of intervals, which is the PIHS problem. In Section 6, Lemma 6, we show that it can be solved in O ( n 2 ) time using O ( n ) space.
By Observation 1, we have O ( n 2 ) possible orientations. So we can solve the maximum intersection problem by k parallel lines in O ( n 4 ) time as k is a constant. When k = 2 , we give two different algorithms which improve the running time and we provide a space-time trade-off.

Improvements for k = 2

Let D 1 and D 2 be two disks in D . Let 1 and 2 be two parallel lines such that i is tangent to D i for i = 1 , 2 . For i = 1 , 2 , we maintain an array of O ( n ) Booleans that records for each disk in D whether it is intersected by i , and we keep a counter for the number of disks in D which are intersected by 1 or 2 . Now we simultaneously rotate the two lines tangentially around D 1 and D 2 , respectively.
Whenever 1 becomes tangent to a disk other than D 1 , an element of the boolean list for 1 needs to be updated and the number of intersected disks may change. The same holds for 2 and D 2 . We call this an event. As any two disks have at most 4 common tangents, there are O ( n ) events in total. We precompute them, and sort them according to the orientation of the common tangents that they correspond to in O ( n log n ) time.
For each event, the number of disks in D intersected by 1 or 2 increases or decreases by at most one, and we can update the boolean lists and compute the number of intersected disks in O ( 1 ) time. There are O ( n ) events in total, so it takes O ( n ) time.
We repeat this for every pair of disks in D and find an event where the number of intersected disks is maximized. By Observation 1, the two parallel lines 1 and 2 corresponding to this event is an optimal solution. Thus, we obtain the following result.
Lemma 4.
Given a set D of n disks in the plane, we can find two parallel lines that together intersect the maximum number of disks in D in O ( n 3 log n ) time using O ( n ) space.
We can improve the running time to O ( n 3 ) time using O ( n log n ) space as follows.
  • Let T = log n . Partition the disks into n / T disjoint groups, each consisting of T disks, except possibly the last group containing less than T disks. Let G = { G 1 , , G n / T } be the set of groups.
  • For every subset of S G of size at most two,
    (a)
    Let D S = S . For each disk D D S , compute the sorted list of the other disks in D intersected by the tangent line rotating around D in O ( n log n ) time. It takes O ( T n log n ) time for all disks in D S .
    (b)
    For a fixed pair D 1 , D 2 D S , we can find the maximum number of disks intersected by 1 , 2 in O ( n ) time as the ordering of the events has been precomputed. So over all the pairs D 1 , D 2 D S , it takes O ( n T 2 ) time to find optimal lines 1 , 2 .
We consider O ( ( n / T ) 2 ) subsets of G , and we spend O ( T n log n ) + O ( n T 2 ) time for each subset. Thus we spend O ( ( n 3 log n ) / T + n 3 ) time in total, which is O ( n 3 ) time.
Theorem 3.
Given a set of n disks in the plane and a positive integer k, we can find k parallel lines that together intersect the maximum number of disks in D in O ( n 4 ) time using O ( n ) space. For k = 2 , we can find such two parallel lines in O ( n 3 log n ) time using O ( n ) space and in O ( n 3 ) time using O ( n log n ) space.

5. Maximum Coverage by k Lines through a Point

Concurrent lines are lines that meet at a common point, called their concurrency point. Given a set D of n disks in the plane and a positive integer k, we want to find k concurrent lines that together intersect the maximum number of disks in D . We can solve this problem in O ( n 2 ) time by Theorem 1 for k = 1 .
For k = 2 , a simple modification of the algorithm from Theorem 2 gives a solution in O ( n 3 log n ) time. The idea is the following. We use the plane-sweep algorithm by Asano and Imai to compute the depth of our set of rectangles [18]. We need to rule out the solutions consisting of two parallel lines, which correspond to points along the diagonal x = y in our arrangement of rectangles. So at each event x = x i of the sweep, we add a negative weight 2 to the point ( x i , x i ) , which guarantees that it will not be returned as an optimal solution.
Therefore, we consider the case where k 3 , and we make the assumption that no two intersecting lines together intersect all the disks in D , as otherwise we can simply solve the problem using our algorithm for k = 2 .
Lemma 5.
Suppose that no two intersecting lines together intersect all the disks in D . Then there exists an optimal set of k lines for k 3 such that every line is tangent to an input disk and at least two of them are common tangents of D .
Proof. 
Let L * = { 1 * , , k * } be an optimal solution to our problem. Let p * be their concurrency point. When we rotate a line i * about p * , as i * does not intersect all the disks in D , it must at some point become tangent to a disk in D . So we rotate each line i * clockwise until it first becomes tangent to some disk in D , obtaining a line i . Then L = { 1 , , k } is still an optimal solution, and each line i is tangent to a disk D i D .
We move the intersection point p = L along 1 , while rotating each i , i 2 tangentially around D i . By our assumption, no line parallel to 1 intersects all the disks in D . So i must become tangent to some disk in D \ { D i } at some point for every i 2 . Let p be the point corresponding to the first such event, when p moves in either direction along 1 . Then we obtain a new optimal solution L = { 1 , , k } such that j is a common tangent of D for some j with 2 j k . If 1 is a common tangent of D , we are done. Otherwise, we apply the same argument as above to j , obtaining a second common tangent. □
By Lemma 5, there exists an optimal set of k lines whose concurrency point is the intersection of two common tangents of D . For every pair of common tangents ( , ) , we consider the point of intersection as a candidate for being the concurrency point of an optimal solution. Thus we have O ( n 4 ) candidates for being the concurrency point of an optimal solution.
Once we pick a concurrency candidate p, we can reduce our problem to the partial interval hitting set problem. Let and be the two common tangents that intersect at p. Without loss of generality, we assume that is parallel to the x-axis. Let D ¯ be the set of disks in D which are intersected by neither nor . For every disk D in D ¯ , let I D [ 0 , π ) be the interval of angles θ such that the line through p with orientation θ intersects D. Note that I D is a closed interval in [ 0 , π ) . Now we solve PIHS for these intervals I D for D D ¯ , and γ = k 2 . Let Γ = { θ 1 , , θ k 2 } denote an optimal solution for the problem. Let L p denote the set of k 2 lines of orientation θ 1 , , θ k 2 passing through p. Since L p is a set of k 2 lines that pass through p and that together intersect the maximum number of disks in D ¯ , L p { , } is an optimal set of k lines if and are contained in an optimal solution. Therefore, we can compute an optimal set of k concurrent lines by repeating this process for every concurrency candidate.
For k = 3 , we solve PIHS for γ = 1 , so we need to find a point that hits the maximum number of intervals, which can be done in O ( n log n ) time by a simple scan after sorting the endpoints of the intervals. For k 4 , Chrobak et al. ([4] Section 3.1) show that PIHS can be solved in O ( n 2 ) time, and we show that it can be done using only O ( n ) space in Section 6. Thus we can solve this problem in O ( n 5 log n ) time and O ( n ) space for k = 3 , and in O ( n 6 ) time and O ( n ) space for k 4 .
We now show how the running time can be reduced to O ( n 5 ) for k = 3 , using O ( n 2 ) space. Our approach is based on a result presented in Section 6 that shows how to update a solution to PIHS for a set of intervals with moving endpoints where an event occurs when two endpoints collide or separate. We show in Lemma 7 that the solution can be updated in O ( n ) time per event.
Let denote a common tangent of D , and assume without loss of generality that is parallel to the x-axis. We show that we can find two lines 1 and 2 such that their intersection point lies on , and the number of disks in D intersected by { , 1 , 2 } is maximized, in O ( n 3 ) time. As the set of disks intersected by does not change for a fixed line , we do not take this set of disks into consideration.
Let D ¯ denote the set of disks in D that do not intersect . For a point p on , let I p be the collection of intervals which are defined for D ¯ around p in the same manner as we explained in the reduction step above. We solve PIHS for I p and γ = 2 , and let { θ 1 , θ 2 } be the solution. Let θ 1 and θ 2 denote the two lines through p with orientations θ 1 and θ 2 , respectively. These two lines together intersect the maximum number of disks in D ¯ while passing through p.
Now suppose that we move p along . The endpoints of the intervals in I p will move along the real line. A solution to PIHS changes only if an event occurs, as otherwise the ordering of endpoints of the interval remains the same. The key point is that an event occurs only if p is on a concurrency candidate for . The reason is that, for a point q , there exists two intervals in I q such that two endpoints from distinct intervals lie on the same point if and only if there exists a line which passes through q and is tangent to two disks in D .
There are O ( n 2 ) concurrency candidates along in total, and they can be precomputed and sorted along in O ( n 2 log n ) time. From the pairs of disks which determine each concurrency candidate on , the corresponding event can also be found directly. We handle all the events in order and store the best two lines, θ 1 * and θ 2 * , which together intersect the maximum number of disks in D ¯ . In Section 6, Lemma 7, we show how to handle each event in O ( n ) time. Thus, we can find θ 1 * and θ 2 * in O ( n 3 ) time in total.
We repeat this for every common tangent of D . By Lemma 5, there always exists an optimal set of k lines such that one of the lines is a common tangent to two disks in D . Thus, the best set of k lines found during the repetition is an optimal solution. Hence, we have just proved the following theorem.
Theorem 4.
Given a set of n disks in the plane and a positive integer k, we can find k lines that pass through a common point and that together intersect the maximum number of disks in O ( n 6 ) time using O ( n ) space. When k = 3 , we can solve this problem in O ( n 5 log n ) time using O ( n ) space, and O ( n 5 ) time using O ( n 2 ) space.

6. On the Partial Interval Hitting Set Problem

As we mentioned above, given n closed intervals I j = [ s j , t j ] , j = 1 , , n on the real line, and a positive integer γ , the partial hitting set problem is to find a set H of γ points on the real line that together hit the maximum number of intervals. We say that a point q hits an interval I if q I [2]. It is easy to see that, after shifting the solution points to the right until they each meet a right endpoint, that we may assume that the points in the solution are the right endpoints of γ input intervals.
Chrobak et al. ([4] Section 3.1) gave a dynamic-programming algorithm for this problem that runs in O ( γ n 2 ) time. We give a sketch of their algorithm. First, it sorts the intervals using their right endpoints and relabels them so that t 1 t 2 t n . Let T h , b be the maximum number of input intervals that can be hit by a subset H { t 1 , t 2 , , t b } such that | H | h and t b H , where h { 1 , 2 , γ } and b { 1 , 2 , , n } . Let w a , b be the number of intervals I i such that t a < s i t b t i , namely the intervals that are hit by t b but not by t a . We first set T 1 , b to the number of intervals that contain t b . Similarly, we set T h , 1 to the number of intervals that contain t 1 . Then, for every h = 2 , 3 , , γ and for every b = 2 , 3 , , n , we can compute T h , b using the recurrence relation T h , b = max a < b { T h 1 , a + w a , b } .
The output value is max b T γ , b . Chrobak et al. use O ( n 2 ) space as their algorithm precomputes all values w a , b in time O ( n 2 ) . We show how the space usage can be reduced to O ( γ n ) without increasing the time bound.
Lemma 6.
Given n closed intervals on the real line, and a positive integer γ, we can find a set of γ points on the line that together hit the maximum number of intervals in O ( γ n 2 ) time using O ( γ n ) space.
Proof. 
We first compute the sorted list of the interval endpoints in increasing order. We let T h , 1 be the number of intervals that contain t 1 for h = 1 , , γ . These values can be computed in O ( n ) time. For a fixed b with 1 < b n , T h , b can be computed for all h = 1 , , γ in O ( γ n ) time once T h , i and w i , b are computed for all h = 1 , , γ and all i = 1 , , b 1 .
We show that w i , b + 1 for all i = 1 , , b can be computed in (amortized) O ( n ) time once w i , b is computed for all i = 1 , , b 1 . For any fixed b with 1 b < n , let S b be the number of intervals I i such that t b < s i t b + 1 , and let E b be the number of intervals I i such that t i = t b . Let E b a be the number of intervals I i such that t a < s i < t i = t b . For any integers a , b with 1 a < b n , w a , b + 1 = w a , b + S b E b a . Thus, S b and E b i for all i = 1 , , b 1 must be computed in advance when we compute w i , b + 1 from w i , b for all i = 1 , , b 1 . By scanning the sorted list of interval endpoints, we can compute S b in O ( S b ) time and E b i for all i = 1 , , b 1 in O ( n · E b ) time. So we can compute w i , b + 1 for all i = 1 , , b 1 in O ( S b + n · E b ) time. Additionally, we set w b , b + 1 = S b .
For every b = 2 , n , we compute w a , b for all a < b and then compute T h , b for all h. It takes O ( S b 1 + n · E b 1 + γ n ) time for every b = 2 , , n . As b S b = n and b E b = n , it takes O ( γ n 2 ) time in total using O ( γ n ) space. □
We now consider the case where the interval endpoints move along the real line, so each endpoint p is given as a function p ( t ) of the time t R . For two intervals I i and I j ( i j ) , let p and q denote two endpoints such that p { s i , t i } and q { s j , t j } . Let t 0 R . If p ( t 0 ) q ( t 0 ) , that is, if for any t < t 0 that is close enough to t 0 we have p ( t ) q ( t ) , and then p ( t 0 ) = q ( t 0 ) , we say that p and qcollide. On the other hand, if p ( t 0 ) = q ( t 0 ) and p ( t 0 + ) q ( t 0 + ) , that is, if for any t > t 0 that is close enough to t 0 we have p ( t ) q ( t ) , then we say that p and q separate. We say that an event occurs when two endpoints collide or separate. An event at time t 0 is one of the following types:
( LL )
Two points p and q, which are both left endpoints of intervals, collide or separate. (See Figure 3a).
( LR )
Two points p and q, where p is the left endpoint of an interval and q is the right endpoint of another interval, satisfy p ( t 0 ) < q ( t 0 ) and collide at t 0 , or p and q separate at t 0 and p ( t 0 + ) < q ( t 0 + ) . (See Figure 3b).
( RL )
Two points p and q, where p is the right endpoint of an interval and q is the left endpoint of another interval, satisfy p ( t 0 ) < q ( t 0 ) and collide at t 0 , or p and q separate at t 0 and p ( t 0 + ) < q ( t 0 + ) . (See Figure 3c).
( R )
Two points p and q, which are both right endpoints of intervals, collide or separate. (See Figure 3d).
Lemma 7.
At each event, we can update an optimal solution to  PIHS  for γ = 2 in O ( n ) time after O ( n 2 ) -time preprocessing using O ( n 2 ) space.
Proof. 
Let W denote the table which stores all w a , b , and let T denote the table which stores all T h , b . For γ = 2 , we show that an event where two interval endpoints p and q collide or separate can be handled in O ( n ) time so that all elements of W and T store correct values reflecting the situation right after the event. We first assume that no three intervals endpoints coincide at any time. At the end of this proof, we explain how to handle these degenerate cases.
For an event of type LL or LR , the set of intervals which are hit by a right endpoint does not change at all. Thus nothing in W and T needs to change.
For an event of type RL , let I i and I j be the two intervals involved in the event such that t i = p and s j = q . Then at this event, the set of intervals that are hit by t i will change, and the set of intervals hit by any other point does not change. The number of intervals hit by t i increases by 1 for the case where p and q collide, and this number decreases by 1 for the other case where p and q separate. It follows that among all T 1 , b for b = 1 , , n , T 1 , i is the only element which changes. The update of T 1 , i can be done in O ( 1 ) time. Among all T 2 , b for b = 1 , , n , however, more than one element can change. We show that we can compute the changes in O ( n ) time in total. For both cases where the points collide or separate, w a , b changes only if a = i or b = i in the following way. The value w a , i increases or decreases by 1 for all a = 1 , , i 1 . The value w i , b increases or decreases by 1 if t b t j for b = i + 1 , , n . Thus we can update W in O ( n ) time in total.
The observation that w a , b changes only if a = i or b = i implies that T 2 , b changes only if T 1 , i + w i , b becomes larger than its original value for b = i + 1 , , n . This can be checked in O ( 1 ) time for every b = i + 1 , , n once T 1 , i and w i , b were computed. Using additional O ( n ) time, we update T 2 , i using the recurrence relation. Thus we can update T in O ( n ) time in total. Then we can report a new solution by computing max b T 2 , b .
For an event of type RR , let I i and I j be the two intervals involved in the event such that t i = p , t j = q , and p < q holds right after the event if p and q separate at this event. If i > j , which happens only for the case where p and q separate, we just switch the labels of two intervals so that i < j holds. Then I j is the only interval such that the set of intervals which are hit by its right endpoint changes by this event. The size of the set increases by 1 for the case where p and q collide, and the size of the set decreases by 1 for the case where p and q separate. It follows that among all T 1 , b for b = 1 , , n , T 1 , j is the only element which changes. The update of T 1 , j can be done in O ( 1 ) time. Among all T 2 , b for b = 1 , , n , however, more than one element can change. We show that we can compute the changes in O ( n ) time in total. For both cases where points collide or separate, w a , b changes only if b = j . More precisely, the value w a , j increases or decreases by 1 if t a < s i . Thus we can update W in O ( n ) time in total.
The observation that T 1 , j is the only element which changes among all T 1 , b for b = 1 , , n implies that T 2 , b changes only if T 1 , j + w j , b becomes larger than its original value for b = j + 1 , , n . This can be checked in O ( 1 ) time for every b = j + 1 , , n once T 1 , j and w j , b were computed. Using additional O ( n ) time, we update T 2 , j using the recurrence relation. Thus we can update T in O ( n ) time in total. Then we can report a new solution by computing max b T 2 , b .
We now explain how to handle degenerate cases where more than 2 endpoints collide or separate at the same time t. So we have several events of the type LL, LR, RL or RR occurring at time t. In this case, we first separately handle in an arbitrary order each of the events where two points collide, in the way that is described above. Then we obtain the solution at time t with maximum coverage. After this, we handle in an arbitrary order all the events where two points separate at time t. □

7. Discussion and Conclusions

We addressed the problem of finding k lines that together intersect the maximum number of input disks. We considered two other variants, where the k output lines should be parallel, and where the k lines should pass through a common point. We presented the first algorithms for these problems.
For k = 1 , the three problems coincide, and we give an O ( n 2 ) time algorithm by applying a geometric dualization. As this problem is 3SUM-hard even for covering points, an O ( n α ) -time algorithm for any α < 2 is currently out of reach.
For the problem of finding k 2 lines that together intersect the maximum number of input disks, we first show that there exists an optimal set of k lines, each of which is tangent to two input disks. Using this observation, we show that the problem can be reduced to the problem of computing the depth of a set of boxes. The running time of our algorithm is O ( n 3 log n ) when k = 2 and is O ( n 3 k / 2 ) time when k 3 .
For the problem of finding k parallel lines that together intersect the maximum number of input disks for k 2 , it can be reduced to the Partial Interval Hitting Set problem once the direction of the output lines is fixed. We first give O ( n 4 ) -time algorithm by observing that there exists an optimal set of k parallel lines such that every line is tangent to an input disk and at least one of them is tangent to two input disks in D . Then we reduce the time complexity when k = 2 , at the expense of increasing the space usage by a logarithmic factor.
Our results are the first nontrivial results of these three problems, which are maximum coverage problems in geometric settings. One natural question is to extend our results to other geometric settings, for instance to covering balls by lines in R 3 . Another possible direction for further work is to consider approximation algorithms. The maximum coverage problem for arbitrary sets is known to be NP-hard, and the straightforward greedy algorithm gives a ( 1 1 / e ) -approximation of the optimum. Can we find better approximation algorithms in geometric settings?

Author Contributions

Conceptualization, methodology and writing: C.C., A.V. and H.-K.A. All authors have read and agreed to the published version of the manuscript.

Funding

H.-K.Ahn was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government(MSIT) (RS-2023-00219980). C.Chung and H.-K.Ahn were supported by the Institute of Information & communications Technology Planning & Evaluation(IITP) grant funded by the Korea government(MSIT) (No. 2017-0-00905, Software Star Lab (Optimal Data Structure and Algorithmic Applications in Dynamic Geometric Environment)) and (No. 2019-0-01906, Artificial Intelligence Graduate School Program(POSTECH)). A. Vigneron was supported by Basic Science Research Program through the National Research Foundation of Korea (NRF) funded by the Ministry of Education (2022R1F1A107586911).

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Gajentaan, A.; Overmars, M. On a class of O(n2) problems in computational geometry. Comput. Geom. Theory Appl. 2012, 45, 140–152. [Google Scholar] [CrossRef]
  2. Damaschke, P. Refined algorithms for hitting many intervals. Inf. Process. Lett. 2017, 118, 117–122. [Google Scholar] [CrossRef]
  3. Jansen, K.; Scheffler, P.; Woeginger, G. The disjoint cliques problem. RAIRO Rech. OpÉrationnelle 1997, 31, 45–66. [Google Scholar] [CrossRef]
  4. Chrobak, M.; Golin, M.; Lam, T.W.; Nogneng, D. Scheduling with gaps: New models and algorithms. J. Sched. 2021, 24, 381–403. [Google Scholar] [CrossRef]
  5. Dumitrescu, A.; Jiang, M. On the approximability of covering points by lines and related problems. Comput. Geom. 2015, 48, 703–717. [Google Scholar] [CrossRef]
  6. Hochbaum, D.S.; Pathria, A. Analysis of the greedy approach in problems of maximum k-coverage. Nav. Res. Logist. 1998, 45, 615–627. [Google Scholar] [CrossRef]
  7. Jin, K.; Li, J.; Wang, H.; Zhang, B.; Zhang, N. Near-linear time approximation schemes for geometric maximum coverage. Theor. Comput. Sci. 2018, 725, 64–78. [Google Scholar] [CrossRef]
  8. Ha, J.; Cheong, O.; Goaoc, X.; Yang, J. Geometric permutations of non-overlapping unit balls revisited. Comput. Geom. 2016, 53, 36–50. [Google Scholar] [CrossRef]
  9. Knauer, C.; Löffler, M.; Scherfenberg, M.; Wolle, T. The directed Hausdorff distance between imprecise point sets. Theor. Comput. Sci. 2011, 412, 4173–4186. [Google Scholar] [CrossRef]
  10. Löffler, M.; Snoeyink, J. Delaunay triangulation of imprecise points in linear time after preprocessing. Comput. Geom. Theory Appl. 2010, 43, 234–242. [Google Scholar] [CrossRef]
  11. Ahn, H.; Knauer, C.; Scherfenberg, M.; Schlipf, L.; Vigneron, A. Computing the Discrete Fréchet distance with imprecise input. Int. J. Comput. Geom. Appl. 2012, 22, 27–44. [Google Scholar] [CrossRef]
  12. Ziou, D.; Tabbone, S. Edge detection techniques—An overview. Pattern Recognit. Image Anal. C/C Raspoznavaniye Obraz. I Anal. Izobr. 1998, 8, 537–559. [Google Scholar]
  13. Cheung, Y.K.; Daescu, O. Line segment facility location in weighted subdivisions. In Algorithmic Aspects in Information and Management; Goldberg, A.V., Zhou, Y., Eds.; Springer: Berlin/Heidelberg, Germany, 2009; pp. 100–113. [Google Scholar]
  14. Klee, V. Can the Measure of ⋃1n[ai,bi] be Computed in Less Than O(nlogn) Steps? Am. Math. Mon. 1977, 84, 284. [Google Scholar]
  15. Berg, M.d.; Cheong, O.; Kreveld, M.v.; Overmars, M. Computational Geometry: Algorithms and Applications, 3rd ed.; Springer: Berlin/Heidelberg, Germany, 2008. [Google Scholar]
  16. Amato, N.; Goodrich, M.; Ramos, E. Computing the arrangement of curve segments: Divide-and-conquer algorithms via sampling. In Proceedings of the 11th Annual ACM-SIAM Symposium on Discrete Algorithms, San Francisco, CA, USA, 9–11 January 2000; pp. 705–706. [Google Scholar]
  17. Chan, T.M. Klee’s Measure Problem Made Easy. In Proceedings of the 54th Annual Symposium on Foundations of Computer Science, Berkeley, CA, USA, 26–29 October 2013; pp. 410–419. [Google Scholar]
  18. Imai, H.; Asano, T. Finding the connected components and a maximum clique of an intersection graph of rectangles in the plane. J. Algorithms 1983, 4, 310–323. [Google Scholar] [CrossRef]
Figure 1. Examples of optimal solutions for Problems 1, 2 and 3 when k = 3 .
Figure 1. Examples of optimal solutions for Problems 1, 2 and 3 when k = 3 .
Symmetry 16 00206 g001
Figure 2. (Left) a set of seven disks in the plane, where and k = 2 , and D ¯ = { D 1 , D 2 } . (Right) The union of slabs induced by ( D 1 , D ) and ( D 2 , D ) .
Figure 2. (Left) a set of seven disks in the plane, where and k = 2 , and D ¯ = { D 1 , D 2 } . (Right) The union of slabs induced by ( D 1 , D ) and ( D 2 , D ) .
Symmetry 16 00206 g002
Figure 3. Types of events where two interval endpoints p and q collide or separate. (a) Type LL (b) Type LR (c) Type RL (d) Type RR .
Figure 3. Types of events where two interval endpoints p and q collide or separate. (a) Type LL (b) Type LR (c) Type RL (d) Type RR .
Symmetry 16 00206 g003
Table 1. The running times of our algorithms for Problem 1, 2 and 3 for a constant k. Space usage is O ( n ) if not explicitly stated.
Table 1. The running times of our algorithms for Problem 1, 2 and 3 for a constant k. Space usage is O ( n ) if not explicitly stated.
 Problem 1Problem 2Problem 3
k = 1 O ( n 2 ) time, O ( n 2 ) space
k = 2 O ( n 3 log n ) time O ( n 3 log n ) time O ( n 3 log n ) time
O ( n 3 ) time, O ( n log n ) space
k = 3 O ( n 3 k / 2 ) time O ( n 4 ) time O ( n 5 log n ) time
O ( n 5 ) time, O ( n 2 ) space
k 4 O ( n 3 k / 2 ) time O ( n 4 ) time O ( n 6 ) time
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Chung, C.; Vigneron, A.; Ahn, H.-K. Maximum Coverage by k Lines. Symmetry 2024, 16, 206. https://doi.org/10.3390/sym16020206

AMA Style

Chung C, Vigneron A, Ahn H-K. Maximum Coverage by k Lines. Symmetry. 2024; 16(2):206. https://doi.org/10.3390/sym16020206

Chicago/Turabian Style

Chung, Chaeyoon, Antoine Vigneron, and Hee-Kap Ahn. 2024. "Maximum Coverage by k Lines" Symmetry 16, no. 2: 206. https://doi.org/10.3390/sym16020206

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop