1. Introduction
The Facility Location problem is an extensively studied combinatorial optimization problem, which has many practical applications. In this problem, we are given a single metric on a set of clients and facilities, where each facility is associated with an opening cost. The goal is to find a set of facility locations that minimize the opening cost for all facilities plus the connection cost for all clients, where a client’s connection cost is its distance to the nearest facility.
In many natural location and network design settings, client locations are not known in advance. Motivated by this fact, Ref. [
1] introduced online facility location problems, where clients arrive one-by-one and must be irrevocably assigned to a facility upon arrival. In practical settings related to online data clustering, new data points arrive and the decision of clustering some data points together should not be regarded as irrevocable [
2].
Understanding the dynamics of temporally evolving social or infrastructure networks has been the central question in many applied areas recently. Eisenstat et al. [
3] introduced the Dynamic Facility Location problem, which models the temporal aspects of such networks. In this time-dependent variant of Facility Location problem, clients or facilities may change their location over time and the goal is to achieve the best trade-off between the optimal connections of clients to facilities and the stability of solutions between consecutive timesteps. The temporal aspect of the Dynamic Facility Location problem is modeled by
T metrics given on the same set of clients and facilities, each representing the metric at time step
. This is the key difference between the classic Facility Location problem, which is solved in a fixed metric space
M that does not develop over time. Therefore, the Dynamic Facility Location is a Facility Location problem in an evolving metric
, which changes at each timestep
.
In this paper, we study the online variant of the Dynamic Facility Location problem, denoted as ODFL, where the metrics on clients and facilities are revealed one by one at each round. The online algorithm must make its decision before the metric of the next round is revealed and without knowing the total number of rounds. This is the key difference between ODFL and the offline variant of Dynamic Facility Location in [
3], where the
T metrics are known beforehand. Therefore, ODFL attempts to capture realistic settings, where the input data are revealed piece-by-piece and the algorithm must make its decision before upcoming input pieces are revealed. The online aspect of the problem poses new challenges and precludes many algorithmic techniques used to deal with offline problems. Next, we give a formal definition of ODFL.
Model. In Online Dynamic Facility Location, we are given a set of facilities
, a set of clients
C,
, a switching cost
g and a facility opening cost
f. At each round
, a new metric between clients and facilities is revealed with the form of a
dimensional vector
, which has entries corresponding to distances over
. We denote by
the distance between client
j and facility
i at time
t. At each round
t, the goal is to find a subset
of open facilities and an assignment
of clients to open facilities so as to minimize the objective:
where
is the indicator function of proposition
p. The assignment
of round
t is chosen without knowing the distance vectors
of upcoming rounds. The objective function is the sum of the hourly opening costs for each open facility plus the connection costs of each client plus the switching costs (
g per change of facility per client). We note that any solution pays switching cost
at round
, since it switches to an initial assignment of the clients to facilities.
We measure the performance of our online algorithm using the notion of the competitive ratio. Given a request sequence
, let
denote the cost paid by an online algorithm on
and let
denote the cost paid on
by an optimal offline algorithm, which knows
in advance. The online algorithm is
c-competitive if there exists a constant
a such that:
for all request sequences
. The factor
c is called the competitive ratio.
Related work. The offline and online variants of Facility Location have been studied extensively in the literature. For the offline Facility Location problem, the approximability is
[
4] for the non-metric case while, for the metric case, the best lower bound is
[
5], and the best algorithm has an approximation ratio
[
6]. Online Facility Location is known to have a competitive ratio of
in the adversarial case for both deterministic and randomized algorithms [
7] and a constant competitive ratio if the clients are drawn from a known distribution [
8].
The study of Dynamic Facility Location so far concerns the offline case where the changes between distances of clients and facilities are known in advance. Eisenstat et al. [
3] showed an upper bound of
for the most interesting variant of Dynamic Facility Location with hourly facility costs, where facilities can be closed and are paid for all rounds in which they remain open. This result was later improved by [
9], which gave an
-approximation algorithm.
In [
10], they provided a framework for designing competitive online algorithms using regularization, which is a widely used technique in online learning. They designed a
-competitive deterministic algorithm for generating a fractional solution that satisfies a time-varying set of constraints, where
m is the number of variables. Then, they provided an
-competitive randomized algorithm for the online set cover problem with a service cost, where
m is the number of sets and
n is the number of elements. The first step of our online algorithm, which provides a
-competitive fractional solution, where
m is the number of facilities, is inspired by the approach of [
10] and a large part of the analysis follows their proof. In the second step of our online algorithm, we show a rounding scheme that works favorably with the fractional solution to obtain a non-trivial additive competitive ratio of
, where
n is the number clients. To the best of knowledge, this is the first upper bound for ODFL.
2. Results
In this work, we study the competitive ratio of ODFL. We start by proving lower bounds for deterministic and randomized algorithms for ODFL. Our first result is the following.
Theorem 1. The competitive ratio of any deterministic online algorithm isand the competitive ratio of any randomized online algorithm against the oblivious adversary isfor the Online Dynamic Facility Location problem, where m is the number of facilities.
Our second result is a randomized algorithm, which is
-competitive. In order to achieve this, we express the offline Dynamic Facility Location problem as a linear program P (
Figure 1a). Then, we apply the following two algorithms at each round
t.
Algorithm 1 (Regularization algorithm): It solves a linear program minimizing the objective function of P modified to include a smooth convex regularization term and obtains the fractional solution .
Algorithm 2 (Rounding algorithm): It rounds the fractional solution of Algorithm 1 to an integral solution using competing exponential clocks.
Algorithm 1 The regularization algorithm |
Parameters: , Initialization: Set and . At each round : Let be the distance cost vector and let S be the set of feasible solutions. Solve the following linear program to obtain the fractional solution : |
Algorithm 2 The rounding algorithm |
1: Initialization: Choose i.i.d. random variables . 2: At each round t: 3: Let be the fractional value of round t obtained by Algorithm 1. 4: For each client j, open and connect j to i. |
Algorithm 1 solves online a linear program to produce a fractional solution at each round
t involving the current distance vector
. This algorithm is essentially the general algorithm presented in [
10], which we adapt to ODFL. The performance of the general regularization algorithm is proved by Theorem 1.1 in [
10] for the case of time varying covering constraints. Although we follow the same steps to prove the existence of a
-competitive fractional solution for ODFL, where
m is the number of facilities, we must also address the presence of both covering and precedence constraints in ODFL.
Algorithm 2 is the randomized procedure that rounds the fractional solution provided from Algorithm 1 to an integral solution. Our contribution here is that we use an appropriate rounding which works favorably with Algorithm 1 so as to produce a solution, which is
-competitive for ODFL. The rounding algorithm makes use of competing exponential clocks, which have been applied in many similar problems like the Dynamic Facility Location problem [
9] and the Online Set Cover with a Service Cost problem [
10].
Theorem 2. There is a randomized algorithm which is-competitive for the Online Dynamic Facility Location problem, where m denotes the number of facility locations and n denotes the number of clients.
Organization. In
Section 3, we present lower bounds on the competitive ratio of deterministic and randomized algorithms for ODFL. Then, we present Algorithm 1 in
Section 4 and Algorithm 2 in
Section 5 and prove their guarantees in the respective sections.
3. Lower Bounds
In this section, we prove lower bounds of deterministic and randomized algorithms for ODFL. In both cases, the metric space is a star graph with a client lying on the center of the star for all rounds.
The core idea of the proofs is to force the online algorithm to pay the switching cost at each round. By carefully selecting the parameters of ODFL, we can prove that any deterministic online algorithm is
-competitive. For the randomized lower bound, we use Yao’s principle (see examples in Chapter 8 in [
11]). Specifically, we choose a randomized instance such that the expected performance of any deterministic algorithm against the optimal offline algorithm is
. By Yao’s principle, any randomized algorithm has the same lower bound.
Proof. Let OPT denote the optimal cost and ALG denote the cost of an online algorithm. The instance consists of a star graph with m edges and the number of rounds is . Facilities can only be opened in the leaves (a total of m leaves), and there is one client () sitting at the center of a graph for all rounds. The distance of every leaf j to the center is initially . Then, the adversary has the following simple strategy at each round :
For every leaf j, such that the online algorithm connects the client to the facility in j, becomes arbitrarily large. At round T, the distances remain the same as in the previous round.
Observe that there is only one leaf with distance
d from the center of a star for all rounds. The optimal offline solution just opens a facility at this leaf and connects the client to it for all rounds, thus paying
. On the other side, any competitive online algorithm will prefer to open a new facility at distance
d and connect the client to this facility at the start of each round instead of paying the large distance. Therefore, the cost incurred by any online algorithm is at least
. By setting
, we have that
Turning to the randomized case, the instance consists of the same metric as the deterministic case and the only difference is that we will use randomized adversarial requests. Then, by showing that any deterministic algorithm has a competitive ratio of at least and by Yao’s principle, we will prove the lower bound for randomized algorithms.
Now, the adversary chooses uniformly at random an edge
e, which has length
d (has not yet become arbitrarily large) at each round
and makes its length arbitrarily large. At round
T, where only one leaf has distance
d, the distances remain the same as in the previous round. Again, the optimal solution uses the leaf in distance
d at all rounds and pays
. However, the expected switching cost of any competitive algorithm is:
since at each round
t the edge that the algorithm uses becomes arbitrarily large with probability
. By setting
,
□
This concludes this section with the lower bounds. In the following sections, we present a randomized algorithm for the ODFL problem with a nearly matching bound of .
4. The Regularization Algorithm
In this section, we show that the regularization algorithm of [
10] can be applied to ODFL and that it produces a fractional solution at each round, which is
-competitive, where
m is the number of facility locations. We will prove the following theorem:
Theorem 3. The Regularization Algorithm produces an-competitive fractional solution for the Online Dynamic Facility Location problem, where m is the number of facilities.
Before proceeding to the details of Algorithm 1, we first express the offline Dynamic Facility Location as a linear program, denoted as P (
Figure 1a). Algorithm 1 will solve a linear program
at each round, which will be constructed from P combined with a regularization function. Finally, we will show that the fractional solution of
is
-competitive with respect to the solution of the dual program D (
Figure 1b) of P, which serves as lower bound on the optimal offline solution.
Now, we express offline Dynamic Facility Location as an integer program, which will be relaxed to obtain the linear program P. Recall that are the number of rounds, clients, and facility locations, respectively. The first term of the objective function is the total facility opening cost, where f is the cost to open a facility. The second term is the total connection cost, where is the distance between facility i and client j in round t, and the third term is the total switching cost, where each change of a client’s connection to a facility costs g.
We use the decision variables
,
and
, where
;
if facility
i is open at round
t and
otherwise,
if client
j is connected to facility
i at round
t and
, otherwise,
if client
j was connected to facility
i at round
t but not connected to the same facility
i at round
and
, otherwise. The value of the variable
is imposed from the third constraint, which expresses the switching cost. The first constraint (
) ensures that, whenever a client
j is connected to a facility
i, the facility
i is open. The second constraint (
) guarantees that every client is connected to a facility. Finally, relaxing the decision variables to take non-negative real values, we obtain the LP of
Figure 1a, denoted as P.
Next, we are ready to present Algorithm 1. The algorithm is given at each round t a distance vector containing the distances between clients and facilities. Then, Algorithm 1 finds the minimizer of the linear program at each round t, which has two differences from P. The first one is that the last term of the objective function in P (the switching cost) is substituted by the regularization function in . The second is that the constraint relative to the switching cost in P is omitted in . We note that the regularized objective function includes both the previous solution as well as the current cost vector. Thus, the solution in each round is determined greedily and independently of rounds prior to .
To analyze the performance of Algorithm 1, we will need to construct a lower bound on the optimal offline solution. Therefore, we derive the dual D of P (
Figure 1b), which has the following variables (corresponding to the primal constraints on the left):
→ for all , ,
→ for all ,
→ for all , ,
We will prove Theorem 3 by showing that the set of dual variables of the solutions that
returns is a feasible solution for D within a factor of
of the optimal offline solution, where
is a small constant. Specifically, we will use the KKT optimality conditions of
(the regularized LP) in each round. The constraints define dual variables, which will be plugged in the formulation of the dual D in
Figure 1b. This way, we will construct a dual solution to the original online problem, which will serve as a lower bound on the optimal offline solution. Ref. [
10] mentions that their technique can be generalized to facility location problems, without providing any further technical details. In the next lemmas, we verify their claim, by adjusting their approach and proof techniques to ODFL. Recall that the constraint
is omitted in
. In order to define a feasible solution for D, we introduce the variable
corresponding to this constraint and we let
be the optimal dual variables of
corresponding to the precedence and covering constraints, respectively.
Lemma 1. The set of optimal solutions for each round t of the dual LP D* of P*, which satisfy the KKT conditions for an appropriate, consist of a feasible solution for D.
Proof. Let
be the optimal solution of P* at round
t. Set the variables of D at time
t to be:
To prove that the solution above is feasible for D, we prove that it satisfies its constraints one by one. This is achieved using the following KKT conditions that hold for P* and its dual:
The first group of constraints of the dual D (
Figure 1b) (
) follows easily from KKT condition (3). The same holds for the last two groups of constraints (
and
) due to KKT conditions (1) and (2). Furthermore, by (4) and the construction of
, we have that:
.
The above inequalities prove that the second, third, and fourth group of constraints of D also hold, thus completing the proof of the lemma. □
We are now ready to prove Theorem 3, by showing that the dual we constructed can pay for the facility, connection, and switching cost of Algorithm 1. Since we bound together the facility cost and connection cost, we will simply refer to them as the service cost. Throughout the proofs, we will use the following relations:
Equalities (
5)–(8) are the KKT conditions of
and its dual and the remaining two inequalities are standard logarithmic inequalities. Theorem 3 will follow from the next two lemmas. The analysis is similar to that of Theorem 1.1 in [
10] adapted to the objective of ODFL and also dealing with the presence of precedence constraints.
Lemma 2. The switching cost M of Algorithm 1 is at most times the cost of the dual feasible solution of Lemma 1.
Proof. Let
be the switching cost of Algorithm 1 at round
t. The summation below is taken over increasing values of connection variables, i.e.,
, since decreasing values only decrease the fractional switching cost:
This concludes the proof of the lemma. □
Lemma 3. The total service cost S of Algorithm 1 is less than the cost of the dual feasible solution of Lemma 1:
Proof. Notice that that the two terms in the bracket of the right-hand side of the inequality above cancel each other out, since:
Therefore, it holds that
□
We can now easily prove the performance of Algorithm 1 stated in Theorem 3.
Proof of Theorem 3. Let OPT(D) and OPT(P) denote the optimal solutions of the D and P, respectively. By Lemmas 2 and 3, the total cost of Algorithm 1 is:
□
The proof of Theorem 3 concludes this section.
5. The Rounding Algorithm
In this section, we present Algorithm 2, which makes use of the exponential distribution to round the fractional solution to an integral solution at each round. The analysis shows that the fractional solution grows up to a factor logarithmic in n regarding the facility cost and up to constant factors regarding the switching and connection cost. Before proceeding to the details of Algorithm 2, we give the definition of an exponential random variable and some of their properties.
Definition 1. A random variable X is distributed according to the exponential distribution with rate λ, denoted as , if it has density for every , and otherwise. We will use the following properties of exponential random variables:
If and , then .
Let be independent random variables with :
- (a)
- (b)
If and are independent, then
The rounding algorithm samples independently a total of (one for each client-facility connection) random variables from the exponential distribution with rate at the beginning of its execution, which will be used throughout all rounds. Then, at each round t, it chooses for each client j the connection minimizing the ratio , where is the fractional variable of this connection obtained by Algorithm 1. Notice that, by the properties of Definition 1, the ratio is also an exponential random variable. This technique is referred to as competing exponential clocks, since a random variable wins the competition if it has the smallest value among all others (minimizes the ratio in our case).
The high level idea of the analysis is that connection and switching cost of the rounded solution add only constant factors to the cost of the connection and switching cost of the fractional solution at each round t. The reason is that they favor connections to facilities that are dependent on the increase/decrease of the fractional variables . This fact combined with the properties of the exponential distribution leads to a rounding of the right connections indicated by the fractional solution. On the other side, this leads to more open facilities, since we prove that the rounding adds a factor logarithmic in n to the cost of the fractional solution.
Next, we will analyze the performance of Algorithm 2 by bounding separately the facility, connection, and switching cost. We will simply calculate the probabilities of opening any facility, connecting a client to a facility and changing a connection.
Facility cost. We start with the facility cost of the rounding algorithm, which is -competitive with respect to the facility cost of the fractional solution.
Proof. Let
denote the event that
for some client
j and let
be chosen later. The probability of
equals:
By choosing , we have the result. □
Connection cost. Next, we show that the connection cost of the rounding algorithm is -competitive with the connection cost of the fractional solution. Again, let be chosen later.
Proof. Similar arguments to the previous proof show that the probability to choose connection
is:
By choosing a sufficiently small a (for example ), we have the result. □
Switching cost. Finally, we show that every step that incurs a fractional switching cost of d in a connection variable incurs an expected increase of at most in the randomized solution. Thus, the expected number of new connections is .
Proof. We break down the total movement from time
to
t in the fractional solution into
intermediate steps, on each of which only the value of exactly one
is changed. We take first all the
’s whose value increases and then all the
’s whose value decreases, thus managing to preserve a feasible solution in all the intermediate steps. This way, the total switching cost from time
to time
t of the fractional solution does not change while the integral switching cost could only increase due to possible changes in the intermediate steps. First, we will prove the bound in the case the connection variable decreases:
. Let
, where
for
. When the value of
decreases, the value of
increases. Therefore, connection
cannot be chosen a time
t if is not chosen at time
. However, due to the increase of
, another connection could turn minimal that had not been chosen in the previous time step. This is the only case, when a switching cost is incurred. The probability of this event is bounded by:
This expression is maximized when
, and therefore is less than
Now, we turn to the case where
. When
increases, the ratio
decreases. Therefore, if facility
i was chosen in the previous step, it will be chosen again in this step, thus not incurring switching cost. If facility was not chosen in the previous step, it will be chosen in this step with probability
which is no more than
, following the exact same analysis with the case of the decreasing connection variables. □
Finally, it is easy to provide the proof of Theorem 2, which concludes this section.
Proof of Theorem 2. First, notice that, by Lemma 3, the fractional solution of Algorithm 1 is optimal with respect to the facility and connection cost. Therefore, Algorithm 2 will round the solution to an integral one only losing a factor of in the facility cost and a factor in the connection cost, thus being competitive with the optimal offline solution. Regarding the switching cost, by Lemma 2, the fractional solution is competitive with the fractional solution. The cost of this solution will only increase by a factor of after the randomized rounding, thus proving the result. □