Discriminating Codes in Geometric Setups
NNoname manuscript No. (will be inserted by the editor)
Discriminating Codes in Geometric Setups
Sanjana Dey · Florent Foucaud · SubhasC. Nandy · Arunabha Sen
Received: date / Accepted: date
Abstract
We study two geometric variations of the discriminating code prob-lem. In the discrete version , a finite set of points P and a finite set of objects S are given in R d . The objective is to choose a subset S ∗ ⊆ S of minimumcardinality such that the subsets S ∗ i ⊆ S ∗ covering p i , satisfy S ∗ i (cid:54) = ∅ for each i = 1 , , . . . , n , and S ∗ i (cid:54) = S ∗ j for each pair ( i, j ), i (cid:54) = j . In the continuousversion , the solution set S ∗ can be chosen freely among a (potentially infinite)class of allowed geometric objects.In the 1-dimensional case ( d = 1), the points are placed on some fixed-line L ,and the objects in S and S ∗ are finite sub-segments of L (called intervals).We show that the discrete version of this problem is NP-complete. This issomewhat surprising as the continuous version is known to be polynomial-timesolvable. This is also in contrast with most geometric covering problems, whichare usually polynomial-time solvable in 1D. We then design a polynomial-time2-approximation algorithm for the 1-dimensional discrete case. We also design Sanjana DeyACM Unit, Indian Statistical Institute, Kolkata, IndiaE-mail: [email protected] FoucaudUniv. Bordeaux, Bordeaux INP, CNRS, LaBRI, UMR5800, F-33400 Talence, FranceThis author was partially funded by the ANR project HOSIGRA (ANR-17-CE40-0022) andthe IFCAM project ”Applications of graph homomorphisms” (MA/IFCAM/18/39).E-mail: fl[email protected] C. NandyACM Unit, Indian Statistical Institute, Kolkata, IndiaE-mail: [email protected] SenArizona State University, Tempe, Arizona 85287, USAE-mail: [email protected] a r X i v : . [ c s . C G ] S e p S. Dey et al. a PTAS for both discrete and continuous cases when the intervals are allrequired to have the same length.We then study the 2-dimensional case ( d = 2) for axis-parallel unit squareobjects. We show that both continuous and discrete versions are NP-hard,and design polynomial-time approximation algorithms with factors 4 + (cid:15) and32 + (cid:15) , respectively (for every fixed (cid:15) > Keywords
Discriminating code · Approximation algorithm · Segmentstabbing · Geometric Hitting set
We consider geometric versions of the
Discriminating Code problem, whichare variations of classic geometric covering problems. A set of point sites P in R d is given. For a set S of objects of R d , denote by S i the set of objects of S that contain p i ∈ P . The objective is to choose a minimum-size set S ∗ ofobjects such that S ∗ i (cid:54) = ∅ for all p i ∈ P (covering), and S ∗ i (cid:54) = S ∗ j for each pairof distinct sites p i , p j ∈ P (discrimination). In the discrete version, the objectsof S ∗ must be chosen among a specified set S of objects given in the input,while in the continuous version, only the points are given, and the objects canbe chosen freely (among some infinite class of allowed objects).The problem is motivated as follows. Consider a terrain that is difficult tonavigate. A set of sensors, each assigned a unique identification number ( id ),are deployed in that terrain, all of which can communicate with a single basestation. If a region of the terrain suffers from some specific problem, a subsetof sensors will detect that and inform the base station. From the id ’s of thealerted sensors, one can uniquely identify the affected region, and a rescue teamcan be sent. The covering zone of each sensor can be represented by an objectin S . The arrangement of the objects divides the entire plane into regions.A representative point of each region may be considered as a site. The set P consists of some of those sites. We need to determine the minimum number ofsensors such that no two sites in P are covered by the same set of id s. Apartfrom coverage problems in sensor networks, this problem has applications infault detection, heat prone zone in VLSI circuits, disaster management, en-vironmental monitoring, localization and contamination detection Laifenfeldet al. (2009); Ray et al. (2004), to name a few.The general version of the problem has been formulated as a graph problemfrom Charbit et al. (2006); Charon et al. (2008), as follows. iscriminating Codes in Geometric Setups 3 Minimum Discriminating Code ( Min-Disc-Code ) Input:
A connected bipartite graph G = ( U ∪ V, E ), where E ⊆ { ( u, v ) | u ∈ U, v ∈ V } . Output:
A minimum-size subset U ∗ ⊆ U such that U ∗ ∩ N ( v ) (cid:54) = ∅ for all v ∈ V , and U ∗ ∩ N ( v ) (cid:54) = U ∗ ∩ N ( v (cid:48) ) for every pair v, v (cid:48) ∈ V , v (cid:54) = v (cid:48) .In the geometric version of Min-Disc-Code which will be further referred toas the
G-Min-Disc-Code , the two sets of nodes in the bipartite graph are U = a set of geometric objects S , and V = a set of points P in R d , and an objectis adjacent to all the points it contains. The code of a point p ∈ P with respectto a subset S (cid:48) ⊆ S is the subset of S (cid:48) that contains p . Given an instance ( P, S ),two points p i , p j ∈ P are called twins if each member in S that contains p i also contains p j , and vice-versa. An instance ( P, S ) of
G-Min-Disc-Code is twin-free if no two points in P are twins. Geometrically, if we consider thearrangement de Berg et al. (2008) A of the geometric objects S , then theinstance ( P, S ) is twin-free if each cell of A contains at most one point of P .As mentioned earlier, for a twin-free instance, a subset of S that can uniquelyassign codes to all the points in P is said to discriminate the points of P andis called a discriminating code or disc-code in short. In the discrete version ofthe problem, our objective is to find a subset S ∗ ⊆ S of minimum cardinalitythat is a disc-code for the points in P . In the continuous version, we can freelychoose the objects of S ∗ . The two problems are formally stated as follows. Discrete-G-Min-Disc-Code
Input:
A point set P to be discriminated, and a set of objects S to beused for the discrimination. Output:
A minimum-size subset S ∗ ⊆ S which discriminates all points in P . Continuous-G-Min-Disc-Code
Input:
A point set P to be discriminated. Output:
A minimum-size set S ∗ of objects that discriminate the pointsin P , and that can be placed anywhere in the region under consideration. Related work.
The general
Min-Disc-Code problem is NP-hard and hardto approximate Charbit et al. (2006); Charon et al. (2008); Laifenfeld andTrachtenberg (2008). In the context of the above-mentioned practical applica-tions,
Discrete-G-Min-Disc-Code in 2D was defined in Basu et al. (2019),where an integer programming formulation (ILP) of the problem was givenalong with an experimental study.
Continuous-G-Min-Disc-Code was in-troduced in Gledel and Parreau (2019), and shown to be NP-complete fordisks in 2D, but polynomial-time in 1D (even when the intervals are restrictedto have bounded length). These two problems are related to the class of ge-ometric covering problems , for which also both the discrete and continuousversion are studied extensively Krupa R. et al. (2017). A related problem isthe
Test Cover problem de Bontridder et al. (2003), which is similar to
S. Dey et al.
Min-Disc-Code (but defined on hypergraphs). It is equivalent to the variantof
Min-Disc-Code where the covering condition “ U ∗ ∩ N ( v ) (cid:54) = ∅ ” is not re-quired. Thus, a discriminating code is a test cover, but the converse may notbe true. Geometric versions of Test Cover have been studied under variousnames. For example, the separation problems in Boland and Urrutia (1995);C˘alinescu et al. (2005); Har-Peled and Jones (2020) can be seen as continuousgeometric versions of test cover in 2D, where the objects are half-planes. Sim-ilar problems are also called shattering problems, see Nandy et al. (2002). Awell-studied special case of
Min-Disc-Code for graphs is the problem
Mini-mum Identifying Code ( Min-ID-Code ). This problem was studied in par-ticular for the related setting of geometric intersection graphs, for example onunit disk graphs M¨uller and Sereni (2009) and interval graphs Bousquet et al.(2015); Foucaud (2012); Foucaud et al. (2017).More references on several coding mechanisms on graphs based on differentapplications, namely locating-dominating sets, open locating dominating sets,metric dimension, etc, and their computational hardness results are availablein Foucaud (2012); Foucaud et al. (2017).
Our results.
We show that
Discrete-G-Min-Disc-Code in 1D, that is, theproblem of discriminating points on a real line by interval objects of arbitrarylength, is NP-complete. For this we reduce from 3-SAT. Here, the challengeis to overcome the linear nature of the problem and to transmit the informa-tion across the entire construction without affecting intermediate regions. Thisresult is in contrast with
Continuous-G-Min-Disc-Code in 1D, which ispolynomial-time solvable Gledel and Parreau (2019). This is also in contrastwith most geometric covering problems, which are usually polynomial-timesolvable in 1D Krupa R. et al. (2017). We then design a polynomial-time 2-factor approximation algorithm for
Discrete-G-Min-Disc-Code in 1D. Tothis end we use the concept of minimum edge-covers in graphs, whose opti-mal solution can be found by computing a maximum matching of the graph.We also design a polynomial-time approximation scheme (PTAS) for both
Discrete-G-Min-Disc-Code and
Continuous-G-Min-Disc-Code in 1D,when the objects are required to all have the same (unit) length. We alsostudy both problems in 2D for axis-parallel unit square objects, which forma natural extension of 1D intervals to the 2D setting. The continuous ver-sion is known to be NP-complete for unit disks Gledel and Parreau (2019),and we show that the reduction can be adapted to our setting, for both thecontinuous and discrete case. We then design polynomial-time constant-factorapproximation algorithms for both problems in the same setting, of factors4 + (cid:15) for
Continuous-G-Min-Disc-Code , and 32 + (cid:15) for
Discrete-G-Min-Disc-Code (for any fixed (cid:15) > L of given line segments by placing unit squaresin R . (Here a line segment (cid:96) ∈ L is stabbed by a unit square if exactly one end-point of (cid:96) is contained in the square.) We propose an 4-factor approximationalgorithm for this stabbing problem, which, to the best of our knowledge, is iscriminating Codes in Geometric Setups 5 Object Type Continuous-G-Min-Disc-Code Discrete-G-Min-Disc-CodeHardness Algorithm Hardness Algorithm
1D intervals - Polynomial (Gledel and Parreau (2019)) NP-hard (Thm. 1) 2-approximable (Thm. 2)1D unit intervals Open PTAS (Thm. 4) Open PTAS (Thm. 4)2D axis parallelunit squares NP-hard (Thm. 5) (4 + (cid:15) )-approximable (Thm. 6) NP-hard (Thm. 5) (32 + (cid:15) )-approximable (Thm. 8)
Table 1
Summary of our results the first polynomial-time constant-factor algorithm for it. We remark that inmany cases, a polynomial-time algorithm for
Discrete-G-Min-Disc-Code works for
Continuous-G-Min-Disc-Code , as long as any instance of the for-mer can be transformed in polynomial time into an equivalent instance of thelatter. For example, this is the case for objects restricted to a fixed size, sincethere are only polynomially many kinds of intersections with the point set,such as for our PTAS for the unit interval case. Conversely, a hardness resultfor
Continuous-G-Min-Disc-Code can often be applied to
Discrete-G-Min-Disc-Code , this is the case of our hardness proof for axis-parallel unitsquares in 2D. Our results are summarized in Table 1.
It has been shown that
Continuous-G-Min-Disc-Code is polynomial-timesolvable in 1D Gledel and Parreau (2019). Thus, in this section we mainlyfocus on
Discrete-G-Min-Disc-Code .An instance (
P, S ) of
Discrete-G-Min-Disc-Code is a set P = { p , . . . , p n } of points and a set S of m intervals of arbitrary lengths placed on the real line R . Assuming that the points are sorted with respect to their coordinate values,we define n + 1 gaps G = { g , . . . , g n +1 } , where g = ( −∞ , p ), g i = ( p i − , p i )for 2 ≤ i ≤ n , and g n +1 = ( p n , ∞ ). Proposition 1
The time complexity of checking whether a given instance ( P, S ) of n points and m intervals is twin-free is O ( n log n + m log m ) .Proof Observe that, if a subset S (cid:48) ⊆ S is a G-Min-Disc-Code for P , then anysuperset of S (cid:48) also produces unique code for all the points in P . Thus, thetwin-free property will be verified by checking whether all the objects in S canproduce unique code for the points in P or not.We compute all the maximal cliques of the intervals in S in O ( m log m ) time,and store them in an array A . Next, we execute a merge pass among the sortedpoints in P and the intervals in A to check whether any maximal clique region Such algorithms exist for a related, but different, segment-stabbing problem by unitdisks, where a disk stabs a segment if it intersects it once or twice Mustafa and Ray (2010);Kobylkin (2018). A subset ψ ⊂ S forms a maximal clique if their intersection is non-null, and no othermember of S \ ψ intersect the region of intersection of the members in ψ . S. Dey et al. in the array A contains more than one point of P . This needs O ( n log n + m + n )time.Thus one can check whether ( P, S ) is twin-free in O ( m log m ) because m ≥ n .Observe that (i) if both endpoints of an interval s ∈ S lie in the same gap of G , then it can not discriminate any pair of points; thus s is useless , and (ii) ifmore than one interval in S have both their endpoints in the same two gaps,say g a = ( p a , p a +1 ) , g b = ( p b , p b +1 ) ∈ G , then both of them discriminate theexact same point-pairs. Thus, they are redundant and we need to keep only onesuch interval. In a linear scan, we can first eliminate the useless and redundantintervals. From now onwards, m will denote the number of intervals, none ofwhich are useless or redundant. Hence, m = O ( n ).2.1 NP-completeness for the general 1D case Discrete-G-Min-Disc-Code is in NP, since given a subset S (cid:48) ⊆ S , in poly-nomial time one can test whether the problem instance ( P, S (cid:48) ) is twin-free (i.e.whether the code of every point in P induced by S (cid:48) is unique). Our reductionfor proving NP-hardness is from the NP-complete 3-SAT-2 l problem Tovey(1984) (defined below), to Discrete-G-Min-Disc-Code .3-SAT-2 l Input:
A collection of m clauses C = { c , c , . . . , c m } where each clausecontains at most three literals, over a set of n Boolean variables X = { x , x , . . . , x n } , and each literal appears at most twice. Output:
A truth assignment of X such that each clause is satisfied.Given an instance ( X, C ) of 3-SAT-2 l , we construct in polynomial time aninstance Γ ( X, C ) of
Discrete-G-Min-Disc-Code on the real line R . Themain challenge of this reduction is to be able to connect variable and clausegadgets, despite the linear nature of our 1D setting. The basic idea is that wewill construct an instance where some specific set of critical point-pairs willneed to be discriminated (all other pairs being discriminated by some partialsolution forced by our gadgets). Let us start by describing our basic gadgets. Definition 1 A covering gadget Π consists of three intervals I , J , K and fourpoints p , p , p and p satisfying p ∈ I , p ∈ I ∩ J , p ∈ I ∩ J ∩ K and p ∈ J ∩ K as in Fig. 1. Every other interval of the construction will eithercontain all four points, or none. There may exist a set of points in K \ { I ∪ J } ,depending on the need of the reduction. Observation 1
Points p , p , p , p can only be discriminated by choosing allthree intervals I , J , K in the solution. iscriminating Codes in Geometric Setups 7 Proof
Follows from the fact that none of the intervals in Γ ( X, C ) that is nota member of the covering gadget Π can discriminate the four points in Π .Moeover, if we do not choose I , then p , p are not discriminated. If we do notchoose J , p , p are not discrimnated. If we do not choose K , p , p are notdiscriminated.The idea of the covering gadget is to forcefully cover the points placed in K \ { I ∪ J } , so that they are covered by K (which needs to be in any solution),and hence discriminated from all other points of the construction. I J K Π p p p p Fig. 1
A covering gadget Π , and its schematic representation. Let us now define the gadgets modeling the clauses and variables of the 3-SAT-2 l instance. Definition 2
Let c i be a clause of C . The clause gadget for c i , denoted G c ( c i ),is defined by a covering gadget Π ( c i ) along with two points p c i , p (cid:48) c i placed in K \ { I ∪ J } (see Fig. 2). I J Kp p p p Π( c i ) p c i p (cid:48) c i Fig. 2
A clause gadget Π ( c i ), and its schematic representation. The idea behind the clause gadget is that some interval that ends betweenpoints p c i , p (cid:48) c i will have to be taken in the solution, so that this pair getsdiscriminated. Definition 3
Let x j be a variable of X . The variable gadget for x j , denoted G v ( x j ), is defined by a covering gadget Π ( x j ), and five points p x j , . . . , p x j placed consecutively in K \ { I ∪ J } . We place six intervals I x j , I x j , I x j , I x j , I x j , I x j , as in Fig. 3. – Interval I x j starts between p x j and p x j , and ends between p x j and p x j . – Interval I x j starts between p x j and p x j , and ends between p x j and p x j . – Interval I x j starts between p x j and p x j , and ends after p x j . S. Dey et al. – Interval I x j starts between p x j and p x j , and ends after p x j . – Interval I x j starts between p x j and p x j , and ends after p x j . – Interval I x j starts between p x j and p x j , and ends after p x j .(The ending point of the four latter intervals will be determined at the con-struction.) Π( x i ) p x j p x j p x j p x j p x j I x j I x j I x j I x j I x j I x j Fig. 3
A variable gadget
In a variable gadget G v ( x j ), the intervals I x j and I x j represent the occurrencesof literal x j , while I x j and I x j represent the occurrences of ¯ x j . The rightend points of each of these four intervals will be in the clause gadget of theclause that the occurrence of the literal belongs to. More precisely, Γ ( X, C ) isconstructed as follows, shown in Figure 4. Note that we can assume that everyliteral appears in at least one clause (otherwise, we can fix the truth value ofthe variable and obtain a smaller equivalent instance). – For each variable x i ∈ X , Γ ( X, C ) contains a variable gadget G v ( x i ). – The gadgets G v ( x ) , G v ( x ) , . . . , G v ( x n ) are positioned consecutively, inthis order, without overlap. – For each clause c j ∈ C , Γ ( X, C ) contains a clause gadget G c ( c j ). – The gadgets G c ( c ) , G c ( c ) , . . . , G c ( c m ) are positioned consecutively, inthis order, after the variable gadgets, without overlap. – For every variable x i , assume x i appears in clauses c i and c i , and ¯ x i appears in c i and c i (possibly i = i or i = i ). Then, we extendinterval I x i so that it ends between p c i and p (cid:48) c i ; I x i ends between p c i and p (cid:48) c i ; I x i ends between p c i and p (cid:48) c i ; I x i ends between p c i and p (cid:48) c i .Figure 4 gives an example construction for our reduction.Let C Π be the union of the disc-codes (i.e. all intervals of type I, J, K , byObservation 1) of all covering gadgets. Observe that C Π discriminates thepoints p , p , p , p in each covering gadget Π , and any point covered by K iscriminating Codes in Geometric Setups 9 V a r i a b l e G a d g e t s C l a u s e G a d g e t s p x p x p x p x p x Π ( x ) p x p x p x p x p x Π ( x ) p x p x p x p x p x Π ( x ) p c p (cid:48) c Π ( c ) p c p (cid:48) c Π ( c ) I x I x I x I x I x I x I x I x I x I x I x I x I x I x I x I x I x I x p c p (cid:48) c Π ( c ) Fig. 4 Γ ( X, C ) for the formula (
X, C ) = ( ¯ x ∨ x ∨ x ) ∧ ( x ∨ ¯ x ∨ ¯ x ) ∧ ( x ∨ x ∨ x ). from any other point not covered by K . It follows that all point-pairs arediscriminated by C Π , except the following critical ones: – the pairs among the five points p x i , . . . , p x i of each variable gadget G v ( x i ),and – the point pair { p c j , p (cid:48) c j } of each clause gadget G c ( c j ). Theorem 1
Discrete-G-Min-Disc-Code in 1D is NP-complete.Proof
We prove that (
X, C ) is satisfiable if and only if Γ ( X, C ) has a disc-codeof size 6 n + 3 m . In both parts of the proof, we will consider the set C Π definedabove. Each variable gadget and clause gadget contains one covering gadget.Thus, |C Π | = 3( n + m ).Consider first some satisfying truth assignment of X . We build a solution set C as follows. First, we put all intervals of C Π in C . Then, for each variable x i ,if x i is true, we add intervals I x i , I x i and I x i to C . Otherwise, we add intervals I x i , I x i and I x i to C . Notice that |C| = 6 n + 3 m . As observed before, it sufficesto show that C discriminates the point-pair { p c j , p (cid:48) c j } of each clause gadget G c ( c j ), and the points p x i , . . . , p x i of each variable gadget G v ( x i ). (All otherpairs are discriminated by C Π .)Since the assignment is satisfying, each clause c j contains a true literal l i ∈{ x i , ¯ x i } . Then, one interval of G v ( x i ) is in C and discriminates p c j and p (cid:48) c j .Furthermore, consider a variable x i . Point p x i is discriminated from p x i , . . . , p x i as it is the only one not covered by any of I x i , I x i , I x i , I x i , I x i , and I x i . If x i is true, p x i is covered by I x i ; p x i is covered by I x i and I x i ; p x i is coveredby I x i ; p x i is covered by I x i and I x i . If x i is false, p x i is covered by I x i ; p x i is covered by I x i and I x i ; p x i is covered by I x i , I x i and I x i ; p x i is covered by I x i and I x i . Thus, in both cases, the five points are discriminated, and C isdiscriminating, as claimed.For the converse, assume that C is a discriminating code of Γ ( X, C ) of size6 n + 3 m . By Observation 1, C Π ⊆ C . Thus there are 3 n intervals of C that arenot in C Π .First, we show that C \ C Π contains exactly three intervals of each variablegadget G v ( x i ). Indeed, it cannot contain less than three, otherwise we showthat the points p x i , . . . , p x i cannot be discriminated. To see this, note thateach consecutive pair { p sx i , p s +1 x i } (1 ≤ s ≤
4) must be discriminated, thus C must contain one interval with an endpoint between these two points. Thereare four such consecutive pairs in G v ( x i ), thus if C \ C Π contains at most twointervals of G v ( x i ), it must contain I x i and I x i . But now, the points p x i and p x i are not discriminated, a contradiction.Let us now show how to construct a truth assignment of ( X, C ). Notice thatat least one of I x i and I x i must belong to C , otherwise some points of G v ( x i )cannot be discriminated. If I x i ∈ C but I x i / ∈ C , then necessarily I x i ∈ C todiscriminate p x i and p x i , and I x i ∈ C to discriminate p x i and p x i . In this case,we set x i to true. Similarly, if I x i ∈ C but I x i / ∈ C , then necessarily I x i ∈ C todiscriminate p x i and p x i , and I x i ∈ C to discriminate p x i and p x i . In this case,we set x i to false. Finally, if both I x i and I x i belong to C , the third interval iscriminating Codes in Geometric Setups 11 s s s s s s s s s s p p p p p p p p g g g g g g g g g (a) v v v v v v v v v e e e e e e e e (b) Fig. 5 (a) An instance (
P, S ), (b) corresponding graph G = ( V, E ) with MEC edges high-lighted. Note that s and s are redundant intervals. of C \ C Π in G v ( x i ) may be any of the four intervals covering p x i . If this thirdinterval is I x i or I x i , we set x i to true; otherwise, we set it to false.Observe that when we set x i to true, none of I x i and I x i belongs to C ; like-wise, when we set x i to false, none of I x i and I x i belongs to C . Thus, ourtruth assignment is coherent. As for every clause c j , the point-pair { p c j , p (cid:48) c j } is discriminated by C , one interval correspoding to a true literal discriminatesit. The obtained assignment is satisfying, completing the proof.2.2 A 2-approximation algorithm for the general 1D caseWe next use the classic algorithm solving the edge-cover problem of an undi-rected graph to design a 2-factor approximation algorithm for Discrete-G-Min-Disc-Code in 1D.
Edge-Cover
Input:
An undirected graph G = ( V, E ). Output:
A subset E (cid:48) ⊆ E such that every vertex is incident to at leastone edge of E (cid:48) .We create a graph G = ( V, E ), where V = { v , v , . . . , v n } corresponds tothe set G of gaps. For each interval s i = ( a i , b i ) ∈ S , we create an edge e i =( v α , v β ) ∈ E if a i ∈ g α and b i ∈ g β . See Figure 5 for an example. As we haveremoved useless and redundant intervals, there are no loops and multipleedges in G . Thus, | V | = n + 1 and | E | ≤ m . The minimum edge-cover (MEC) E (cid:48) consists of (i) the edges of a maximum matching in G , and (ii) for eachunmatched vertex (if exists), any arbitrary edge incident to that vertex Gareyand Johnson (1979). It can be computed in time O (min( n , m √ n )) Micali andVazirani (1980). An interval that covers no point. An interval a is said to be a redundant interval if the interval a and some other interval b create the same edge in E but the right-end point of a is to the left of the right-end pointof b .2 S. Dey et al. Let S (cid:48) be the set of intervals corresponding to the edges of E (cid:48) . Clearly, S (cid:48) discriminates all consecutive point-pairs of P , since for each gap g i , there isan interval with an endpoint in g i . Moreover, S (cid:48) is an optimal set of intervalsdiscriminating all consecutive point-pairs. Thus, any solution to Discrete-G-Min-Disc-Code for (
P, S ) has size at least | S (cid:48) | , since any such solutionshould in particular discriminate consecutive point-pairs. Lemma 1
The points in P can be classified into sets U, Q , . . . , Q k using theset S (cid:48) (see Figure 6), with the following properties. – A subset U ⊆ P will receive unique codes by S (cid:48) , – A subset Q ⊂ P may not be covered by the intervals of S (cid:48) , and hencethey will not receive any code. If | Q | > then the elements in Q arenon-consecutive. – Some subsets Q , . . . , Q k of points (of sizes > ) of P may each receivethe same nonempty code by S (cid:48) . In that case, the members of each of thosesubsets are non-consecutive.Proof Clearly, since S (cid:48) discriminates all consecutive point-pairs, for any inte-ger i , any two points of Q i cannot be consecutive. s s s s s v p p p p p s v v v v v s s s s s s s s s s s p p p p p s (a) (b) v v v v v v s s s s s s Fig. 6
Illustration of Lemma 1 with two different MECs: the points in set U (red), Q (blue) and Q (green). Lemma 2
Denote by I ( Q i ) , the interval starting at the first point of Q i andstopping at the last point of Q i . Then, for any two distinct sets Q i and Q j ,either I ( Q i ) and I ( Q j ) are disjoint, or one of them (say Q j ) is strictly includedbetween two consecutive points of the other ( Q i ). In that case, we say that Q j is nested inside Q i .Proof Suppose that I ( Q i ) and I ( Q j ) intersect. Recall that all the points in Q i have the same code C i by S (cid:48) , and all the points in Q j have the same code C j (cid:54) = C i by S (cid:48) . That is, each interval of S (cid:48) either contains all points or nopoint of Q i and Q j , respectively, and there is at least one interval I of S (cid:48) that iscriminating Codes in Geometric Setups 13 contains, say, all points of Q j but no point of Q i . Then, necessarily, I ( Q j ) isincluded between two consecutive points of Q i , as claimed.For a set Q i of size s , we denote q i , . . . , q si the points in Q i . We next useLemma 2 to give a lower bound on the size of S (cid:48) . Lemma 3
We have | S (cid:48) | ≥ (cid:80) ki =0 ( | Q i | −
1) + 1 .Proof
Consider the sets Q , . . . , Q k (possibly Q = ∅ ). We will prove thatevery interval I ( Q i ) contains a set S (cid:48) i of at least | Q i | − S (cid:48) thatare included in I ( Q i ). Moreover, for every Q j that is nested inside Q i , noneof the intervals of S (cid:48) i are included in I ( Q j ).We proceed by induction on the nested structure of the I ( Q i )’s that followsfrom Lemma 2. As a base case, assume that I ( Q i ) has no interval I ( Q j )nested inside. Since by Lemma 1, the points of Q i are non-consecutive inside P , between each pair q ai , q a +1 i of consecutive points of Q i , there is at least onepoint p of P . By definition of Q i , p is discriminated from all points of Q i by S (cid:48) . Hence, there is an interval of S (cid:48) that lies completely between q ai and q a +1 i :add it to S (cid:48) i . Since there are | Q i | − | S (cid:48) i | ≥ | Q i | − Q j thatare nested inside Q i . Consider a point q ai of Q i that is not the last point of Q i . Again, between q ai and q a +1 i , there is a point of P . Let p be the point of P that comes just after q ai . The set S (cid:48) discriminates the two consecutive points q ai and p . However, there cannot be an interval of S (cid:48) covering q ai and endingbetween q ai and p , otherwise it would also discriminate q ai and q a +1 i . Thus,there must be an interval I of S (cid:48) that starts between q ai and p . Notice that I is not included in any I ( Q j ), for Q j nested inside Q i . Thus, we can add I to S (cid:48) i . Repeating this for all points of Q i except the last one, we obtain that | S (cid:48) i | ≥ | Q i | −
1, as claimed.We have thus proved that there are at least (cid:80) ki =0 ( | Q i | −
1) distinct intervalsof S (cid:48) , each of them being included in some I ( Q i ). But moreoever, there is atleast one interval of S (cid:48) that is not included in any I ( Q i ). Indeed, there mustbe an interval of S (cid:48) that corresponds to an edge of E (cid:48) that covers the firstgap g . This interval has not been counted in the previous argument. Thus, itfollows that | S (cid:48) | ≥ (cid:80) ki =0 ( | Q i | −
1) + 1.Next, we will choose additional intervals from S \ S (cid:48) to discriminate the pointsin ∪ kj =0 Q j , and add them to S (cid:48) . The resulting set, S (cid:48)(cid:48) , will form a discrimi-nating code of ( P, S ). Consider some set Q i = { q i , . . . , q si } . We will choose atmost s − Q i are discriminated: call this set S (cid:48)(cid:48) i . We start with q i , q i , and we select some interval of S that discriminates q i , q i (since ( P, S ) can be assumed to be twin-free, such an interval exists) andadd it to S (cid:48)(cid:48) i . We then proceed by induction: at each step a (2 ≤ a ≤ s − we assume that the points q i , . . . , q ai are discriminated, and we consider q a +1 i .There is at most one point, say q bi , among q i , . . . , q ai whose code is the sameas q a +1 i by S (cid:48)(cid:48) i (since by induction q i , . . . , q ai all have different codes). We thusfind one interval of S that discriminates q a +1 i , q bi and add it to S (cid:48)(cid:48) i . In the endwe have | S (cid:48)(cid:48) i | ≤ | Q i | − Q i , all pairs of points of P arediscriminated by S (cid:48) ∪ (cid:83) kj =0 S (cid:48)(cid:48) j . Finally, we may have to add one additionalinterval in order to cover one point of Q , that remains uncovered. Let us call S (cid:48)(cid:48) the resulting set: this is a discriminating code of ( P, S ). Moreover, we haveadded at most (cid:80) kj =0 ( | Q j | −
1) + 1 additional intervals to S (cid:48) , to obtain S (cid:48)(cid:48) . ByLemma 3, we thus have | S (cid:48)(cid:48) | ≤ | S (cid:48) | + (cid:80) kj =0 ( | Q j | −
1) + 1 ≤ | S (cid:48) | .Hence, denoting by OP T the optimal solution size for (
P, S ), and recalling that | S (cid:48) | ≤ OP T , we obtain that | S (cid:48)(cid:48) | ≤ | S (cid:48) | ≤ OP T . Moreover, the constructionof S (cid:48)(cid:48) from S can be done in linear time. Thus, we have proved the following: Theorem 2
The proposed algorithm produces a -factor approximation for Discrete-G-Min-Disc-Code in 1D, and runs in time O (min( n , m √ n )) . Observation 2
In an instance ( P, S ) of Discrete-G-Min-Disc-Code in1D, if the objects in S are intervals of the same length, then discriminatingall the pairs of consecutive points in P is equivalant to discriminating all thepairs of points in P .Proof Assume that we have a set S (cid:48) that covers all points and discriminatesall consecutive point-pairs, but two non-consecutive points p i and p j ( i < j )are not discriminated. Since p i and p j are covered by some intervals of S (cid:48) , andthey are covered by the same set of intervals of S (cid:48) , some unit interval containsthem both, so they must be at a distance at most 1 apart. Now, since theyare not consecutive, p i +1 lies between p i and p j . Since S (cid:48) discriminates p i and p i +1 , there is an interval I ∈ S (cid:48) with an endpoint in the gap g i . If it is theright endpoint, I covers p i but not p j , a contradiction. Thus, it must be theleft endpoint. But since the distance between p i and j is at most 1, I contains p j (but not p i ), again a contradiction.For a given (cid:15) >
0, we choose (cid:100) n(cid:15) (cid:101) points, namely q , q , . . . , q (cid:100) n(cid:15) (cid:101) ∈ P , calledthe reference points , as follows: q is the (cid:100) (cid:15) (cid:101) -th point of P from the left,and for each i = 1 , , . . . , (cid:98) n(cid:15) (cid:99) , the number of points in P between every iscriminating Codes in Geometric Setups 15 consecutive pair ( q i , q i +1 ) is (cid:100) (cid:15) (cid:101) , including q i and q i +1 (the number of pointsto the right of q (cid:100) n(cid:15) (cid:101) may be less than (cid:100) (cid:15) (cid:101) ). For each reference point q i , wechoose two intervals I i , I i ∈ S such that both I i , I i contain (span) q i , andthe left (resp. right) endpoint of I i (resp. I i ) have the minimum x -coordinate(resp. maximum x -coordinate) among all intervals in S that span q i . Observethat all the points in P that lie in the range G i = [ (cid:96) ( I i ) , r ( I i )] are covered ,where (cid:96) ( I i ) , r ( I i ) are the x -coordinates of the left endpoint of I i and the rightendpoint of I i , respectively. These ranges will be referred to as group-ranges .Since the endpoints of the intervals are distinct, the span of a group-range isstrictly greater than 1.We now define a block as follows. Observe that the ranges G i and G i +1 mayor may not overlap. If several consecutive ranges G i , G i +1 , . . . , G k are pairwiseoverlapping, then the horizontal range [ (cid:96) ( I i ) , r ( I k )] forms a block. The regionbetween a pair of consecutive blocks will be referred to as a free region . Weuse B , B , . . . , B l to name the blocks in order, and F , F , . . . , F l to name thefree regions (from left to right). The points in each block are covered. Here,the remaining tasks are (i) for each block, choose intervals from S such thatconsecutive pairs of points in that block are discriminated, and (ii) for eachfree region, choose intervals from S such that all its points are covered, and thepairs of consecutive points are discriminated. Observe that no interval I ∈ S can contain both a point in F i and a point in F i +1 since F i and F i +1 aresepatated by the block B i +1 . The reason is that if there exists such an interval I , then it will contain the reference point q j ∈ B i +1 just to the right of F i .This contradicts the choice of I j for q j . Thus, the discriminating code for afree region F i is disjoint from that of its neighboring free region F i +1 . So, wecan process the free regions independently. Processing of a free region:
Let the neighboring group-ranges of a freeregion F i be G a and G a +1 , respectively. There are at most (cid:15) points lyingbetween the reference points of G a and G a +1 . Among these, several pointsof P to the right (resp. left) of the reference point of G a (resp. G a +1 ) areinside block B i (resp. B i +1 ). Thus, there are at most (cid:15) points in F i . We collectall the members in I F i ⊆ S that cover at least one point of F i . Note that,though we have deleted all the redundant intervals of S , there may be severalintervals in S with an endpoint lying in a gap inside that free region, and theirother endpoint lies in distinct gaps of the neighboring block. There are someblue intervals which are redundant with respect to the points F i ∩ P , but arenon-redundant with respect to the whole point set P . However, the number ofsuch intervals is at most (cid:15) due to the definition of ( I i , I i ) of the right-mostgroup-range of the neighboring block B i and left-most group-range of B i +1 .Thus, we have |I F i | = O (1 /(cid:15) ). We consider all possible subsets of intervals of I F i , and test each of them for being a discriminating code for the points in F i .Let D i be all possible different discriminating codes of the points in F i , with |D i | = 2 O (1 /(cid:15) ) in the worst case. the reference point of the leftmost group-range G j of the block B i +1 .6 S. Dey et al. G a G a +1 N i g-range gap Fig. 7
Demonstration of redundant edges in a free region which are non-redundant in theproblem instance (
P, S ) Processing of a block:
Consider a block B i ; its neighboring free regions are F i and F i +1 . Consider two discriminating codes d ∈ D i and d (cid:48) ∈ D i +1 . As inSection 2.2, we create a graph G i = ( V i , E i ) whose nodes V i correspond tothe gaps of B i which are not discriminated by the intervals used in D i and D i +1 . Each edge e ∈ E i corresponds to an interval in S that discriminatespairs of consecutive points corresponding to two different nodes of V i . Now,we can discriminate each non-discriminated pair of consecutive points in B i by computing a minimum edge-cover of G i in O ( | V i | ) time Micali and Vazi-rani (1980). As mentioned earlier, all the points in B i are covered. Thus, thediscrimination process for the block B i is over. We will use θ ( d, d (cid:48) ) to denotethe size of a minimum edge-cover of B i using d ∈ D i and d (cid:48) ∈ D i +1 . Computing a discriminating code for P : We now create a multipartitedirected graph H = ( D , F ). Its i -th partite set corresponds to the discrimi-nating codes in D i , and D = ∪ li =0 D i . Each node d ∈ D has its weight equal tothe size of the discriminating code d . A directed edge ( d, d (cid:48) ) ∈ F connects twonodes d and d (cid:48) of two adjacent partite sets, say d ∈ D i and d (cid:48) ∈ D i +1 , and hasits weight equal to θ ( d, d (cid:48) ). For every pair of partite sets D i and D i +1 , we con-nect every pair of nodes ( d, d (cid:48) ) d ∈ D i and d (cid:48) ∈ D i +1 , where i = 0 , , . . . , l − D is connected to a node s with weight 0, and every node of D l is connected to a node t with weight 0. Lemma 4
The shortest weight of an s - t path in H is a lower bound on thesize of the optimum discriminating code for ( P, S ) .Proof Let Π be the shortest s - t path in the graph H , which correspondsto a set of intervals I (cid:48) ⊆ I , the set I opt ⊆ I corresponds to the minimumdiscriminating code, and |I (cid:48) | > |I opt | . As I opt is a discriminating code, thepoints of every free region F i are discriminated by a subset, say δ i ∈ I . Since,we maintain all the discriminating codes in D i , surely δ i ∈ D i . Let b i ⊂ I be the set of intervals that span the points of the block B i . As I opt is adiscriminating code, the points in B i are discriminated by the intervals in b i ∪ δ i ∪ δ i +1 . Thus the set of intervals β i = b i \ ( δ i ∪ δ i +1 ) discriminate thepair of points of B i that are not discriminated by δ i ∪ δ i +1 . Observe that, forevery i = 0 , , . . . , l , we have δ i ∈ D i . Moreover, there exists a path Π opt that The weight of a path is equal to the sum of costs of all the vertices and edges on thepath.iscriminating Codes in Geometric Setups 17 connects δ i , i = 0 , , . . . , l , whose each edge ( δ i , δ i +1 ) has cost equal to | β i | .Thus, we have the contradiction that Π opt is a path in G having cost less thanthat of Π .Let S (cid:48) denote the set of intervals of S in a shortest s - t path in H . The intervalsin S (cid:48) may not form a discriminating code for P , as the points in a block may notall be covered. However, the additional intervals { ( I i , I i ) , i = 1 , , . . . , (cid:100) n(cid:15) (cid:101)} ensure the covering of the points in all blocks B i , i = 1 , , . . . , (cid:100) n(cid:15) (cid:101) . Thus, SOL = S (cid:48) ∪ { ( I i , I i ) , i = 1 , , . . . , (cid:100) n(cid:15) (cid:101)} is a discriminating code for ( P, S ).Moreover, the optimum size of the discriminating code, denoted
OP T , satisfies
OP T ≥ (cid:100) n +12 (cid:101) due to the fact that we have ( n + 1) gaps, and each interval in S covers exactly 2 gaps. This fact, along with Lemma 4 implies: Lemma 5 | SOL | ≤ (1 + (cid:15) ) OP T .Proof
By Lemma 4, |I (cid:48) | ≤ I opt . The number of extra intervals to cover the block s is n(cid:15) . Again, n ≤ EC ( P ) ≤ I opt , where EC ( P ) is the size of minimumedge-cover of the graph G created with the points in P and the intervals in I .Thus, | SOL | ≤ (1 + (cid:15) ) I opt .The number of possible discriminating codes in a free region is 2 O (1 /(cid:15) ) . Thus,we may have at most 2 O (1 /(cid:15) ) edges between a pair of consecutive sets D i and D i +1 . As the computation of the cost of an edge between the sets D i and D i +1 invokes the edge-cover algorithm of an undirected graph, it needs O ( | B i | )time Micali and Vazirani (1980). Thus, the total running time of the algorithmis A + B , where A is the time of generating the edge costs, and B is the timefor computing a shortest path of H . We have A ≤ (cid:80) (cid:100) n(cid:15) (cid:101) i =1 O (1 /(cid:15) ) × O ( | B i | ).As the B i ’s are mutually disjoint, we get A = O ( n × O (1 /(cid:15) ) ). Moreover, B = O ( |F| ) = O ( n(cid:15) × O (1 /(cid:15) ) ) Thorup (1999).Moreover, we can easily reduce Continuous-G-Min-Disc-Code to Discrete-G-Min-Disc-Code by first computing the O ( n ) possible non-redundant unitintervals. Thus: Theorem 3
Discrete-G-Min-Disc-Code and
Continuous-G-Min-Disc-Code in 1D for unit interval objects have a PTAS: for every (cid:15) > , they admita (1 + (cid:15) ) -factor approximation algorithm with time complexity O (1 /(cid:15) ) n . Thus, we have the following result.
Theorem 4
Discrete-G-Min-Disc-Code in 1D for unit interval objectshas a PTAS: for every (cid:15) > , it admits a (1+ (cid:15) ) -factor approximation algorithmwith time complexity O (1 /(cid:15) ) n . Moreover, in this (unit) interval setting, we easily reduce
Continuous-G-Min-Disc-Code to Discrete-G-Min-Disc-Code by computing the O ( n )possible non-redundant unit intervals. Thus: Corollary 1
Continuous-G-Min-Disc-Code in 1D for unit interval ob-jects has a PTAS with the same properties as the one for
Discrete-G-Min-Disc-Code . Time complexity analysis:
In order to reduce the space complexity, wegenerate partite sets of the multipartite graph H one by one, and computethe length of the shortest path from s up to each node of that set. Initially,the length of the path up to a node d ∈ D is | d | . While generating D i +1 , thenodes in D i are available along with the length of the shortest path up to itseach node from s . Now, we execute the following steps:Step 1: We generate the nodes of D i +1 , and initialize their cost χ with ∞ .Step 2: For each pair of nodes ( d, d (cid:48) ) , d ∈ D i , d (cid:48) ∈ D i +1 , do the following: – Compute the edge cost θ ( d, d (cid:48) ), which is the size of the edge-cover ofthe block B i using the discriminating codes d of the free region F i and d (cid:48) of the free region F i +1 . This needs O ( | B i | ) time using the matchingalgorithm of an undirected graph Micali and Vazirani (1980). – Compute the length of the shortest path from s to d (cid:48) using the edge( d, d (cid:48) ), which is χ ( d ) + θ ( d, d (cid:48) ) + | d (cid:48) | . – If the computed length is less than the existing value of χ , then update χ with this length.Thus in order to analyze the complexity results, we need to know the worst casesize of D i . It is already mentioned that the number of intervals in S spanningthe points of F i is O ( (cid:15) ) . Thus, we may have at most 2 O (1 /(cid:15) ) discriminatingcodes in the worst case using those intervals, each of length at most O ( (cid:15) ). Notethat, we will not store the edges between D i and D i +1 . They are computedonline during the execution.Now, the number of edges between a pair of consecutive partite sets D i and D i +1 is |D i | × |D i +1 | = 2 O (1 /(cid:15) ) . Thus, the total number of edges of the graph H is (cid:100) n(cid:15) (cid:101)× O (1 /(cid:15) ) . As the computation of the cost of an edge between the sets D i and D i +1 invokes the edge-cover algorithm, which in turn uses the matchingalgorithm of an undirected graph, it needs O ( | B i | ) time Micali and Vazirani(1980). Thus, the total running time of the algorithm is A + B , where the totaltime of generating the edge costs is A = (cid:80) (cid:100) n(cid:15) (cid:101) i =1 O (1 /(cid:15) ) × O ( | B i | . As the B i ’sare mutually disjoint for i = 1 , , . . . , (cid:100) n(cid:15) (cid:101) , we have A = O ( n × O (1 /(cid:15) ) ). Thetime for computing the shortest path is B = O ( |F| ) = O ( n(cid:15) × O (1 /(cid:15) ) ) Thorup(1999). Thus, Discrete-G-Min-Disc-Code in 1D for unit interval objectshas a PTAS: for every (cid:15) >
0, it has a (1 + (cid:15) )-factor approximation algorithmwith time complexity 2 O (1 /(cid:15) ) n . iscriminating Codes in Geometric Setups 19 In Gledel and Parreau (2019), it was shown that
Continuous-G-Min-Disc-Code for bounded-radius disks is NP-complete. The same proof technique,a reduction from the NP-complete P -Partition-Grid problem van Bevernet al. (2014), can be adapted to show the following. Theorem 5
Continuous-G-Min-Disc-Code and
Discrete-G-Min-Disc-Code for axis-parallel unit squares in 2D are NP-complete.Proof (Proof of Theorem 5)
In Gledel and Parreau (2019), it has been shownthat
Continuous-G-Min-Disc-Code for unit disks in 2D is NP-complete.They reduced the P -Partition-Grid problem, stated below, to Continuous-G-Min-Disc-Code for unit disks in 2D. Almost the same reduction holds for
Continuous-G-Min-Disc-Code for axis-parallel unit squares in 2D.A grid graph is a graph whose vertices are positioned in Z , and a pair ofvertices are adjacent if they are at Euclidean distance 1. P -Partition-Grid van Bevern et al. (2014) Input:
A grid graph G . Output:
A partition of the vertices of G into disjoint P -paths, where a P -path is a path with three vertices. v v v v v v p ( v ) p ( v ) p ( v ) p ( v ) p ( v ) p ( v )(a) (b) Fig. 8 (a) A grid graph G (b) Its corresponding geometric instance P G , where the dashedaxis-parallel unit squares are those covering two points each. Given an instance G of P -Partition-Grid , we construct an instance P G of Continuous-G-Min-Disc-Code as follows. For every vertex v of G withcoordinates ( x, y ), we create a point p ( v ) with coordinates ( x, y ) and add it to P G . Then, we apply a rotation of angle π/ The construction from Gledel and Parreau (2019) stops here.0 S. Dey et al. scaling of factor √
2. Thus in the end, p ( v ) has coordinates ( x − y, x + y ) (SeeFigure 8). The following completes the proof. Lemma 6 A P -partition for G = ( V, E ) exists if and only if there exists aset of | V | axis-parallel unit squares discriminating P G .Proof The key idea is to notice that any axis-parallel unit square can containat most two points of P G , and if it contains two, then it contains two corre-sponding to vertices of G joined by an edge (the center of the square is thenplaced at mid-distance between the two points). Moreover, any two points cor-responding to an edge of G can be covered by some axis-parallel unit square inthat way. Now, three points corresponding to the three vertices of a P -path v v v in G can be discriminated using two unit squares S and S (cid:48) , centeredat the mid-points of the two segments joining p ( v ) , p ( v ) and p ( v ) , p ( v ),respectively. Now, p ( v ) is covered by S only, p ( v ) by S (cid:48) only, and p ( v ) byboth. Thus, if a P -partition of G exists, we have our solution of size | V | to Continuous-G-Min-Disc-Code .Conversely, assume that we have | V | axis-parallel unit squares that discrim-inates all points of P G . Then, a counting argument shows that every square S must cover two points, and thus, corresponds to an edge v v of G . Then,one of p ( v ) , p ( v ) must be covered by some other square S (cid:48) . Again, a countingargument shows that one point must be covered by S only, one by S (cid:48) only, andone by both. In the end the vertices of G corresponding to the points coveredby S and S (cid:48) induce a P and we obtain our P -partition of G , as claimed.Finally, the proof for Discrete-G-Min-Disc-Code is the same, where wedefine the set S of allowed unit square objects as the set of all unit squaresthat contain two points of P . This concludes the proof of Theorem 5.3.1 A (4 + (cid:15) )-approximation algorithm for the continuous problemNext, we propose a constant-factor approximation algorithm for Continuous-G-Min-Disc-Code for axis-parallel unit squares in 2D.We formulate our algorithm by extending the ideas for the 1D case in Sec-tion 2.2. Here, our goal is to choose a set Q of points in R of minimum cardi-nality such that every point of P is covered by at least one axis-parallel unitsquare centered at Q , and for every pair of points p i , p j ∈ P ( i (cid:54) = j ), there existsat least one square whose boundary intersects the interior of the segment p i p j exactly once. We define the set of line segments L ( P ) = { p i p j for all p i , p j ∈ P, i (cid:54) = j } , where p i p j is the line segment joining p i and p j . We will thus usethe following problem: iscriminating Codes in Geometric Setups 21 Segment-Stabbing
Input:
A set L of segments in 2D. Output:
A minimum-size set S of axis-parallel unit squares in 2D suchthat each segment is intersected exactly once by some square of S .In fact, Segment-Stabbing for the input L ( P ) is equivalent to the TestCover problem for P using axis-parallel unit squares as tests. As in the edge-cover formulation of Discrete-G-Min-Disc-Code in 1D from Section 2.2,here also a feasible solution of
Segment-Stabbing ensures that the two end-points of each line segment of L ( P ) are discriminated, but one point mayremain uncovered. Thus, we have the following: Observation 3
For a feasible solution Φ of Segment-Stabbing , (a) Φ dis-criminates every point-pair in P and (b) at most one point is not covered byany square in Φ . In order to discriminate the two endpoints of a member (cid:96) = [ a, b ] ∈ L ( P ), weneed to consider the two cases: λ ( (cid:96) ) ≥ λ ( (cid:96) ) <
1, where λ ( (cid:96) ) denotesthe length of (cid:96) . In the former case, if a center is chosen in any one of the unitsquares centered at a and b , the segment (cid:96) is stabbed. However, more generallyin the second case, to stab (cid:96) , we need to choose a center in the region ( D ( a ) \ D ( b )) ∪ ( D ( b ) \ D ( a )), where D ( q ) is the axis parallel unit square centered at q (see Figure 9). Let us denote the set of all such objects corresponding tothe members in L ( P ) as O . We now need to solve the Hitting Set problem,where the objective is to choose a minimum number of center points in R ,such that each object in O contains at least one of those chosen points. Wesolve this problem using a technique followed in Acharyya et al. (2019) forcovering a set of segments using unit squares. (a) (b) Fig. 9
Object for segment (cid:96) = [ a, b ], where (a) λ ( (cid:96) ) ≥ λ ( (cid:96) ) <
12 S. Dey et al.
The Seg-HIT problem.
Consider the arrangement de Berg et al. (2008) A of the objects in O . Create a set Q of points by choosing one point in eachcell of A . A square centered at a point q inside a cell A ∈ A will stab all thesegments whose corresponding objects have common intersection A . For eachpoint q ∈ Q , we use an indicator variable x q . Thus, we have an integer linearprogramming (ILP) problem, whose objective function is: Z : min | Q | (cid:88) α =1 x α , subject to σ ( (cid:96) ) + σ ( (cid:96) ) ≥ (cid:96) = [ a, b ] ∈ L ( P ) , where σ ( (cid:96) ) = (cid:88) q α ∈ Q ∩ ( D ( a ) \ D ( b )) x α , and σ ( (cid:96) ) = (cid:88) q α ∈ Q ∩ ( D ( b ) \ D ( a )) x α , and x α ∈ { , } for all points q α ∈ Q (1)As the ILP is NP-hard Papadimitriou and Steiglitz (1982), we relax the in-tegrality condition of the variables x q for all q ∈ Q from Z , and solve thecorresponding LP problem Z : min | Q | (cid:88) α =1 x α subject to σ ( (cid:96) ) + σ ( (cid:96) ) ≥ ∀ (cid:96) = [ a, b ] ∈ L ( P ) , and 0 ≤ x α ≤ ∀ q α ∈ Q (2)in polynomial time.Observe that for each constraint, at least one of σ ( (cid:96) ) or σ ( (cid:96) ) will be greaterthan . We choose either ( D ( a ) \ D ( b )) or ( D ( b ) \ D ( a )) or both in a set O depending on whether σ ( (cid:96) ) > or = or < σ ( (cid:96) ), and form an ILP Z for thehitting set problem with the objects in O as stated above. Observe that, if x is an optimum solution for Z , then 2 x is a feasible solution of Z . Denotingby OP T θ and OP T θ as the optimum solutions of the problem Z θ and Z θ respectively, we have OP T ≤ | Q | (cid:88) α =1 x α = 2 OP T ≤ OP T , (3) The L-HIT problem.
Now, we solve Z , where each object is either a unitsquare or an L -shape object whose length and width of the outer side are 1.Such an object is the union of two rectangles of type A and B , where the oneof type A has height 1 and width ≤
1, and the one of type B has width 1 andheight ≤ iscriminating Codes in Geometric Setups 23 T y p e A Type B
Fig. 10
L-shaped object which is the union of a type A and a type B object
While solving Z , for each constraint, any (or both) of these cases must happen:(a) the sum of variables whose corresponding points lie in a type A rectangleis ≥ .
5, (b) the sum of variables whose corresponding points lie in a type B rectangle is ≥ .
5. We accumulate all type A (resp. B ) rectangles for whichcondition (a) (resp. (b)) is satisfied in set A (resp. B ).The ILP formulation Z A of the hitting set problem for the rectangles in A can be done as follows. Consider the arrangement of the rectangles in A . Ineach cell of the arrangement, we can choose a point to form a set of points Q A considering all the cells in A . Now, Z A : min (cid:88) q ∈ Q A x q , subject to (cid:88) q ∈ A α x q ≥ , for each rectangle A α ∈ A , and x q ∈ { , } , ∀ q ∈ Q A . (4)Similarly, we can have an ILP formulation Z B for the hitting set problem ofthe rectangles in B . The corresponding LP problems are Z A and Z B respectively. Following the notations introduced earlier, we have OP T A + OP T B ≤ OP T A + OP T B ≤ OP T . (5)The right-hand inequality follows from the fact that if we multiply the solutionof the variables in OP T by 2, and then round the fractional part of each non-zero x α , we can get a feasible solution for Z A and Z B . The U-HIT problem.
We now compute the optimum solution
OP T A of Z A and OP T B of Z B , where all rectangles in A are of unit height and allrectangles in B are of unit width. Mustafa and Ray Mustafa and Ray (2010)proposed a PTAS for the U-HIT problem that runs in O ( mn (cid:15) ) time, where n and m are the number of points and the number of unit-height rectangles. Equations 3 and 5 and the PTAS for U-HIT lead to the following:
Lemma 7
For a given set of line segments L , the aforesaid algorithm com-putes a ( (cid:15) (cid:48) )-factor approximation for Segment-Stabbing , for every fixed (cid:15) (cid:48) > . After solving
Segment-Stabbing , by Observation 3, at most one point in P may not be covered. Thus, we may add at most one extra square to cover thatpoint, and obtain a solution of size at most (4 + (cid:15) (cid:48) ) OP T + 1, which implies:
Theorem 6
Continuous-G-Min-Disc-Code for axis-parallel unit squaresin 2D has a polynomial-time (4 + (cid:15) ) -factor approximation algorithm, for everyfixed (cid:15) > .Proof It remains only to show that having a solution of size at most (4 + (cid:15) (cid:48) ) OP T + 1 gives a (4 + (cid:15) )-approximation, for every fixed (cid:15) >
0. To see this,note that
OP T ≥ log ( n + 1) (where n is the number of points), since everypoint is assigned a distinct nonempty subset of the solution SOL , and therecan be at most 2 | SOL | − (cid:15) (cid:48) ) OP T +1 givesan approximation factor of 4+ (cid:15) (cid:48) + OP T which is thus at most 4+ (cid:15) (cid:48) + ( n +1) .Thus, if (cid:15) (cid:48) + ( n +1) ≤ (cid:15) , we are done. Otherwise, n ≤ /(cid:15) and hence we cansolve the problem by brute-force in constant time (since (cid:15) is fixed).3.2 A (32 + (cid:15) )-approximation algorithm for the discrete problemAs for Continuous-G-Min-Disc-Code (Section 3), we reduce
Discrete-G-Min-Disc-Code to a special version of
Hitting Set , where a set O of unitheight rectangles and a set Q of points are given. The set Q contains the centersof the squares in S , and the objective is to find a minimum cardinality subsetof Q that hits all the objects in O . Thus, using an α -factor approximationalgorithm for the discrete version of this hitting set problem, we obtain a4 α -factor approximation algorithm for the Discrete-G-Min-Disc-Code .In this section, we adapt the algorithm of Section 3 for
Continuous-G-Min-Disc-Code to solve
Discrete-G-Min-Disc-Code . Recall that here, in addi-tion to the set of points P (in R ), the set of axis-parallel unit squares objects S are also given in the input. As in Section 3, Discrete-G-Min-Disc-Code also reduces to the discrete version of the U-HIT problem, whose objective isto hit a set O of unit height rectangles by choosing a minimum cardinalitysubset of a given set of points Q , where Q is the set of centers of the squaresin S . Thus, if we have an α -factor approximation algorithm for the discreteversion of the U-HIT problem, we can use it to get a 4 α -factor approximationalgorithm for Discrete-G-Min-Disc-Code . iscriminating Codes in Geometric Setups 25 Mustafa and Ray (2010) proposed a PTAS for this version of U-HIT problemthat runs in O ( mn (cid:15) ) time, where n and m are the number of points and thenumber of unit-height rectangles (which are basically the 2-admissible objects).We modify the approximation algorithm for the continuous version of the U-HIT problem, proposed in Section 3, to get a constant factor approximationalgorithm for the discrete version of the U-HIT problem. Here, the input is a set of axis-parallel rectangles R intersected by a horizontalline λ and a set of points Q . The objective is to choose a minimum number ofpoints from Q to hit all the rectangles in R . This problem can be formulatedas the following ILP: U : min (cid:88) q ∈ Q x q Subject to σ ( r ) + σ ( r ) ≥ , for all r ∈ R, (6)where σ ( r ) (resp. σ ( r )) is the sum of the variables corresponding to thepoints above (resp. below) the line λ that lie inside the rectangle r . We willuse OP T λ to denote the optimum solution of this ILP.On the basis of the LP relaxation of this ILP, we can partition the rectanglesinto two groups: R a and R b . R a (resp. R b ) contains the rectangles whoseconstraint satisfies σ ( r ) < σ ( r ) (resp. σ ( r ) > σ ( r )). Let U a and U b bethe ILP for the minimum hitting set problems for the rectangles R a and R b respectively. Arguing as in Equation (3), we can say that if OP T a and OP T b are optimum solutions of U a and U b , respectively, then | OP T a + OP T b | ≤ | OP T λ | (7)Now, we need to solve the ILP U a to compute OP T a . U b will be solved in asimilar manner. U a : Here, the rectangles in R a are to be hit by the points in Q a ⊆ Q that lie abovethe line λ . Ignoring the portions of the rectangles in R a below the line λ ,the problem reduces to hitting a set of axis-parallel rectangles ( R a ) anchoredalong a horizontal line λ using the input points Q a . We solve this problem asfollows:We compute the maximum independent set I = { r , r , . . . } of the set ofrectangles R a . Here, OP T I = { lowest point of Q a inside r for each element r ∈ I} is the minimum hitting set for the rectangles in I . Such a point insideeach r i will always exist, and OP T (cid:48)I = { lowest point of Q a inside the strip χ i bounded by the right sideof r i and left side of r i +1 (if exists), for each pair of consecutive elements r i , r i +1 ∈ I} . Note that the left-most strip is left-open, and the right-moststrip is right-open.Let R (cid:48) ⊆ R a be the set of rectangles that are hit by OP T I ∪ OP T (cid:48)I . Theremaining set of rectangles R (cid:48)(cid:48) = R a \ R (cid:48) can be grouped into three sets R , R and R , where R = ∪ r i ∈I R i and R i is the set of rectangles in R a thatspans from the interior of the strip χ i − up to the interior of the rectangle r i .Similarly, the rectangles in R are defined. The set R consists of rectanglesthat overlap with the complete horizontal span of at least one member in I .Now, observe that in a feasible solution for R (cid:48)(cid:48) , we haveeach rectangle ρ ∈ R i can be hit by a point of Q a lying inside r i (i.e., right-part of ρ ), or by a point of Q a lying in the vertical strip χ i − (i.e., left-part of ρ ).Similarly, a rectangle in ρ ∈ R i may be hit in its left-part (inside r i ∈ I ) orin its right-part (inside the strip χ i ).Finally, consider the rectangles in R . If a rectangle spans from the strip χ i − to the strip χ j , then ρ must not be hit by any point of Q a inside therectangles r i , r i +1 , . . . , r j , and also inside the strips χ i , χ i +1 , . . . χ j − . Thereason is that, we have chosen the bottom-most point in those rectanglesand strips in SOL ∪ SOL .Thus, it must be hit by a point of Q a ∩ χ i − in its left part or by a pointof Q a ∩ χ j in its right-part. Note that the left, or right, or both side(s) of ρ may lie inside of r i and/or r j . Thus, the left part of ρ may lie inside r i and right part of ρ may lie inside r j .In a solution, a rectangle in R (cid:48)(cid:48) may be said to be a left-hit (resp. right-hit)rectangle if its left (resp. right) part is hit by a point in the solution.Thus, one can decide whether a rectangle in R (cid:48)(cid:48) = R ∪ R ∪ R is left-hit orright-hit by formulating an ILP with these rectangles as follows. V : min (cid:88) p α ∈ Q a x α Subject to σ ( ρ ) + σ ( ρ ) ≥ ∀ ρ ∈ R (cid:48)(cid:48) , (8)where σ ( ρ ) (resp. σ ( ρ )) is the sum of the variables corresponding to thepoints in Q a left-part (resp. right-part) of the rectangle ρ . The solution ofits LP relaxation V (see Section 3.1) partitions the set R (cid:48)(cid:48) into two subsets R left (left-hit) and R right (right-hit) such that for each ρ ∈ R left , we have σ ( ρ ) ≥ σ ( ρ ) and for each ρ ∈ R right , we have σ ( ρ ) < σ ( ρ ).Below, we describe the method of computing the optimum solution of the ILPs V i : min (cid:88) p α ∈ Q a x α Subject to σ ( ρ ) ≥ ∀ ρ ∈ R , i = left, right . (9) iscriminating Codes in Geometric Setups 27 Arguing as in the ILP and LP problems given in Section 3.1, we obtain:
Proposition 2 If OP T (cid:48)(cid:48) be the optimum solution of the ILP V , and OP T i isthe optimum solution of the ILP V i , i = left, right, then OP T left + OP T right is a feasible solution of
OP T (cid:48)(cid:48) , and also | OP T left | + | OP T right | ≤ | OP T (cid:48)(cid:48) | .3.2.3 Computation of the optimal solution of V left : We will consider each strip { S , S , S , . . . , S k +1 } = { χ , r , χ , r , χ , . . . , r k , χ k } in this order, where I = {∇ ∞ , ∇ ∈ , . . . , ∇ (cid:107) } . Consider a strip S i , and let Γ i be the portions of the members of R left inside S i . Observe that the right sideof the elements of Γ i are aligned. The elements of Γ i are arranged in order oftheir left-boundary. If an element ρ ∈ Γ i is completely contained in anotherelement ˆ ρ ∈ Γ i , then ˆ ρ is deleted from Γ i . This pruning step of Γ i can be madein a linear scan of the left boundaries of the elements of Γ i in right-to-leftorder, and the pruned set of elements in Γ i forms a staircase. We compute theminimum hitting set O i ⊆ Q a ∩ S i for Γ i as follows: Choose the right-mostpoint of q ∈ Q a ∩ S i that hits ρ k . Remove all the rectangles in Γ i that are hitby q . Repeat the same process with the remaining elements of Γ i . The processstops when Γ i = ∅ . Finally, OP T left = ∪O i is the optimum solution for hittingthe rectangles in R left .The same process is executed with the right-part of the rectangles in R right to compute the optimal solution OP T right of V right . Finally, SOL a = OP T I ∪ OP T (cid:48)I ∪ OP T left ∪ OP T right . The same process is executed to compute the subset
SOL b ⊂ Q b used forhitting the retangles in R b . Thus, SOL λ = SOL a ∪ SOL b . Lemma 8
SOL λ ≤ × OP T λ .Proof As I ⊆ R a , | OP T I | ≤ | OP T λ | . | OP T (cid:48)I | ≤ |
OP T I | + 1. Since, R left ∪ R right = R (cid:48)(cid:48) and R left ∩ R right = ∅ , we have | OP T (cid:48)(cid:48) | ≤ |
OP T λ | , where OP T (cid:48)(cid:48) isthe optimum hitting solution of the rectangles in R (cid:48)(cid:48) . Thus by Proposition 2, | OP T left | + | OP T right | ≤ | OP T (cid:48)(cid:48) | ≤ | OP T λ | , Thus, | SOL a | ≤ | OP T λ | .Similarly, | SOL b | ≤ | OP T λ | , and the result follows.Using Lemmas 7 and 8, we get a solution of size at most 32 OP T + 1. Usingthe same argument as in the proof of Theorem 6 we get:
Theorem 7
Discrete-G-Min-Disc-Code for axis-parallel unit squares in2D has a polynomial-time (32 + (cid:15) ) -factor approximation algorithm, for everyfixed (cid:15) > . Theorem 8
Discrete-G-Min-Disc-Code for axis-parallel unit squares in2D has a polynomial-time (32 + (cid:15) ) -factor approximation algorithm, for everyfixed (cid:15) > . We have seen that
Discrete-G-Min-Disc-Code is NP-complete, even in 1D.This is in contrast to most covering problems and to
Continuous-G-Min-Disc-Code , which are polynomial-time solvable in 1D Gledel and Parreau(2019); Krupa R. et al. (2017). We believe that our simple reduction can beadapted to the graph problem
Min-ID-Code on interval graphs, proved to beNP-complete in Foucaud et al. (2017), but via a much more complex reduction.We also proposed a 2-factor approximation algorithm for the
Discrete-G-Min-Disc-Code problem in 1D, and a PTAS for a special case where eachinterval in the set S is of unit length. It seems challenging to determine whether Discrete-G-Min-Disc-Code in 1D becomes polynomial-time for unit inter-vals. As noted in Gledel and Parreau (2019), this would be related to
Min-ID-Code on unit interval graphs, which also remains unsolved Foucaud et al.(2017). In fact, it also seems to be unknown whether Continuous-G-Min-Disc-Code in 1D remains polynomial-time solvable with this restriction.
References
Ankush Acharyya, Subhas C. Nandy, Supantha Pandit, and Sasanka Roy.Covering segments with unit squares.
Comput. Geom. , 79:1–13, 2019.Kaustav Basu, Sanjana Dey, Subhas C. Nandy, and Arunabha Sen. Sensornetworks for structural health monitoring of critical infrastructures usingidentifying codes. , pages 43–50, 2019.Ralph P. Boland and Jorge Urrutia. Separating collections of points in eu-clidean spaces.
Informormation Processing Letters , 53:177–183, 1995.Nicolas Bousquet, Aur´elie Lagoutte, Zhentao Li, Aline Parreau, and St´ephanThomass´e. Identifying codes in hereditary classes of graphs and vc-dimension.
SIAM J. Discrete Math. , 29:2047–2064, 2015.Emmanuel Charbit, Ir`ene Charon, G´erard D. Cohen, and Olivier Hudry. Dis-criminating codes in bipartite graphs.
Electronic Notes in Discrete Mathe-matics , 26:29–35, 2006.Ir`ene Charon, G´erard D. Cohen, Olivier Hudry, and Antoine Lobstein. Dis-criminating codes in (bipartite) planar graphs.
Eur. J. Comb. , 29:1353–1364,2008.Gruia C˘alinescu, Adrian Dumitrescu, Howard Karloff, and Peng-Jun Wan.Separating points by axis-parallel lines.
Int. J. Comput. Geom. Appl. , 15(06):575–590, 2005. iscriminating Codes in Geometric Setups 29
Mark de Berg, Otfried Cheong, Marc van Kreveld, and Mark Overmars.
Com-putational Geometry: Algorithms and Applications . Springer-Verlag TELOS,USA, 2008. ISBN 3540779736, 9783540779735.Koen M. J. de Bontridder, Bjarni V. Halld´orsson, Magn´us M. Halld´orsson,A. J. Hurkens, Jan Karel Lenstra, R. Ravi, and Leen Stougie. Approximationalgorithms for the test cover problem.
Math. Program. , 98:477–491, 2003.Florent Foucaud. Combinatorial and algorithmic aspects of identifying codes ingraphs. data structures and algorithms, phd thesis.
Universit´e Bordeaux 1,France , 2012. URL http://tel.archives-ouvertes.fr/tel-00766138 .Florent Foucaud, George B. Mertzios, Reza Naserasr, Aline Parreau, and PetruValicov. Identification, location-domination and metric dimension on inter-val and permutation graphs. II. Algorithms and complexity.
Algorithmica ,78:914–944, 2017.M. R. Garey and D. S. Johnson.
Computers and Intractability . W. H. Freeman,first edition edition, 1979. ISBN 0716710455.Valentin Gledel and Aline Parreau. Identification of points using disks.
Dis-crete Math. , 342:256–269, 2019.Sariel Har-Peled and Mitchell Jones. On separating points by lines.
Discreteand Computational Geometry , 63:705–730, 2020.Konstantin Kobylkin. Efficient constant factor approximation algorithms forstabbing line segments with equal disks.
CoRR , abs/1803.08341, 2018.Datta Krupa R., Aniket Basu Roy, Minati De, and Sathish Govindarajan. De-mand hitting and covering of intervals. In
Algorithms and Discrete AppliedMathematics (CALDAM’17) , pages 267–280, Cham, 2017. Springer Inter-national Publishing.Moshe Laifenfeld and Ari Trachtenberg. Identifying codes and covering prob-lems.
IEEE Trans. Information Theory , 54:3929–3950, 2008.Moshe Laifenfeld, Ari Trachtenberg, Reuven Cohen, and David Starobinski.Joint monitoring and routing in wireless sensor networks using robust iden-tifying codes.
Mob. Netw. Appl. , 14:415–432, 2009.Silvio Micali and Vijay V. Vazirani. An O(sqrt( | V | ) | E | ) algorithm for findingmaximum matching in general graphs. In , pages 17–27, 1980.Tobias M¨uller and Jean-S´ebastien Sereni. Identifying and locating-dominatingcodes in (random) geometric networks. Comb. Probab. Comput. , 18(6):925–952, 2009. doi: 10.1017/S0963548309990344. URL https://doi.org/10.1017/S0963548309990344 .Nabil H. Mustafa and Saurabh Ray. Improved results on geometric hitting setproblems.
Discrete and Computational Geometry , 44:883–895, 2010.Subhas C. Nandy, Tetsuo Asano, and Tomohiro Harayama. Shattering a setof objects in 2D.
Discrete Applied Mathematics , 122(1):183–194, 2002.Christos H. Papadimitriou and Kenneth Steiglitz.
Combinatorial Optimiza-tion: Algorithms and Complexity . Prentice-Hall, Inc., Upper Saddle River,NJ, USA, 1982. ISBN 0-13-152462-3.Saikat Ray, David Starobinski, Ari Trachtenberg, and Rachanee Ungrangsi.Robust location detection with sensor networks.
IEEE J. Selected Areas
Communications , 22:1016–1025, 2004.Mikkel Thorup. Undirected single-source shortest paths with positive integerweights in linear time”.
Journal of the ACM , 46(3):362394, 1999.Craig A. Tovey. A simplified NP-complete satisfiability problem.
Discrete Ap-plied Mathematics , 8(1):85–89, 1984. ISSN 0166-218X. doi: https://doi.org/10.1016/0166-218X(84)90081-7. URL .Ren´e van Bevern, Robert Bredereck, Laurent Bulteau, Jiehua Chen, VincentFroese, Rolf Niedermeier, and Gerhard J. Woeginger. Star partitions ofperfect graphs. In