Locating a single facility and a high-speed line
In this paper we study a facility location problem in the plane in which a single point (facility) and a rapid transit line (highway) are simultaneously located in order to minimize the total travel time from the clients to the facility, using the or Manhattan metric. The rapid transit line is given by a segment with any length and orientation, and is an alternative transportation line that can be used by the clients to reduce their travel time to the facility. We study the variant of the problem in which clients can enter and exit the highway at any point. We provide an -time algorithm that solves this variant, where is the number of clients. We also present a detailed characterization of the solutions, which depends on the speed given in the highway.
Suppose we are given a set of clients represented as a set of points in the plane, and a service facility represented as a point to which all clients have to move. Every client can reach the facility directly, or use an alternative rapid transit line called highway in order to reduce the travel time. The highway is a straight line segment of arbitrary orientation. If a client moves directly to the facility, it moves at unit speed and the distance traveled is the Manhattan or distance to the facility. In the case where a client uses the highway, it travels the distance at unit speed to one point of the highway, traverses with a speed the Euclidean distance to other highway point, and finally travels the distance from that point to the facility at unit speed. All clients traverse the highway at the same speed. The highway is used by a client point whenever it saves time to reach the facility. Given the set of points representing the clients, the facility location problem consists in determining at the same time the facility point and the highway in order to minimize the total weighted travel time from the clients to the facility. The weighted travel time of a client is its travel time multiplied by a weight representing the intensity of its demand.
Recent papers have dealt with geometric problems considering travelling distances as a combination of planar and network distances. Carrizosa and Rodríguez-Chía  introduced the -facility min-sum location problem on the plane with a metric induced by a gauge and a finite set of rapid transit lines giving the network distance. This problem was further developed by Gugat and Pfeiffer , and Pfeiffer and Klamroth . Brimberg et al. [7, 8] studied the location of a new single facility considering given regions of distinct distance measures. All these papers consider the well-known Weber problem under a new metric. Other papers can be found in the context of the combination of the distance with the network distance. Abellanas et al.  introduced the time metric model: Given an underlying metric, the user can travel at speed when moving along a highway or unit speed elsewhere. The particular case in which the underlying metric is the metric and all highways are axis-parallel segments of the same speed, is called the city metric . In the scenario of setting up an optimal distance network that minimizes the maximum travel time among a set of points, several problems have been recently investigated in detail [3, 5, 9]. Other similar and more general models were studied by Korman and Tokuyama . See  and  for surveys on highway location and extensive facility location problems, respectively.
A similar problem consisting in simultaneously locating a service facility point and a high-speed line (i.e. highway) of fixed length was recently studied by Espejo and Rodríguez-Chía  and Díaz-Báñez et al. . The authors considered that highway is a turnpike , that is, clients can enter and exit the highway only at the endpoints. A first solution was introduced by Espejo and Rodríguez-Chía, and after that an improved solution was given by Díaz-Báñez et al. The problem aims to minimize the total weighted travel time from the demand points to the facility service, and can be solved in time , where is the number of clients. Díaz-Báñez et al.  continued the study of this variant by considering the min-max optimization criterion. They minimize the maximum time distance from the clients to the facility point.
In this paper we study a related problem in which the length of the highway is variable, that is, it is not fixed in advance as part of the input of the problem, and clients can enter and exit the highway at any point. Due to the latter condition, highway is called freeway . Since both entering and leaving the highway are allowed at all its points, then the structure (i.e. highway) is continuously integrated in the plane. We minimize the total weighted transportation time from the demand points to the facility. The problem of locating a min-max freeway of fixed length was solved by Díaz-Báñez et al.  in time.
The following notation is introduced in order to formulate the problem. Let be the set of demand points, be the service facility point, be the highway, and be the speed in which demand points move along . Given a demand point , denotes the weight of . The travel time between a demand point and the service facility , denoted by , is equal to:
The problem can be formulated as follows:
The Freeway and Facility Location problem (FFL-problem) Given a set of demand points, the weight of each point of , and fixed speed , locate the facility point and the highway in order to minimize the next function:
We first show that there exist optimal solutions of the FFL-problem in which the highway has infinite length and the facility point is located on . We then consider only optimal solutions satisfying these properties. We second show that for all demand points the shortest path from to the facility point has one of three possible shapes: (a) moves directly to , (b) first moves vertically to reach and after that moves along to reach , and (c) first moves horizontally to reach and after that moves along to reach . For each demand point, the shape of its shortest time path to depends on both the speed in which demand points moves along and the slope of . This discretization on the shortest path shapes allows us to simplify the expression of and then to obtain a clear expression of the objective function . Using geometric obervations, we reduce the search space of the optimal solutions. This is done by considering the grid defined by all axis-parallel lines passing through the demand points. We prove the existence of optimal solutions that satisfy one of the following two properties: (1) passes through a demand point and belongs to a line of grid , and (2) is a vertex of . The discretization of the search space permits us to obtain the main result of this paper, a general -time algorithm to solve the FFL-problem. Our algorithm divides the search into two cases that correspond to the above two properties. As a surprising result, we prove that when speed is greater than the algorithm can avoid the search of optimal solutions satisfying property (2) because in that case there always exists an optimal solution which holds property (1). This result simplifies the algorithm when speed exceeds that bound. We finally present three examples, two of them showing that when speed is increased and we keep the same configuration of demand points the shapes of the shortest time paths can change. A third example shows that when speed is less than , there exist configurations in which the optimal solution satisfies property (2).
The discretization on the shapes of the shortest paths from the demand points to the facility is stated in Section 2. In Section 3 we show how the search space of optimal solutions can be reduced. In Section 4 the algorithm to solve the FFL-problem is presented and in Section 5 we give the refinement of it. In Section 6, the examples are presented. Finally, in Section 7, we present the conclusions and further research.
2 Discretization of the shortest paths
Any solution to our problem will be encoded by a pair of elements , where is the facility point and is the highway. Given and , we say that a demand point does not use (or goes directly to ) if is equal to . Otherwise we say that uses . Given any point of the plane, let and denote the and coordinates of , respectively.
Let and be demand points using the highway such that they move in contrary directions along . Let segments denote the portions of traversed by and , respectively. Segments and have disjoint interiors.
There exists an optimal solution of the FFL-problem in which the facility point is located on the highway.
Let denote an optimal solution of the FFL-problem and suppose that does not belong to . Let be a translation of such that belongs to . We select so that to satisfy a condition that will be stated later. Let be a demand point. If does not use then:
Otherwise, if uses , let be points such that
Let be the point , which belongs to the line containing . Observe from Claim 2.1 that we can select so that point belongs to for every demand point using . Then, by using the triangular inequality with the metric, we obtain:
Results similar to Propostion 2.2, stating that the facility point belongs to the corresponding highway, can be found in [11, 14]. Observe from equations (2) and (7) that there always exists an optimal solution to the FFL-problem in which the length of is infinite. We then assume from this point forward that every solution satisfies that the highway is a straight line and the facility point belongs to the highway. Observe that this assumption does not have negative consequences, due to the fact that in practice a highway of infinite length is not possible. In fact, if a solution to the problem is such that is a straight line, then is also an optimal solution, where is the segment of minimum length such that every demand point both enter and exit on a point of .
Let always denote the non-negative angle of the highway with respect to the positive direction of the -axis. Unless otherwise specified, we assume . Observe that if we can, by properties of and metrics, modify the coordinate system so that angle satisfies .
Given highway and a demand point , let be the intersection point between and the vertical line passing through . Similarly, let be the intersection point between and the horizontal line passing through . Let denote the half-line contained in that emanates from and does not contain , and denote the half-line contained in that emanates from and does not contain . Notice from the assumption that given and a demand point , is the nearest point to on under the metric.
The next lemma characterizes the way in which demand points move optimally to the facility. Let . Since we have .
Given the highway and the facility point located on , the following holds for all demand points . If then moves first to and after that moves to using . Otherwise, if , the next statements are true:
If then moves first to and after that moves to using .
If then moves first to and after that moves to using .
If then moves directly to without using .
Let be a demand point and assume w.l.o.g. that is below . Consider the function for all . Notice that is convex because it is a sum of two convex functions. Then any local minimum of is a global minimum. Let .
Suppose . Given small enough, let and be the points such that . Refer to Fig. 1.
Then we have the following:
Suppose now . Then we have three cases:
Case 1: . On one hand we have for all points . On the other hand, if is small enough and is the point such that , then . Therefore, and statement (a) follows.
Case 2: . Let be a small enough value. On one hand, if is the point such that , then . On the other hand, if is the point such that , then
Therefore, and statement (b) follows.
Case 3: . If then is one of the nearest points to on by considering the metric. Thus . Otherwise, if , we proceed as follows. On one hand we have for all points to the left of . On the other hand, if is small enough and is the nearest point to satisfying , then . Therefore, and statement (c) follows.
Because of Lemma 2.3, the travel time between a demand point and facility simplifies to:
Given a solution to the FFL-problem, we can always partition the set of demand points into there sets , , and as follows. Set contains the points such that and and the points such that and . Set contains the points such that and is either on or below , and the points such that and is either on or above . Set is equal to . It is straightforward to obtain what follows (refer to Fig. 3).
If then is equal to:
and the objective function equals:
Otherwise, if , then is equal to:
3 Reducing the search space
Let be the grid defined by the set of all axis-parallel lines passing through the elements of .
There always exists an optimal solution to the FFL-problem satisfying one of the next statements: contains a point of and is on a line of grid , and is a vertex of grid . Refer to Fig. 4.
Let be an optimal solution of the FFL-problem satisfying neither condition (a) nor condition (b). Using local linear perturbations, we will transform into other optimal solution that satisfies at least one of these conditions.
Assume first the case where . Let (resp. ) be the smallest value such that if we translate both and with vector (resp. ) then belongs to a vertical line of or contains a point of . Given , let and be and translated with vector , respectively. Using Lemma 2.3, we partition into four sets , , , and as follows. Set (resp. ) contains the demand points doing a rightwards (resp. leftwards) movement to reach . Set (resp. ) contains the demand points doing only a downwards (resp. upwards) movement to reach . Observe that:
where . Let denote , . Thus, for any , the variation of objective function when we translate both and with vector is the following:
Since is optimal we must have for all . It implies and for all . Therefore, by translating both and with vector either or , we ensure that is on a vertical line of or passes through a point of , or both conditions. If it holds only that is on a vertical line of , then we repeat the same operation in the vertical direction in order to ensure that is on a horizontal line of or passes through a point of , and condition (a) or condition (b) holds. Otherwise, if it holds only that passes through a point of , then it is straightforward to prove, by using similar arguments, that can be translated along in order to ensure that belongs to a line of , that is either vertical or horizontal, and condition (a) holds. In fact, for some demand point of , will coincide with the point in which enters , that is, or .
In the case where every demand point moves vertically to (Lemma 2.3), and we can proceed as follows by using arguments similar to the above ones. We first translate vertically both and with the same vector in order to ensure that contains a point of . After that, is translated along if necessary in order to belongs to a vertical line of and condition (a) holds. The lemma thus follows.
If then there is an optimal solution satisfying Lemma 3.1 .
4 The algorithm to solve the FFL-problem
The FFL-problem can be solved in time.
In order to solve the first case we find for each demand point and each line of an optimal angle such that is minimized, where is the line passing through whose angle with respect to the positive direction of the -axis is equal to , and is the intersection point between and . Assume w.l.o.g. that is vertical and is located to the left of . It is easy to observe from equations (8) and (9) that for any the expression of has the form , where are constants. Furthermore, if we progressively increase the value of from to , that expression changes whenever sets , , and change, that is, when crosses a demand point, crosses a horizontal line of , or . Then consider the sequence of angles, where each angle is such that either contains a demand point, belongs to a horizontal line of grid , or . Notice then that the expression of is the same for all . If we preprocess the demand points by constructing the dual arrangement of , such a sequence can be obtained in time by using both the Zone Theorem  and the order of the demand points with respect to the -coordinate. Observe that if for a value of we know the expression of in the interval , then can be minimized in constant time in that interval. Furthermore, if contains a demand point or belongs to a horizontal line of , then the expression of in the interval can be obtained in constant time from the expression of in the interval . It is easy to see now that , , can be minimized in time by minimizing in for . Since there are demand points and has lines, then an overall -time algorithm is obtained.
We can proceed similarly in order to solve the second case. We find an optimal solution for each vertex of the grid as follows. Let be a vertex of . Given an angle , let be the line passing through , whose angle with respect to the positive direction of the -axis is equal to . Then, by Corollary 3.2, we look for an angle such that the objective function is minimized. It follows from equation (9) that the expression of has the form for any , where are constants. If we progressively increase from to the expression of keeps unchanged as long as does not cross a demand point. The sorted sequence of values of in which it happens can be obtained in linear time by using duality . That sequence of values induces a partition of the interval into intervals where in each of them the expression of is constant. We can now continue as was done above to solve the first case. Since has vertices then an overall -time algorithm is thus obtained. The result thus follows.
5 A refinement of the algorithm
Theorem 4.1 shows an algorithm that solves the FFL-problem by dividing the search of optimal solutions into two steps. It first looks in time for an optimal solution that satisfies Lemma 3.1 (a), and after that looks within the same time complexity for an optimal solution satisfying Lemma 3.1 (b). In the following we show that for “reasonable” values of speed we can simplify the algorithm of Theorem 4.1 by finding only optimal solutions that hold Lemma 3.1 (a). We will use the next technical lemma.
Let , , , and be non-negative constants and be a function so that
for all . Then next statements are true:
If and then is constant.
If and then is monotone decreasing.
If and then is monotone increasing.
If and then has no minima.
Statement (a) is immediate. Let be the first derivative of and observe that:
If and then , , and equation has no solution in because . Therefore, is a monotone decreasing function and statement (b) thus holds.
If and then , , and equation has no solution in because . Therefore, is a monotone increasing function and statement (c) thus holds.
Consider and . Since it suffices to prove that equation has only one solution which must be a global maximum of . Equation is equivalent to equation
We will prove that equation has no solution in , which implies that equation has a unique solution in because . This will complete the proof.
It is straightforward to see that equation is equivalent to equation , where is equal to:
Consider the function so that
for all . Since and for all , we have for all . We now show that the minimum of in is greater than zero, implying equation has no solution.
If then there is no such that because is positive for all . Suppose . Then we have:
and thus there is no such that . Therefore, if and only if , that is, . Let us prove that .
The roots of polynomial are respectively equal to and . Then we conclude that because the main coefficient of is positive, is the greatest root of , and . Since and at the unique extreme point , then for all . Therefore, for all , equation has no solution in , and then has only one extreme point in which is a global maximum. The lemma follows.
If speed is greater than , then there always exists an optimal solution to the FFL-problem satisfying Lemma 3.1 , that is, contains a point of and is on a line of grid .
It suffices to show that for every solution , there exists another solution satisfying Lemma 3.1 (a) and . The proof is as follows.
Let be a solution of the FFL-problem so that contains no demand point. Assume here angle satisfies . If is such that , then the result follows from Corollary 3.2. Therefore, assume . We proceed to prove that there exists another solution such that contains a demand point and . Consider the sets and as defined before.
Given an angle , let be the line passing through so that the angle between and the positive direction of the -axis is equal to . Observe then by equation (9) that is equal to: