The Constrained 2-Maxian Problem on Cycles

: This paper deals with p -maxian problem on cycles with an upper bound on the distances of all facilities. We consider the case of p = 2 and show that, in the worst case, the optimal solution contains at least one vertex of the underlying cycle, which helps to develop an efficient algorithm to solve the constrained 2-maxian problem. Based on this property, we develop a linear time algorithm for the constrained 2-maxian problem on a cycle. We also discuss the relations between the constrained and unconstrained 2-maxian problems on which the underlying graphs are cycles.


Introduction
Facility location theory deals with the problems of planning new optimal facilities in a network of existing customers, playing an important role in operation research due to its theoretical and practical contributions.The median and center location problems are the two most important models in classical facility location theory.The aim of a median problem is to find one or several facilities to minimize the total weighted distance from customers to the facilities.Furthermore, the goal of the center problem is to locate new facilities such that the maximum weighted distance from customers to the facilities is minimized.
Since the median and center problems on general graphs are NP-hard, there is significant interest in cases where such a problem can be solved in polynomial time.Goldman [1] showed that the 1-median problem on trees can be solved in linear time.For the 2-median problem on trees, Gavish and Sridhar presented [2] an O(n log n) time algorithm.Tamir [3] studied the p-median problem on trees and showed that the problem can be solved in O(pn 2 ) time.Burkard and Krarup [4] designed a linear time algorithm for the pos/negweighted 1-median problem on a cactus, and showed that the 2-median problem on cactus graphs can be solved in O(n 2 ) time.For the model of center problems, Handler [5] presented a linear time algorithm for the 1-center problem on trees.For the p-center problem on trees, Wang and Zhang [6] presented an O(n log n) time algorithm.Lan [7] showed that the 1-center problem on a cactus graph can be solved in linear time.For the weighted 2center problem on cactus graphs, Moshe et al. [8] devised an O(nlog n 3 ) time algorithm for the continuous version and showed that the discrete version is solvable in O(nlog n 2 ) time.
In recent years, the obnoxious facility location problem has been studied extensively, where some facilities are to be placed as far away as possible from the customers.These models are applied when locating undesirable facilities, for example, garbage dumps, airports, and chemical plants, to mention a few.For a survey of obnoxious location problems, we refer to Krarup et al. [9] and Tamir [10].If the aim is to maximize the total maximum weighted distances from all customers to p new facilities, the corresponding problem is the so-called p-maxian problem.The p-maxian problem was first considered by Burkard et al. [11], who showed that the problem could be solved in linear time.Kang and Cheng [12] presented a linear time algorithm for the p-maxian problem on block graphs, where each block graph is a super class of tree graphs.Furthermore, the p-maxian problem on interval graphs was solved in linear time by Cheng and Kang [13].For the 2-maxian problem on cactus graphs, Kang et al. [14] devised a quadratic time algorithm, where any two cycles in the graph have at most one vertex in common.
In real-life situations, the maximum distances between new facilities are often limited within a given bound.For instance, surveillance cameras of a residential district must be located in such a way that they are close enough for full coverage and nucleic acid collecting sites are located close enough for convenience.Considering such a limitation, the aim of the p-maxian problem is to locate p facilities such that they are close enough for inter-connection or cooperation.Nguyen et al. [15] were the first to consider the p-maxian problem with a distance constraint, and they showed that the 2-maxian problem on trees is solvable in linear time.Motivated by this paper, we consider the p-maxian problem on cycles with bounds on the maximum distances between facilities.We organize the paper in the following sections.Section 2 defines the p-maxian problem with distance constraints and gives the important properties of the 2-maxian problem as well.In Section 3, we develop a linear time algorithm for the constrained 2-maxian problem on cycles.Section 4 presents a brief conclusion to this paper.

Problem Definition and Properties
) is an edge of C, i = 1, 2, . . ., n, where all vertices are numbered in a clockwise way.Each vertex v i ∈ V has a non-negative weight w i and each edge e ∈ E has a non-negative length ℓ(e).The length of C is denoted by ℓ(C) := ∑ e∈E ℓ(e).A point x on C may either be a vertex or may lie on an edge of C; the set of all points of C is denoted by X(C).For any two points x, y of X(C), the length of the shortest path from x to y is denoted by d(x, y), and d c (x, y) denotes the length of the path from x to y in a clockwise direction.It is easy to see that d(x, y) = d c (x, y) or d(x, y) + d c (x, y) = ℓ(C) holds for any two points x, y of X(C).
In a p-maxian problem on the cycle graph C, the aim is to find p points of X(C), say X := {x 1 , x 2 , . . ., x p }, such that the following objective function is maximized: where the point set X ⊆ X(C) that maximizes (1) is called the p-maxian of C.
In this paper, we assume that the maximum distance between facilities does not exceed a given bound U ≤ ℓ(C) 2 .Then, the p-maxian problem on C with a distance constraint of U (constrained p-maxian problem) can be formulated as the following optimization model: where the set X ⊆ X(C) that fulfills (2) and ( 3) is called the constrained p-maxian of C.
For the case of p = 2, the corresponding constrained 2-maxian problem on a cycle C is to find two points {x 1 , x 2 } ⊆ X(C), which maximizes the following equation: For an unconstrained 2-maxian problem on a modified cycle, the so-called vertex optimality property asserts that the problem has an optimal solution at the vertices [14].However, this property does not apply in our problem.For example, for the graph in Figure 1, we find 2 , and {m 1 , m 2 } is the unique solution to the constrained 2-maxian problem.In the following, we will give an important result for the constrained 2-maxian problem on a cycle C, which characterizes the point x ∈ X(C) that may appear in an optimal solution of the problem.
ume that the maximum distance between facilities do not exceed a given , the p-maxian problem on C with distance constraint of U (constrained be formulated as following optimization model: ls ( 2) and ( 3) is called a constrained p-maxian of the cycle C.
he corresponding constrained 2-maxian problem on a cycle C is to find which maximizes Theorem 1.There exists an optimal solution X * = {x 1 , x 2 } of the constrained 2-maxian problem on C, such that one of the following statements holds for x 1 and x 2 : 1. x 1 ∈ V and x 2 ∈ V.
2. x 1 ∈ V and x 2 lies on the interior of an edge with the property of d(x 1 , x 2 ) = U .
Proof.Let X * = {x 1 , x 2 } be an optimal solution of the constrained 2-maxian problem on C. Suppose that X * is contradicting both statements 1 and 2. Obviously, there exists at least one interior point of some edge.Assume that x 1 is not a vertex and lies on the edge (v r , v r+1 ), and that x 2 lies on the edge (v s , v s+1 ) or coincides with s.Moreover, we assume that r < s and d(x 1 , x 2 ) = d c (x 1 , x 2 ) ≤ U .For the point x 1 , we define the following sets: 2 and V 2 2 similarly.Note that all facilities of V 1 and V 2 are served by x 1 and x 2 , respectively, which is denoted by Note that if V 3 is nonempty, then all vertices of V 3 could be served by x 1 as well as by x 2 .Without a loss of generality, we assume that For the edge e r = (v r , v r+1 ), we consider a function f : [0, ℓ(e r )] → R depending on t, where t = 0 corresponds to vertex v r and t = ℓ(e r ) corresponds to vertex v r+1 .Moreover, the interior point x on the edge (v r , v r+1 ) with d(v r , x) corresponds to t = d(v r , x) and x is written as v r + t.Then, the function f is defined by the following: with the following slope: Supposing that slope ( 4) is non-negative, we then move x 1 towards vertex v r+1 and move x 2 towards vertex v s+1 until x 1 coincides with v r+1 by δ = min{d(x 1 , v r+1 ), d(x 2 , v s+1 )} (and x 2 ) towards v r+1 (and v s+1 ) by δ = min{d(x 1 , v r+1 ), d(x 2 , v s+1 )}.Thus, we obtain X = {v r+1 , x 2 + δ} or X = {v r + δ, v s+1 } and the following inequality: which implies that there exists an optimal solution with at least one vertex.Without a loss of generality, we assume that X * = {x 1 , x 2 } is a constrained 2-maxian with x 1 as a vertex r.
Suppose that x 2 is a interior point of the edge (v s , v s+1 ) and of d c (x 1 , x 2 ) = U ′ < U .For the edge e s = (v s , v s+1 ), we define a function g : [0, ℓ(e s )] → R depending on t ′ , similar to the definition of the function f .Let the function g be given by the following: and respectively.If the value w i ≤ 0, we move x 2 toward the vertex s until x 2 coincides with v s .Then, we set X := {x 1 = v r , x 2 = v s } and the following equation can be concluded, where X fulfills the statement 1.Otherwise, if the value w i > 0, we move x 2 towards the vertex v s+1 .Note that x 2 may either coincide with v s+1 or may be an interior point x ′ 2 , which lies on (v s , v s+1 ) with d c (x 1 = v r , x ′ 2 ) = U .Either case fulfills statement 1 or statement 2. This completes the proof.

By Theorem 1, we define by ex(v
2 .Then, we add all points ex(v i ) and op(v i ) with a weight of zero to C and update the edges that are incident to those new vertices to create a modi f ied cycle.It is easy to see that there are O(n) vertices in the modified cycle.Moreover, if U ≥ ℓ(C) 2 , the upper bound U has no constraint on the facilities of the constrained 2-maxian problem; i.e., the constrained 2-maxian problem is equivalent to the corresponding unconstrained problem and, thus, can be solved in linear time [16].

A Linear Time Algorithm
Based on previous results, we develop a combinatorial algorithm that solves the constrained 2-maxian problem on a modified cycle C = (V, E).Let X(C) be the set of all points on the cycle C.In order to keep the notation simple, the cycle C is parameterized; i.e., the point x ∈ X(C) that lies on the edge (v i , v i+1 ) for some i = 1, 2, . . ., n is identified with the real number t, which is given by t = ∑ i−1 k=1 ℓ(e k ) + d(v i , x).For any two points a, b ∈ X(C), denoted by X(a, b), the set of all points is traversed by moving from a towards b in a clockwise direction.Let (V 1 , V 2 ) be an ordered 2-partition of V, such that V 1 and V 2 are disjoint and V = V 1 ∪ V 2 , and let V be the set of all ordered 2-partitions of V.It is easy to see that, for any 2-partition (V 1 , V 2 ) ∈ V and for any points X = {x 1 , x 2 }, we have the following: and thus the following Using the observation above, the constrained 2-maxian problem on a cycle can be formulated in the following way: where V x and V y are the vertex sets that are served by x and y, respectively.
Suppose that (x * , y * ) is the optimal solution to the constrained 2-maxian problem; then, the sets V x * and V y * can be constructed as follows: Note that the sets V x * and V y * have the properties of ) is an optimal assignment of the vertices to x * and y * .Then, we define the set of all subsets of n 2 vertices that induce a path as follows: and Using the function f , the problem reduces to max Equation ( 8) implies the following algorithmic approach.We solve the problem max x∈W c f W (x) and max y∈W f W c (y) for all W ∈ W independently to obtain the optimal solution (x * , y * ).If d(x * , y * ) ≤ U , then (x * , y * ) is the optimal solution to the constrained 2-maxian problem; otherwise, we consider (x * , ex(x * )) and (y * , ex(y * )), and obtain one with a larger objective value as the optimal solution to the constrained 2-maxian problem.Next, we begin to consider the functions f W (x) and f W c (y).
Lemma 1.For the given W ∈ W, the functions f W (x) and f W c (y) are concave and piecewise linear.
Proof.It is only proven that f W (x) is concave because the concavity of f W c (y) can be obtained similarly.For simplicity, it is assumed that W = {1, . . ., n 2 }, W c = { n 2 + 1, . . ., n}.Note that d(i, x) is piecewise linear and concave for i ∈ W. Since w i ≥ 0, f W (x) is concave and piecewise linear.
Note that a piecewise linear function f attains its maximum in a breakpoint i.Let the breakpoints of f be i 1 , . . ., i q and the corresponding slopes in the interval [i s , i s+1 ] be k s .Then, i s is the maximum point of f if and only if the product of the slopes in It is easy to see that the set of breakpoints BPs of the function f W (x) is given by the following equation: ℓ(e s )|s = 2, . . ., n 2 } ∪ {i n = n}.
Note that the slope k s of f V ′ (x) in [i s , i s−1 ] can be computed as follows: w j .
According to the discussion above, the breakpoints and the slopes can be computed in linear time.However, in order to compute f W (x) and f W c (y) efficiently for all W ∈ W, an even better method can be introduced.
Note that if we have already solved f W (x) for W ∈ W, then the solution for W ′ with |W∆W ′ | = 2 has the following property, where ∆ denotes the symmetric difference of two sets.Lemma 2. Let W = {v i , . . ., v i + n 2 − 1} and W ′ = {v i+1 , . . ., v i + n 2 } be two sets of W. Suppose that arg max x∈W c f W (x) = i s for some v s ∈ W c and arg max y∈W f W c (y) = v i t for some v t ∈ W c , then arg max Proof.The length of the path induced by W is denoted by ℓ(G[W]), i.e., ℓ(G[W]) = ∑ e∈G[W] ℓ(e).Note that f W (x) and f W ′ (x) are defined on [v i , v i + ℓ(W)] and [ℓ(e i ), ℓ(W) + ℓ(e v i + n 2 )], respectively.Both functions are piecewise linear in [ℓ(e i ), ℓ(W)], and they have the same set of breakpoints B = {v i+1 + n 2 , . . ., v i+n }.For the interval [v i , v i+1 ], the slopes of f W (x) and f W ′ (x) can be computed as follows: and respectively.Subtracting ( 9) from ( 10), we have 2 + 1).For the function f W c (y), we can use the same argument to obtain the statement.
It is easy to apply the above result to any two sets In the preprocessing step (lines 1-3), the problem max x ∈ W 1 f W 1 (x) is solved, and the right-sided derivative in x * 1 is obtained.In the for-loop, the problem max x∈W j f W i (x) is solved, where we assume that x * i−1 , z * i−1 and k W i−1 (x * j−1 ) are already computed.Lines 5-12 consider two different cases: x * i−1 = i − 1 and x * i 1 ̸ = i − 1. Lines 14-15 compute the values f W i (x * i ) and k W i (x * i ) for the problem on W i .Lines 16-20 judge whether x * i is optimal; if it is not, x * i will be updated until we obtain an optimal solution.Thus, Algorithm 1 is correct.Note that the preprocessing step can be completed in linear time.Moreover, since the computation in each for-loop can be completed in constant time, the total computation can be completed in O(n) time.Therefore, Algorithm 1 runs in linear time.Once x * i and y * i for i = 1, 2, . . ., n are obtained, we test d(x * i , y * i ) ≤ U .If it does not hold, (x * i , y * i ) could be replaced with (x * i , ex(x * i )) or (ex(y * i ), y * i ) according to the statements in the previous section.Note that these computations can be completed in constant time.Summarizing, we accomplish the main result of this paper.Theorem 3. The constrained 2-maxian problem on a cycle can be solved in linear time.

Conclusions
This paper addressed the p-maxian problem on cycle graphs with constraints, where the distance between facilities is not greater than a given bound U .We considered the case of p = 2 and showed that any optimal solution contains at least one vertex of the cycle graph.Based on this property, we developed a combinatorial algorithm that solves the problem in linear time.It should be emphasized that the underlying graph of our model is a cycle, which is different from the graph of [15].It is interesting to study whether there exist polynomial time algorithms for the case of p ≥ 3 on cycle graphs and the constrained p-maxian problem on cactus graphs, block graphs, etc.

Figure 1 .
Figure 1.Vertex optimality does not hold any more.
Finally, we give Algorithm 1 to computez * = max x∈W i f W i (x) and x * i = arg max x∈W j f W i (x) for i = 1, 2 . .., n.Based on lemma 2, we can easily compute x * i+1 in X(x * i , n 2 + i).This result guarantees that we only have to deal with the right-sided derivative in x * i .The right-sided derivative in x * i , with respect to f W i , is denoted by k