A 1.5 dimensional(1.5D) terrain is an -monotone polygonal chain in specified by vertices , where . The vertices induce edges with = .
A point sees or guards if the line segment lies above or on , or more precisely, does not intersect the open region bounded from above by and from the left and right by the downward vertical rays emanating from and .
There are two types of terrain guarding problems: (1) continuous terrain guarding (CTG) problem, with objective of determining a subset of with minimum cardinality that guards , and (2) discrete terrain guarding problem, with the objective of determining a subset of with minimum cardinality guarding , given that the two point sets and are on .
Many studies have referred to applications of 1.5D terrain guarding in real world [1, 2, 3]. The examples include guarding or covering a road with security cameras or lights and using line-of-sight transmission networks for radio broadcasting.
1.1 Related Work
Ample research has focused on the 1.5D terrain guarding problem, which can be divided into the general terrain guarding problem and the orthogonal terrain guarding problem.
In a 1.5D terrain, King and Krohn  proved that the general terrain guarding problem is NP-hard through planar 3-SAT.
Initial studies on the 1.5D terrain guarding problem discussed the design of a constant-factor approximation algorithm. Ben-Moshe et al.  gave the first constant-factor approximation algorithm for the terrain guarding problem and left the complexity of the problem open. King  gave a simple 4-approximation, which was later determined to actually be a 5-approximation. Recently, Elbassioni et al.  gave a 4-approximation algorithm.
Finally, Gibson et al.  considered the discrete terrain guarding problem by finding the minimal cardinality from candidate points that can see a target point  and proved the presence of a planar graph that appropriately relating the local and global optima; thus, the discrete terrain guarding problem allows a polynomial time approximation scheme (PTAS) based on local search. Friedrichs et al.  revealed that for the continuous 1.5D terrain guarding problem, finite guard and witness sets ( and , respectively) can be constructed such that an optimal guard cover that covers terrain is present and when these guards monitor all points in , the entire terrain is guarded. According to , the continuous 1.5D terrain guarding problem can apply PTAS by constructing a finite guard and witness set with the former PTAS.
Some studies have considered orthogonal terrain . is called an orthogonal terrain if each edge is either horizontal or vertical. An orthogonal terrain has four vertex types. If is a vertex of orthogonal terrain and the angle , then is a convex vertex, otherwise it is a reflex vertex. A convex vertex is left(right) convex if () is vertical. A reflex vertex is left(right) reflex if () is horizontal.
Katz and Roisman  gave a 2-approximation algorithm for the problem of guarding the vertices of an orthogonal terrain. The authors constructed a chordal graph demonstrating the relationship of visibility between vertices. On the basis of ,  gave a 2-approximation algorithm and used the minimum clique cover of a chordal graph to solve the right(left) convex vertex guarding problem.
Lyu and Üngör  gave a 2-approximation algorithm for the orthogonal terrain guarding problem that runs in , where is the output size. The authors also gave an optimal algorithm for the subproblem of the orthogonal terrain guarding problem. On the basis of the vertex type of the orthogonal terrain, the objective of the subproblem is to determine a minimum cardinality subset of guarding all right(left) convex vertices of ; furthermore, the optimal algorithm uses stack operations to reduce time complexity.
The time 2-approximation algorithm has previously been considered the optimal algorithm for the orthogonal terrain guarding problem. However, some studies have used alternatives to the approximation algorithm.
Durocher et al.  gave a linear-time algorithm for guarding the vertices of an orthogonal terrain under a directed visibility model, where a directed visibility mode considers the different visibility for types of vertex. If is a reflex vertex, then sees a vertex of , if and only if every point in the interior of the line segment lies strictly above . If is a convex vertex, then sees a vertex of , if and only if is a nonhorizontal line segment that lies on or above . Khodakarami et al.  considered the guard with guard range. They presented a fixed-parameter algorithm that found the minimum guarding set in time , where is the terrain guard range.
1.2 Result and Problem Definition
In this paper, we define the CTG problem with two-sided guards and propose an optimal algorithm for the 1.5D CTG problem with two-sided guards. To the best of our knowledge, the 1.5D CTG problem with two-sided guards has never been examined.
Definition 1 (Two-Sided Guarding). A point on a 1.5D terrain is two-sided guarded if there exist two distinct guards , which is on or to the left of , and , which is on or to the right of , such that can be seen by both and . Furthermore, the guards and are called a left guard and a right guard of .
Fig. 1 illustrates an example where vertex left guards and right guards . In this paper, we define the following problem:
Definition 2(CTGTG: Continuous Terrain Guarding with Two-Sided Guards) Given a 1.5D terrain , find a vertex guard set of minimum cardinality such that every point of can be two-sided guarded.
1.3 Paper Organization
Section 2 presents preliminaries, Section 3 demonstrates how to create a finite point set for the CTGTG model, Section 4 gives an algorithm for the CTGTG, along with its proof, and Section 5 presents our conclusions.
Let and be two points on a 1.5D terrain, we write if is on the left of . We denote the visible region of by and sees . For a , let be the leftmost vertex in and be the rightmost vertex in .
Given a CTGTG instance, let be an optimal guard set, where for . For a point on the terrain, let and be the subsets of such that is right guarded by every guard in and left guarded by every guard in . We also define as the rightmost point on the terrain that is not right guarded by and as the leftmost point on the terrain that is not left guarded by .
An important visible property on 1.5D terrains is as follows:
[] Let , , and be four points on a terrain such that . If sees and sees , then sees .
Fig. 2 is a schematic of Lemma 1. Because is an -monotone chain, we use a straight line to demonstrate the relation between -coordinate of points and an arc to show the visible relation among points on . In this report, we use a straight line to simplify the explanations.
Assume point is on . If is left guarded by then is also left guarded by .
Assume point is on . If is right guarded by then is also right guarded by .
Although are right guarded and left guarded, is not necessarily right guarded and left guarded. In Fig. 3, is right guarded and left guarded by with minimal cardinality. The vertices and are left guarded by and right guarded by . Vertices and are left guarded by and right guarded by . Vertex is left guarded and right guarded by and , respectively. Only can right guard and left guard where is on and is on , but . In our example, we must create a point set such that if is right guarded and left guarded, then is also.
Definition 3 (Boundary Point). If line and have an intersection point , and and can see then is the boundary point.
In Fig. 4, we provide an example with four boundary points: and . Boundary point is from , is from ; and boundary points and are from . We say has two boundary points, and ; each of and has a boundary point.
For an edge on terrain , there exists at most two points and that exclude and such that is complete two sided guarded if and are two sided guarded.
According to the number of boundary points on , we may consider the proof under the following heads: edge does not have boundary point or has one, two, or boundary points (where 3).
In the first case, we assume does not have boundary point. Let point be on edge . If is right guarded and left guarded, then edge is also right guarded and left guarded.
In the second case, we assume has a boundary point . We divided the edge into two line segments and . Then, the first case can be applied to the line segments and . Therefore, we create two points on line segment and on line segment . If and are right guarded and left guarded, then is also right guarded and left guarded.
In the third case, we assume has two boundary points and . We divided the edge into three line segments , and . The line segments and can be reduced to the first case. Therefore, we create two points on line segment and on line segment . If and are left guarded and right guarded, then line segment is also left guarded and right guarded.
In the final case, we assume has boundary points . We divide the edge into line segments . The line segments and can be reduced to the first case. Therefore, we create two points: on line segment and on line segment . If and are left guarded and right guarded, then each line segment is also left and right guarded.
From the construction of Lemma 3, in order to completely two-sided guard a terrain, it is sufficient to first select a finite subset of positions from the terrain to be two-sided guarded, such that .
4 4. Optimal Algorithm for the CTGTG
In this section, we present an optimal algorithm for the CTGTG. The idea of the algorithm follows from Observation 4. In each step of our algorithm, we add a vertex to our result such that if then can replace a vertex and .
The optimal solution of the CTGTG includes and .
This is because in the CTGTG for right and left guarded , only can left guard and only can right guard .
and do not lie on the right side of .
Assume () is on the right side of and is on the edge (). We know that is right guarded by and is on the right side of . According to Lemma 2, if right guards , then is right guarded by . This contradicts the definition of and sees . The schematic of Lemma 4 is given in Fig 5.
and do not lie the left side of .
If and , then cannot left guard .
We prove Lemma 4 in two steps. The first step explains that if left guards , then and can see each other. The second step explains that if and can see each other, and left guards , then is right guarded by . First, let . Because sees , according to Lemma 2 if and see each other, then and also see each other. This is illustrated in Fig. 6.
In the second step, we assume that is right guarded by and that is on the edge on the right side of . We know that if left guards , then and see each other. Because right guards and sees , if sees then right guard too, as illustrated in Fig. 7.
If and , then cannot right guard .
If , is right guarded by and , then cannot lie between and .
We assume is on the and is right guarded by . We know that right guards by Observation 2. According to Lemma 2, if is right guarded by then is right guarded by . Therefore, we know that if , then cannot lie between and .
If , is left guarded by and and , then cannot lie between and .
If , then can replace .
Because our approach has two phases, we must first discuss the complexity of discretization. We obtain boundary points for a vertex on in by . Therefore, we compute all boundary points for each vertex of on each edge in . We obtain at most 2 boundary points in .
Next, we demonstrate how to compute an optimal solution for the CTGTG. In step 1, we add and to our solution. In step 2, we compute the and . In step 3, we add to our solution, where is the nonright-guarded rightmost point. If a point exists that is not right guarded, then repeat step 3 until is right guarded. In step 4, we add to our solution, where is the non-left guarded leftmost point. If a point exists that is not left guarded, then repeat step 4 until is right guarded. Finally, all points are right guarded and left guarded.
We show our algorithm for the CTG problem runs in using two steps. Before the algorithm begins, we can compute and for each point of in . After this computation, we proceed to the algorithm in . Therefore, our proposed algorithm for the CTG problem runs in .
If cannot see and sees then . Assume , cannot see and can see . If sees and cannot see , then a vertex exists and lie above line and , as illustrated in Fig. 8. However, the assumption that is contradictory.
We propose Algorithm 1 to compute for all points of in according to Lemma 5 and Lemma 2. We unite and in a set . Algorithm 1 finds from left to right. We prove that the running time of Algorithm 1 is .
Algorithm 1 runs in O. We count the number of times sees in the algorithm. If sees , then the algorithm does not visit the vetrices between and . Therefore, the number of times sees is at most once for each point of . If does not see , then has found . Therefore, the number of times does not see is at most once for each point .
After computing and for , we reach the algorithm for the CTGTG in . We divided our algorithm into left and right-guarding, and therefore we provide the algorithm for left-guarding that can be implemented in .
Algorithm 2 runs in . For each , we examine whether is guarded by from to . If = = , then Algorithm 2 will not visit the point and vertex between and . We count the number of times is not seen by . We can check from to . If does not see , then we will not check for . Assume does not see , sees , and , if is seen by , then sees according to Lemma 2. The number of times is not seen by is , and the number of times is seen by is . Therefore, the algorithm visits the point and vertex at most times. After computing all , Algorithm 2 runs in .
In this paper, we considered the CTGTG problem and devised an algorithm that can determine the minimal cardinality vertex that guards under two-sided guarding. We showed that the CTGTG problem can be reduced to the discrete terrain guarding problem with at most points in and solved the problem using our devised algorithm in where is the number of vertices on .
-  P. Ashok, F. V. Fomin, K. Sudeshna, S. Saurabh, M. Zehavi, Exact algorithms for terrain guarding, in: 33rd International Symposium on Computational Geometry, 2017.
-  H. Eliş, A finite dominating set of cardinality and a witness set of cardinality for 1.5d terrain guarding problem, Annals of Operations Research (2017) 1–10.
-  F. Khodakarami, F. Didehvar, A. Mohades, A fixed-parameter algorithm for guarding terrains, Theoretical Computer Science 595 (2015) 134–142.
-  J. King, E. Krohn, Terrain guarding is np-hard, SIAM Journal on Computing 40 (5) (2011) 1316–1339.
-  B. Ben-Moshe, M. J. Katz, J. S. Mitchell, A constant-factor approximation algorithm for optimal 1.5 d terrain guarding, SIAM Journal on Computing 36 (6) (2007) 1631–1647.
-  J. King, A 4-approximation algorithm for guarding 1.5-dimensional terrains, in: Latin American Symposium on Theoretical Informatics, Springer, 2006, pp. 629–640.
-  K. Elbassioni, E. Krohn, D. Matijević, J. Mestre, D. Ševerdija, Improved approximations for guarding 1.5-dimensional terrains, Algorithmica 60 (2) (2011) 451–463.
M. Gibson, G. Kanade, E. Krohn, K. Varadarajan, An approximation scheme for terrain guarding, in: Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, Springer, 2009, pp. 140–148.
-  S. Friedrichs, M. Hemmer, C. Schmidt, A ptas for the continuous 1.5d terrain guarding problem, in: Canadian Conference on Computational Geometry, 2014.
-  M. J. Katz, G. S. Roisman, On guarding the vertices of rectilinear domains, Computational Geometry 39 (3) (2008) 219–228.
-  F. Gavril, Algorithms for minimum coloring, maximum clique, minimum covering by cliques, and maximum independent set of a chordal graph, SIAM Journal on Computing 1 (2) (1972) 180–187.
-  Y. Lyu, A. Üngör, A fast 2-approximation algorithm for guarding orthogonal terrains, in: Canadian Conference on Computational Geometry, 2016.
-  S. Durocher, P. C. Li, S. Mehrabi, Guarding orthogonal terrains., in: Canadian Conference on Computational Geometry, 2015.
-  F. Khodakarami, F. Didehvar, A. Mohades, 1.5d terrain guarding problem parameterized by guard range, Theoretical Computer Science 661 (2017) 65–69.
-  M. Löffler, M. Saumell, R. I. Silveira, A faster algorithm to compute the visibility map of a 1.5d terrain, in: Proc. 30th European Workshop on Computational Geometry, 2014.