O
NLINE F ACILITY L OCATION WITH P REDICTIONS
Anonymous authors
Paper under double-blind review
A BSTRACT
We provide nearly optimal algorithms for online facility location (OFL) with predictions.
In OFL, n demand points arrive in order and the algorithm must irrevocably assign each demand point to an open facility upon its arrival.
The objective is to minimize the total connection costs from demand points to assigned facilities plus the facility opening cost.
We further assume the algorithm is additionally given for each demand point x i a natural prediction f pred x i , which is supposed to be the facility f opt x i that serves x i in the ofﬂine optimal solution.
Our main result is an O (min { log nη ∞ OPT , log n } )
-competitive algorithm where η ∞ is the maximum prediction error (i.e., the distance between f pred x i and f opt x i ).
Our algorithm overcomes the fundamental Ω( log n loglog n ) lower bound of OFL (without predictions) when η ∞ is small, and it still maintains O (log n ) ratio even when η ∞ is unbounded.
Furthermore, our theoretical analysis is supported by empirical evaluations for the tradeoffs between η ∞ and the competitive ratio on various real datasets of different types.
I NTRODUCTION
We study the online facility location (OFL) problem with predictions.
In OFL, given a metric space ( X , d ) , a ground set D ⊆ X of demand points, a ground set F ⊆ X of facilities, and an opening cost function w :
F → R + , the input is a sequence of demand points X :=
( x 1 , . . .
, x n )
⊆ D , and the online algorithm must irrevocably assign x i to some open facility, denoted as f i , upon its arrival, and an open facility cannot be closed.
The goal is to minimize the following objective
[Equation]
where F is the set of open facilities.
Facility location is a fundamental problem in both computer science and operations research, and it has been applied to various domains such as supply chain management (Melo et al., 2009), distribution system design (Klose & Drexl, 2005), healthcare (Ahmadi-Javid et al., 2017), and more applications can be found in surveys (Drezner & Hamacher, 2002;
Laporte et al., 2019).
Its online variant, OFL, was also extensively studied and well understood.
The state of the art is an
O ( log n loglog n ) -competitive deterministic algorithm proposed by Fotakis (2008), and the same work shows this ratio is tight.
We explore whether or not the presence of certain natural predictions could help to bypass the
O ( log n loglog n ) barrier.
Speciﬁcally, we consider the setting where each demand point x i receives a predicted facility f pred x i that is supposed to be x i ’s assigned facility in the (ofﬂine) optimal solution.
This prediction is very natural, and it could often be easily obtained in practice.
For instance, if the dataset is generated from a latent distribution, then predictions may be obtained by analyzing past data.
Moreover, predictions could also be obtained from external sources, such as expert advice, and additional features that deﬁne correlations among demand points and/or facilities.
Previously, predictions of a similar ﬂavor were also considered for other online problems, such as online caching (Rohatgi, 2020; Lykouris & Vassilvitskii, 2021), ski rental (Purohit et al., 2018; Gollapudi & Panigrahi, 2019) and online revenue maximization (Medina & Vassilvitskii, 2017).
1. O UR R ESULTS
Our main result is a near-optimal online algorithm that offers a smooth tradeoff between the prediction error and the competitive ratio.
In particular, our algorithm is O (1) -competitive when the predictions are perfectly accurate, i.e., f pred x i is the nearest neighbor of x i in the optimal solution for every 1 ≤ i ≤ n .
On the other hand, even when the predictions are completely wrong, our algorithm still remains O (log n ) -competitive.
As in the literature of online algorithms with predictions, our algorithm does not rely on the knowledge of the prediction error η ∞ .
Theorem 1.1.
There exists an O (min { log n, max { 1 , log nη ∞ OPT }} ) -competitive algorithm for the OFL with predictions, where η ∞ := max 1 ≤ i ≤ n d ( f pred x i , f opt x i ) measures the maximum prediction error, and f opt x i is the nearest neighbor of x i from the ofﬂine optimal solution OPT 1 .
Indeed, we can also interpret our result under the robustness-consistency framework which is widely considered in the literature of online algorithms with predictions (cf.
Lykouris & Vassilvitskii (2021)), where the robustness and consistency stand for the competitive ratios of the algorithm in the cases of arbitrarily bad predictions and perfect predictions, respectively.
Under this language, our algorithm is O (1) -consistent and O (log n ) -robust.
We also remark that our robustness bound nearly matches the lower bound for the OFL without predictions.
One might wonder whether or not it makes sense to consider a related error measure, η 1 := (cid:80)
ni
=1 d ( f pred x i , f opt x i ) , which is the total error of predictions.
Our lower bound result (Theorem 1.2) shows that a small η 1 is not helpful, and the dependence of η ∞ in our upper bound is fundamental (see Section E for a more detailed explanation).
The lower bound also asserts that our algorithm is nearly tight in the dependence of η ∞ .
Theorem 1.2.
Consider OFL with predictions with a uniform opening cost of 1 . For every η ∞ ∈ (0 , 1] , there exists a class of inputs, such that no (randomized) online algorithm is o ( log nη ∞ OPT loglog n ) - competitive, even when η 1 = O (1) .
Empirical evaluation.
We simulate our algorithm on both Euclidean and graph (shortest-path) datasets, and we measure the tradeoff between η ∞ and the empirical competitive ratio, by generating random predictions whose η ∞ is controlled to be around some target value.
We compare with two baselines, the O (log n ) -competitive algorithm by Meyerson (2001) which do not use the prediction at all, and a naive algorithm that always trusts the prediction.
Our algorithm signiﬁcantly outperforms Meyerson’s algorithm when η ∞ → 0 , and is still comparable to Meyerson’s algorithm when η ∞ is large where the follow-prediction baseline suffers a huge error.
We observe that our lead is even more signiﬁcant on datasets with non-uniform opening cost, and this suggests that the prediction could be very useful in the non-uniform setting.
This phenomenon seems to be counter-intuitive since the error guarantee η ∞ only concerns the connection costs without taking the opening cost into consideration (i.e., it could be that a small η ∞ is achieved by predictions of huge opening cost), which seems to mean the prediction may be less useful.
Therefore, this actually demonstrates the superior capability of our algorithm in using the limited information from the predictions even in the non-uniform opening cost setting.
Finally, we test our algorithm along with a very simple predictor that does not use any sophisticated
ML techniques or speciﬁc features of the dataset, and it turns out that such a simple predictor already achieves a reasonable performance.
This suggests that more carefully engineered predictors in practice is likely to perform even better, and this also justiﬁes our assumption of the existence of a good predictor.
Comparison to independent work.
A recent independent work by Fotakis et al.
(2021a) considers OFL with predictions in a similar setting.
We highlight the key differences as follows.
(i)
We allow arbitrary opening cost w ( · ) , while Fotakis et al.
(2021a) only solves the special case of uniform facility location where all opening costs are equal.
This is a signiﬁcant
difference, since as we mentioned (and will discuss in Section 1.2)), the non-uniform opening cost setting introduces outstanding technical challenges that require novel algorithmic ideas.
(ii)
For the uniform facility location setting, our competitive ratio is O
(log nη ∞ OPT )
=
O (log nη ∞ w ) , while the ratio in Fotakis et al.
(2021a) is
[Equation]
where err
[Equation]
and w is the uniform opening cost.
Our ratio is comparable to theirs when η 1 is relatively small.
However, theirs seems to be better when η 1 is large, and in particular, it was claimed in Fotakis et al.
(2021a) that the ratio becomes constant when err 1 ≈ err 0 .
Unfortunately, we think this claim contradicts with our lower bound (Theorem 1.2) which essentially asserts that η 1 = O ( η ∞ ) is not helpful for the ratio.
Moreover, when η 1 is large, we ﬁnd their ratio is actually not well-deﬁned since the denominator log( err − 1 1 log( err 0 )) is negative.
Therefore, we believe there might be some unstated technical assumptions, or there are technical issues remaining to be ﬁxed, when η 1 is large.
We also note that another independent work by Panconesi et al.
(2021) seems to study a similar problem.
However, at the time of writing, we were not able to obtain their full text and hence cannot make a comprehensive comparison.
1. T ECHNICAL O VERVIEW
Since we aim for a worst-case (i.e., when the predictions are inaccurate) O (log n ) ratio, our algorithm is based on an O (log n ) -competitive
algorithm (that does not use predictions) by Meyerson (2001), and we design a new procedure to make use of predictions.
In particular, upon the arrival of each demand point, our algorithm ﬁrst runs the steps of Meyerson’s algorithm , which we call the
Meyerson step, and then runs a new procedure (proposed in this paper) to open additional facilities that are “near” the prediction, which we call the Prediction step.
We make use of the following crucial property of Meyerson’s algorithm.
Suppose before the ﬁrst demand point arrives, the algorithm is already provided with an initial facility set ¯ F , such that for every facility f ∗ opened in OPT , ¯ F contains a facility f (cid:48) that is of distance η ∞ to f ∗ , then Meyerson’s algorithm is O
(log nη ∞ OPT ) -competitive. To this end, our Prediction step aims to open additional facilities so that for each facility in OPT , the algorithm would soon open a close enough facility.
Uniform opening cost.
There is a simple strategy that achieves this goal for the case of uniform opening cost .
Whenever the Meyerson step decides to open a facility, we further open a facility at the predicted location.
By doing so, we would pay twice as the Meyerson algorithm does in order to open the extra facility.
As a reward, when the prediction error η ∞ is small, the extra facility would be good and close enough to the optimal facility.
Non-uniform opening cost.
Unfortunately, this strategy does not extend to the non-uniform case.
Speciﬁcally, opening a facility exactly at the predicted location could be prohibitively expensive as it may have huge opening cost.
Instead, one needs to open a facility that is “close” to the prediction, but attention must be paid to the tradeoff between the opening cost and the proximity to the prediction.
The design of the Prediction step for the non-uniform case is the most technical and challenging of our paper.
We start with opening an initial facility that is far from the prediction, and then we open a series of facilities within balls (centered at the prediction) of geometrically decreasing radius, while we also allow the opening cost of the newly open facility to be doubled each time.
We stop opening facilities if the total opening cost exceeds the cost incurred by the preceding Meyerson step, in order to have the opening cost bounded.
We show that our procedure always opens a “correct” facility ˆ f that is Θ( η ∞ ) apart to the corresponding facility in OPT , and that the total cost until ˆ f is opened is merely O (OPT) .
This is guaranteed by the gradually decreasing ball radius when we build additional facilities (so that the “correct” facility will not be skipped), and that the total opening cost could be bounded by that of the last opened facility (because of the doubling opening cost).
Once we open this ˆ f , subsequent runs of Meyerson steps would be O
(log nη ∞ OPT ) -competitive.
1. R ELATED W ORK
OFL is introduced by Meyerson (2001), where a randomized algorithm that achieves competitive ratios of O (1) and O (log n ) are obtained in the setting of random arrival order and adversarial arrival order, respectively.
Later, Fotakis (2008) gave a lower bound of Ω( log n loglog n ) and proposed a deterministic algorithm matching the lower bound.
In the same paper, Fotakis also claimed that an improved analysis of Meyerson’s algorithm actually yields an O ( log n loglog n ) competitive ratio in the setting of adversarial order.
Apart from this classical OFL, other variants of it are studied as well.
Div´eki & Imreh (2011) and Bamas et al.
(2020b) considered the dynamic variant, in which an open facility can be reassigned.
Another variant, OFL with evolving metrics, was studied by Eisenstat et al.
(2014) and Fotakis et al.
(2021b).
There is a recent trend of studying online algorithms with predictions and many classical online problems have been revisited in this framework.
Lykouris & Vassilvitskii (2021) considered online caching problem with predictions and gave a formal deﬁnition of consistency and robustness.
For the ski-rental problem, Purohit et al.
(2018) gave an algorithm with a hyper parameter to maintain the balance of consistency and robustness.
They also considered non-clairvoyant scheduling on a single machine.
Gollapudi & Panigrahi (2019) designed an algorithm using multiple predictors to achieve low prediction error.
Recently, Wei & Zhang (2020) showed a tight robustness-consistency tradeoff for the ski-rental problem.
For the caching problem, Lykouris & Vassilvitskii (2021) adapted Marker algorithm to use predictions.
Following this work, Rohatgi (2020) provided an improved algorithm that performs better when the predictor is misleading.
Bamas et al.
(2020b) extended the online primal-dual framework to incorporate predictions and applied their framework to solve the online covering problem.
Medina & Vassilvitskii (2017) considered the online revenue maximization problem and Bamas et al.
(2020a) studied the online speed scaling problem.
Both Antoniadis et al.
and D ¨ utting et al. (2021) considered the secretary problems with predictions. Jiang et al.
(2021) studied online matching problems with predictions in the constrained adversary framework. Azar et al. (2021) and Lattanzi et al. (2020) considered ﬂow time scheduling and online load balancing, respectively, in settings with error-prone predictions.
P RELIMINARIES
Recall that we assume a underlying metric space ( X , d ) .
For S ⊆ X , x ∈ X , deﬁne d ( x, S ) :
= min y ∈ S d ( x, y ) .
For an integer t , let [ t ] := { 1 , 2 , . . .
, t } .
We normalize the opening cost function w so that the minimum opening cost equals 1 , and we round down the opening cost of each facility to the closest power of 2 .
This only increases the ratio by a factor of 2 which we can afford (since we make no attempt to optimize the constant hidden in big O ).
Hence, we assume the domain of w is { 2 i − 1 | i ∈
[ L ] } for some L .
Further, we use G k to denote the set of facilities whose opening cost is at most 2 k − 1 , i.e. G k := { f ∈ F | w ( f ) ≤ 2 k − 1 } , ∀ 1 ≤ k ≤ L .
Observe that G 0 = ∅ .
O UR A LGORITHM : P REDICTION - AUGMENTED M EYERSON
We prove Theorem 1.1 in this section.
Our algorithm, stated in Algorithm 1, consists of two steps, the Meyerson step and the Prediction step.
Upon the arrival of each demand point x , we ﬁrst run the Meyerson algorithm Meyerson (2001), and let cost M ( x ) be the cost from the Meyerson step. Roughly, for a demand point x , the Meyerson algorithm ﬁrst ﬁnds for each k ≥ 1 , a facility f k which is the nearest to x , among facilities of opening cost at most 2 k − 1 and those have been opened, and let δ k = d ( x, f k ) .
Then, open a random facility from { f k } k , such that f k is picked with probability ( δ k − 1 − δ k ) / 2 k .
For technical reasons, we do not normalize (cid:80) k p k , and we simply truncate if (cid:80)
k p k > 1 . Next, we pass the cost incurred in the Meyerson step (which is random) as the budget q to the Prediction step, and the Prediction step would use this budget to open a series of facilities through the repeat-until loop. Speciﬁcally, for each iteration in this loop, a facility is to be opened around distance r to the prediction, where r is geometrically decreasing, and the exact facility is picked to be the one with the minimum opening cost.
The ratio of this algorithm is stated as follows.
Theorem 3.1.
Prediction-augmented Meyerson is O (min { log n, max { 1 , log nη ∞ OPT }} ) -competitive.
Calibrating predictions.
Recall that η ∞ = max i ∈ [ n ] d ( f pred x i , f opt x i ) can be unbounded. We show how to “calibrate” the bad predictions so that η ∞ = O (OPT) .
Speciﬁcally, when a demand point x arrives, we compute f (cid:48)
x := arg min f ∈F { d ( x, f ) + w ( f ) } , and we calibrate f pred x by letting f pred x
[Equation]
x if d
[Equation]
x, f pred [Equation] 1: initialize F ← ∅ , F P ← ∅ (cid:46) F, F P are the set of all open facilities and those opened by P RED 2: for arriving demand point x ∈ X and its associated f pred x do 3: cost M ( x ) ← M EY ( x ) 4:
P RED (cid:0) f pred x , cost M ( x ) (cid:1) 5: procedure M EY ( x ) 6: for k ∈
[ L ] do 7: f k ← arg min f ∈ F ∪ G k d ( x, f ) 8: δ k ← d ( x, f k ) 9: p k ← ( δ k − 1 − δ k ) / 2 k , where δ
=
d ( x, F ) 10: let s k ← (cid:80) Li =
k p i for k ∈
[ L ] 11: sample r ∼ Uni [0 , 1] , and let i ∈
[ L ] be the index such that r ∈
[ s i +1 , s i ) 12: if such i exists then 13:
F ← F ∪ f i (cid:46) open facility at f i 14: connect x to the nearest neighbor in F 15: return d ( x, F ) + w ( f i ) (cid:46) if i does not exist, simply return d ( x, F ) 16: procedure P RED ( f pred x , q ) 17: repeat 18: r ← 12 d ( f pred x , F P ) 19: f open ← arg min f : d ( f pred x ,f ) ≤ r w ( f ) (cid:46) break ties by picking the closest facility to f pred x 20: if q ≥ w ( f open ) then 21:
F ← F ∪ f open , F P ← F P ∪ f open (cid:46) open facility at f open 22: q ← q − w ( f open ) 23: until q < w ( f open ) 24: open facility at f open with probability q w ( f open ) , and update F, F P
We show the calibrated predictions satisfy η ∞ =
O (OPT) .
Indeed, for every demand point x , d ( f (cid:48) x , f opt x ) ≤ d ( x, f (cid:48) x ) + d ( x, f opt x ) ≤ 2 d ( x, f (cid:48) x ) + w ( f (cid:48) x ) ≤ O (OPT) , where the second to last inequality follows from the optimality (i.e., the connection cost d ( x, f opt x ) has to be smaller than the cost of ﬁrst opening f (cid:48)
x then connecting x to f (cid:48) x ).
Note that, if η ∞ =
O (OPT) then nη ∞ OPT =
O ( n ) , hence it sufﬁces to prove a single bound O (max { 1 , log nη ∞ OPT } ) for Theorem 3.1 (i.e., ignoring the outer min ).
Algorithm analysis.
Let F opt be the set of open facilities in the optimal solution.
We examine each f ∗ ∈ F opt and its corresponding demand points separately, i.e. those demand points connecting to f ∗ in the optimal solution.
We denote this set of demand points by X ( f ∗ ) .
Deﬁnition 3.2 (Open facilities) .
For every demand point x , let F ( x ) be the set of open facilities right after the arrival of request x , ¯ F ( x ) be the set of open facilities right before the arrival of x , and ˆ F ( x ) =
F ( x ) \ ¯ F ( x ) be the set of the newly-open facilities on the arrival of x .
Moreover, let
F M ( x ) , F P ( x ) be a partition of F ( x ) , corresponding to the facilities opened by M EY and P RED , respectively.
Let ¯ F M ( x ) , ˆ F M ( x ) , ¯ F P ( x ) , ˆ F P ( x ) be deﬁned similarly.
Deﬁnition 3.3 (Costs) .
Let cost M ( x ) =
w ( ˆ F M ( x ))
+ d (cid:0) x, (cid:0) F M ( x ) ∪ ¯ F P ( x ) (cid:1)(cid:1) be the the total cost from M EY step.
Let cost P ( x ) =
w ( ˆ F P ( x )) be the cost from P RED step.
Let cost( x ) = cost M ( x ) + cost P ( x ) be the total cost of x .
Recall that after the M EY step, we assign a total budget of cost M ( x ) to the P RED step.
That is, the expected cost from the P RED step is upper bounded by the cost from the M EY step.
We formalize this intuition in the following lemma.
Lemma 3.4.
For each demand point x ∈ X , E [cost( x )] = 2 E [cost M ( x )] .
Proof.
Consider the expected cost from the P RED step.
Given arbitrary F p , q , there is only one random event from the algorithm and it is straightforward to see that the expected cost equals q .
Notice that our algorithm assigns a total budget of q = cost M ( x ) .
Thus, E [cost( x )]
=
E [cost M ( x )+ cost P ( x )]
= 2 E [cost M ( x )] .
Therefore, we are left to analyze the total expected cost from the M EY step.
The following lemma is the most crucial to our analysis.
Before continuing to the proof of the lemma, we explain how it concludes the proof of our main theorem.
Lemma 3.5.
For every facility f ∗ ∈ F opt , we have
[Equation]
Proof of Theorem 3.1.
Summing up the equation of Lemma 3.5 for every f ∗ ∈ F opt , we have
[Equation]
where the second equality is by Lemma 3.4 and the inequality is by Lemma 3.5, and this also implies that the ratio is O (1) when η ∞ = 0 .
3. P ROOF OF L EMMA 3.
Fix an arbitrary f ∗ ∈ F opt .
Let (cid:96) ∗ be the integer such that w ( f ∗ ) = 2 (cid:96) ∗ − 1 , or equivalently f ∗ ∈ G (cid:96) ∗ .
Let X ( f ∗ ) =
{ x 1 , x 2 , . .
, x m } be listed according to their arrival order.
We remark that there can be other demand points arriving between x i and x i +1 , but they must be connected to other facilities in the optimal solution.
Let (cid:96) i be the index (cid:96) such that d ( f ∗ , ¯ F ( x i )) ∈
[2 (cid:96) − 1 , 2 (cid:96) ) .
(cid:96) i can be negative and if d ( f ∗ , ¯ F ( x i ))
= 0 , let (cid:96) i = −∞ .
Observe that d ( f ∗ , ¯ F ( x i )) and (cid:96) i are non-increasing in i .
Let τ be the largest integer i with d ( f ∗ , ¯ F ( x i ))
> min { 7 η ∞ , 4 w ( f ∗ ) } .
Note that τ is a random variable.
We refer to the demand sequence before x τ as the long-distance stage and the sequence after x τ as the short-distance stage.
In this section, we focus on the case when 7 η ∞ ≤ 4 w ( f ∗ ) .
The proof for the other case is very similar and can be found in Section D.
Long-distance stage.
We start with bounding the total cost in the long-distance stage.
Intuitively, our procedure P RED would quickly build a facility that is close to f ∗ within a distance of O ( η ∞ ) , since it is guaranteed that for each demand point x i , the distance between f ∗ and its corresponding prediction f pred x i is at most η ∞ .
Formally, we prove the following statements.
Lemma 3.6.
E (cid:2)(cid:80) i<τ cost M ( x i ) (cid:3) ≤ 2 w ( f ∗ ) .
Proof.
Let G = { g 1 , g 2 , . .
. , g t } be the facilities opened by the P RED steps on the arrivals of all { x i } i<τ , and are listed according to their opening order.
Observe that the budget that is assigned to the P RED step is cost M ( x i ) , and the expected opening cost of each P RED step equals its budget.
By the deﬁnition of G , we have E (cid:2)(cid:80) i<
τ cost M ( x i ) (cid:3) = E (cid:104)(cid:80) k ∈ [ t ] w ( g k ) (cid:105) .
Next, we prove that the opening costs of g k ’s are always strictly increasing.
For each k ∈ [ t − 1] , suppose g k is opened on the arrival of demand x and g k +1 is opened on the arrival of demand y .
Let F denote the set of all open facilities right before g k +1 is opened.
Let f :=
arg min f : d ( f pred y ,f ) ≤ 12 d ( f pred y ,g k ) w ( f ) , we must have w ( g k +1 ) ≥ w ( f ) , since g k +1 =
arg min f : d ( f pred y ,f ) ≤ 12 d ( f pred y ,F ) w ( f ) and that d ( f pred y , F ) ≤ d ( f pred y , g k ) .
Moreover, d ( f, f pred x ) ≤ d ( f, f pred y ) + d ( f pred x , f pred y ) ≤ 2 d ( f pred y , g k ) + 2 η ∞ ≤  (cid:0) d
( f pred x , g k )
+ d ( f pred x , f pred y ) (cid:1) + 2 η ∞ ≤ 1 2 d ( f pred x , g k ) + 3 η ∞ <
d ( f pred x , g k ) .
Here, the second and fourth inequalities use the fact that d ( f pred x , f pred y ) ≤ d ( f pred x , f ∗ ) + d ( f ∗ , f pred y ) ≤ 2 η ∞ since both x, y ∈ X ( f ∗ ) .
The last inequality follows from the fact that d ( f pred x , g k ) ≥ d ( g k , f ∗ ) − d ( f pred x , f ∗ ) > 7 η ∞ − η ∞ = 6 η ∞ by the deﬁnition of τ .
Consider the moment when we open g k , the fact that we do not open facility f implies that w ( g k ) <
w ( f ) .
Therefore, w ( g k ) < w ( f ) ≤ w ( g k +1 ) .
Recall that the opening cost of each facility is a power of 2 .
We have that (cid:80) k ∈ [ t ] w ( g k ) ≤ 2 w ( g t ) .
Finally, we prove that the opening cost w ( g t ) is at most w ( f ∗ ) .
Consider the moment when g t is open, let x be the corresponding demand point.
Notice that
[Equation]
by the deﬁnition of τ .
However, we open g t instead of f ∗ on Line 20 of our algorithm.
It must be the case that w ( f ∗ ) ≥ w ( g t ) .
To conclude the proof, we have (cid:80) k ∈
[ t ] w ( g k ) ≤ 2 w ( g t ) ≤ 2 w ( f ∗ ) .
Lemma 3.7.
E [cost M ( x τ )] ≤ 2 w ( f ∗ ) + 2 (cid:80) mi =1 d ( x i , f ∗ ) .
Proof.
[-We assume δ 
-]
The proof can be found in Section A.
Short-distance stage.
Next, we bound the costs for the subsequence of demand points whose arrival is after the event that some facility near f ∗ is open.
Formally, these demand points are x
i ’s with i > τ .
The analysis of this part is conceptually similar to a part of the analysis of Meyerson’s algorithm.
However, ours is more reﬁned in that it utilizes the already opened facility that is near f ∗ to get an improved O (log nη ∞ OPT ) ratio instead of O (log n ) .
Moreover, Meyerson did not provide the full detail of this analysis, and our complete self-contained proof ﬁlls in this gap.
By the deﬁnition of τ , we have d ( f ∗ , ¯ F ( x i )) ≤ 7 η ∞ for such i > τ .
For integer (cid:96) , let I (cid:96) =
{ i > τ | (cid:96) i = (cid:96) } .
Then for t such that 2 t − 1 > min { 7 η ∞ , 4 w ( f ∗ ) } , we have I t = ∅ .
Let (cid:96) be the integer that OPT n ∈ [2 (cid:96) − 1 , 2 (cid:96) ) , and let (cid:96) be the integer such that min { 7 η ∞ , 4 w ( f ∗ ) } ∈ [2 (cid:96) − 1 , 2 (cid:96) ) .
We partition all demand points with i > τ into groups I ≤ (cid:96) − 1 , I (cid:96) , . .
, I (cid:96) according to (cid:96) i , where I ≤ (cid:96) − 1 = (cid:83) (cid:96) ≤ (cid:96) − 1 I (cid:96) .
Lemma 3.8.
E (cid:104)(cid:80) i ∈ I ≤ (cid:96) − 1 cost M ( x i ) (cid:105) ≤ 2 | X ( f
[Equation]
) | n · OPT .
Proof.
The proof can be found in Section B.
Lemma 3.9.
For every (cid:96) ∈ [ (cid:96), (cid:96) ] , E (cid:2)(cid:80) i ∈ I (cid:96) cost M ( x i ) (cid:3) ≤ 18 (cid:80) i ∈
I (cid:96) d ( x i , f ∗ ) + 32 w ( f ∗ ) .
Proof.
The proof can be found in Section C.
Proof of Lemma 3.5.
We conclude Lemma 3.5 by combining Lemma 3.6, 3.7, 3.8, and 3.9.
(cid:88) i ∈ [ m ]
E [cost M ( x i )] =
E   (cid:88) i ∈ [ τ − 1] cost M ( x i ) 
 + E [cost M ( x τ )]
+ (cid:96) (cid:88) (cid:96) =
(cid:96)
E (cid:34)(cid:88) i ∈
I (cid:96) cost M ( x i ) (cid:35) + (cid:88) i ∈ I ≤ (cid:96) −
E [cost M ( x i )] ≤ 2 w ( f ∗ ) + (cid:32) 2 w ( f ∗ ) +m (cid:88) i
=
d ( x i , f ∗ ) (cid:33) + (cid:96) (cid:88) (cid:96) =
(cid:96) (cid:32) 18 (cid:88) i ∈
I (cid:96) d ( x i , f ∗ ) + 32 w ( f ∗ ) (cid:33) + 2 | X ( f ∗ ) | n · OPT ≤ (cid:0) O ( (cid:96) − (cid:96) ) + O (1) (cid:1) ·   (cid:88) i ∈ [ m ] d ( x i , f ∗ ) + w ( f ∗ ) 
 + 2 | X ( f ∗ ) | n
OPT ≤ O (cid:16) max (cid:110) 1 , log nη ∞ OPT (cid:111)(cid:17) ·   (cid:88) i ∈ [ m ] d ( x i , f ∗ ) + w ( f ∗ ) 

+ O (cid:18) | X ( f ∗ )
| n
OPT (cid:19) .
[Table]
E XPERIMENTS
We validate our online algorithms on various datasets of different types.
In particular, we consider three Euclidean data sets, a) Twitter (Chan et al.), b) Adult (Dua & Graff, 2017), and c) NonUni (Cebecauer & Buzna, 2018) which are datasets consisting of numeric features in R d and the distance is measured by (cid:96) 2 , and one graph dataset, US-PG (Rossi & Ahmed, 2015) which represents
US power grid in a graph, where the points are vertices in a graph and the distance is measured by the shortest path distance.
The opening cost is non-uniform in Non-Uni dataset, while it is uniform in all the other three.
These datasets have also been used in previous papers that study facility location and related clustering problems (Chierichetti et al., 2017; Chan et al., 2018; Cohen-Addad et al., 2019).
A summary of the speciﬁcation of datasets can be found in Table 1.
Tradeoff between η ∞ and empirical competitive ratio. Our ﬁrst experiment aims to measure the tradeoff between η ∞ and the empirical competitive ratio of our algorithm, and we compare against two “extreme” baselines, a) the vanilla Meyerson’s algorithm without using predictions which we call M EYERSON , and b) a naive algorithm that always follows the prediction which we call F OLLOW -P REDICT .
Intuitively, a simultaneously consistent and robust online algorithm should perform similarly to the F OLLOW -P REDICT baseline when the prediction is nearly perfect, while comparable to M EYERSON when the prediction is of low quality.
Since it is NP-hard to ﬁnd the optimal solution to facility location problem, we run a simple 3approximate MP algorithm (Mettu & Plaxton, 2000) to ﬁnd a near optimal solution F (cid:63) for every dataset, and we use this solution as the ofﬂine optimal solution (which we use as the benchmark for the competitive ratio).
Then, for a given η ∞ and a demand point x , we pick a random facility f ∈ F such that η ∞ / 2 ≤ d ( f, F (cid:63)x ) ≤ η ∞ as the prediction, where F (cid:63)x is the point in F (cid:63) that is closest to x .
The empirical competitive ratio is evaluated for every baselines as well as our algorithm on top of every dataset, subject to various values of η ∞ .
All our experiments are conducted on a laptop with Intel Core i7 CPU and 16GB memory.
Since the algorithms are randomized, we repeat every run 10 times and take the average cost.
In Figure 1 we plot for every dataset a line-plot for all baselines and our algorithm, whose x-axis is η ∞ and y-axis is the empirical competitive ratio. Here, the scale of x-axis is different since η ∞ is dependent on the scale of the dataset.
From Figure 1, it can be seen that our algorithm performs consistently better than M EYERSON when η ∞ is relatively small, and it has comparable performance to M EYERSON when η ∞ is so large that the F OLLOW -P REDICT baseline loses control of the competitive ratio.
For instance, in the Twitter dataset, our algorithm performs better than
M EYERSON when η ∞ ≤ 2 , and when η ∞ becomes larger, our algorithm performs almost the same with M EYERSON while the ratio of F OLLOW -P REDICT baseline increases rapidly.
Furthermore, we observe that our performance lead over M ERYERSON is especially signiﬁcant on dataset Non-Uni whose opening cost is non-uniform.
This suggests that our algorithm manages to use the predictions effectively in the non-uniform setting, even provided that the prediction is tricky to use since predictions at “good” locations could have large opening costs.
In particular, our algorithm does a good job to ﬁnd a “nearby” facility that has the correct opening cost and location tradeoff. A simple predictor and its empirical performance.
We also present a simple predictor that can be constructed easily from a training set, and evalute its performance on our datasets.
We assume the predictor has access to a training set T .
Initially, the predictor runs the 3-approximate MP algorithm on the training set T to obtain a solution F ∗ .
Then when demand points from the dataset (i.e.,
[Figure] i t i v [Figure] [Table]
test set)
X arrives, the predictor periodically reruns the MP algorithm, on the union of T and the already-seen test data X (cid:48) ⊆
X , and update F ∗ .
For a demand point x , the prediction is deﬁned as the nearest facility to x in F ∗ .
To evaluate the performance of this simple predictor, we take a random sample of 30% points from the dataset as the training set T , and take the remaining 70% as the test set X .
We list the accuracy achieved by the predictor in this setup in Table 2.
From the table, we observe that the predictor achieves a reasonable accuracy since the ratio of Follow-Predict baseline is comparable to Meyerson’s algorithm.
Moveover, when combining with this predictor, our algorithm outperforms both baselines, especially on the Non-Uni dataset where the improvement is almost two times.
This not only shows the effectiveness of the simple predictor, but also shows the strength of our algorithm.
Finally, we emphasize that this simple predictor, even without using any advanced machine learning techniques or domain-speciﬁc signals/features from the data points (which are however commonly used in designing predictors), already achieves a reasonable performance.
Hence, we expect to see an even better result if a carefully engineered predictor is employed.
A P ROOF OF L EMMA 3.
Lemma A.1 (Restatement of Lemma 3.7) .
E [cost M ( x τ )] ≤
[Equation]
Proof.
We bound the opening cost and connection cost separately.
Opening cost.
By the algorithm, we know for every 1 ≤ i ≤ m ,
[Equation]
Hence, using the fact that at most one facility is opened by Meyerson step for each demand,
[Equation]
This ﬁnishes the analysis for the opening cost.
Connection cost.
We claim that d ( x τ , F ( x τ )) ≤ w ( f ∗ )
+ d ( x τ , f ∗ ) (with probability 1).
Let δ 0 , δ 1 , . .
, δ L be deﬁned as in our algorithm.
{+We assume δ 
+}
=
d ( x τ , ¯ F ( x τ )) > w ( f ∗ ) + d ( x τ , f ∗ ) , as otherwise the claim holds immediately.
Let k :=
max { k : δ k > w ( f ∗ ) + d ( x τ , f ∗ ) } .
Then
[Equation]
Therefore, E [cost M ( x τ )]
=
E [
[Equation]
[Equation]
x τ
[Equation]
which concludes the proof.
B P ROOF OF L EMMA 3.
Lemma B.1 (Restatement of Lemma 3.8) .
E (cid:104)(cid:80)
[Equation]
≤
[Equation]
− 1 cost M
[Equation]
i )
[Equation]
≤ 2 | X ( f ∗ ) |
[Equation]
OPT
[Equation]
Proof.
For i ∈ I ≤ (cid:96) − 1 , we have that its connection cost d ( x i , F ( x i ))
≤ d ( x i , ¯ F ( x i )) ≤ 2 (cid:96) − 1 ≤ OPT n .
Let δ 0 , δ 1 , . .
, δ L and f 1 , . . .
, f L be deﬁned as in our algorithm upon x i ’s arrival.
Then, its expected opening cost in the M
EY step equals
[Equation] OPT [Equation] To sum up,
[Equation] [Equation]
Lemma C.1 (Restatement of 3.9) .
For every (cid:96) ∈ [ (cid:96), (cid:96) ] ,
E
[Equation]
i ∈ I (cid:96) cost
[Equation]
i
[Equation]
Proof.
Recall that we relabeled and restricted the indices of points in X to X ( f ∗ )
= { x 1 , . . .
, x m } .
However, in this proof, we also need to talk about the other points in the original data set (that do not belong to X ( f ∗ ) ).
Hence, to avoid confusions, we rewrite X = { y 1 , . . .
y n } (so y 1 , . .
, y n are the demand points in order), and we deﬁne σ : [ m ] → [ n ] that maps elements x j ∈ X ( f ∗ ) to its identity y i
∈
X , i.e., σ ( j ) = i .
For i ∈ [ n ] , let z
[Equation]
none otherwise , and deﬁne z P i similarly.
Since the M
EY step opens at most one facility, z M i is either a singleton or “none”.
Finally, deﬁne z i :=
z M i ∪ z P
i .
Deﬁne τ (cid:96) =
min { i ∈ [ n ] | z M i (cid:54) =
none and d ( f ∗ , z M i ) < 2 (cid:96) − 1 } , we have E (cid:34)(cid:88)
[Equation]
Next, we prove a stronger version by induction, and the induction hypothesis goes as follows.
For every j ∈ [ n ] ,
[Equation]
where E j = ( z 1 , . .
z j ) .
Clearly, applying this with j = 1 implies (1), hence it sufﬁces to prove this hypothesis.
Base case.
The base case is j = n , and we would do a backward induction on j .
Since we condition on E j − 1 , the variables δ 0 , . .
, δ L in the M
EY step of y j , as well as wether or not j ∈
σ ( I (cid:96) ) , are ﬁxed.
Hence,
[Equation]
This implies
[Equation]
Inductive step.
Next, assume the hypothesis holds for j + 1 , j + 2 , . . . , n , and we would prove the hypothesis for j .
We proceed with the following case analysis.
Case 1: j / ∈ σ ( I (cid:96) ) .
We do a conditional expectation argument, and we have
[Equation]
where the second step follows by induction hypothesis.
Case 2: j ∈ I (cid:96) and 8 d ( y j , f ∗ ) >
d ( f ∗ , ¯ F ( y j )) .
We have
[Equation] Hence E [cost M ( y j ) − 18 d ( y j , f ∗ )] ≤ 0 , and the hypothesis follows from a similar argument as in
Case 1.
Case 3: j ∈ I (cid:96) , and 8 d ( y j , f ∗ ) ≤ d ( f ∗ , ¯ F ( y j )) .
We have
[Equation]
Let D =
{ f : d ( f ∗ , f ) ≥ 2 (cid:96) − 1 } ∪ { none } .
Let k = min { k (cid:48) | δ k (cid:48) ≤ 2 (cid:96) − 2 } .
Then ∀
i ≥ k , d ( f i , f ∗ ) ≤ d ( y j , f i ) + d ( y j , f ∗ ) < 2 (cid:96) − 1 .
[Equation]
is open for some
[Equation]
{+where the second last inequality follows from δ 
+}
=
d ( y j , ¯ F ( y j )) ≤ 2 (cid:96) and w ( f ∗ ) = 2 (cid:96) ∗ − 1 .
Thus,
LHS =
E [cost M ( y j )
| E j −
[Equation]
where the second step follows by induction hypothesis.
In summary, we have
[Equation]
D P ROOF OF L EMMA 3.5: W HEN 7 η ∞ > 4 w ( f ∗ )
The proof is mostly the same as in the other case which we prove in Section 3.1, and we only highlight the key differences.
We use the same deﬁnition for parameters τ , (cid:96) , and (cid:96) .
It can be veriﬁed that Lemma 3.7, 3.8 and 3.9 still holds and their proof in Section 3.1 still works.
However, Lemma 3.6 relies on that 7 η ∞ ≤ 4 w ( f ∗ ) , which does not work in the current case.
We provide Lemma D.2 in replacement of Lemma 3.6, which offers a slightly different bound but it still sufﬁces for Lemma 3.5.
Lemma D.1.
For every i < τ , d ( x i , f ∗ ) ≥ w ( f ∗ ) .
Proof.
We prove the statement by contradiction.
Suppose d ( x i , f ∗ ) < w ( f ∗ ) .
Let δ 0 , δ 1 , . .
, δ W be deﬁned as in our algorithm.
Then, we have
[Equation]
where the last inequality follows from the deﬁnition of τ that d ( f ∗ , ¯ F ( x i )) > 4 w ( f ∗ ) .
Let k = min { k | δ k ≤ 3 w ( f ∗ ) } .
We have k ≥ 1 .
We prove that a facility within a distance of 3 w ( f ∗ ) from x i must be open at this step.
[Equation]
is opened for some j ≥ k ]
[Equation]
where the last inequality uses the fact that δ (cid:96) ∗ ≤ d ( x i , f ∗ ) ≤ w ( f ∗ ) .
Consequently,
[Equation]
which contradicts the deﬁnition of τ .
Lemma
[Equation]
Proof.
On the arrival of x i for each i ∈ [ τ ] , let δ 0 , δ 1 , . . .
, δ L be deﬁned as in our algorithm.
We ﬁrst study the connecting cost of request x i .
We have
[Equation]
We prove this value is at most d ( x i , f ∗ ) + 2 w ( f ∗ ) .
Suppose δ 0 >
d
( x i , f ∗ ) + 2 w ( f ∗ ) , as otherwise the statement holds.
Recall that δ j is non-increasing, let k = min { k | δ k ≤ d ( x i , f ∗ ) + 2 w ( f ∗ ) } .
By the deﬁnition of k , we have that
[Equation]
f [Equation] [Equation] Pr[ f j is opened for some j ≥ k ]
[Equation]
To sum up, we have shown that the connecting cost d ( x i , F ( x i )) ≤ d ( x i , f ∗ ) + 2 w ( f ∗ ) .
Next, we study the expected opening cost E [ w ( ˆ F ( x i ))] .
We have
E [ [Equation] =
[Equation]
By Lemma D. [Equation] we conclude the proof of the statement:
[Equation]
(cid:34)(cid:88) i<
τ d ( x i , f ∗ ) + (2 d ( x τ , f ∗ ) + 4 w ( f ∗ )) (cid:35) ≤ 6 E  (cid:88) i ∈ [ τ ] d ( x i , f ∗ ) 
 + 4 w ( f ∗ ) .
E L OWER B OUND
In the classical online facility location problem, a tight lower bound of O ( log n loglog n ) is established by Fotakis (2008), even for the special case when the facility cost is uniform and the metric space is a binary hierarchically well-separated tree (HST).
We extend their construction to the setting with predictions, proving that when the predictions are not precise (i.e. η ∞ > 0 ), achieving a competitive ratio of o ( log nη ∞ OPT loglog n ) is impossible.
Theorem E.1.
Consider OFL with predictions with a uniform opening cost of 1 .
For every η ∞ ∈ (0 , 1] , there exists a class of inputs, such that no (randomized) online algorithm is o ( log nη ∞ OPT loglog n ) - competitive, even when η 1 = O (1) . Before we provide the proof of our theorem, we give some implications of our theorem. First of all, we normalize the opening cost to be 1 . Consequently, the optimal cost is at least 1 .
Furthermore, we are only interested in the case when η ∞ ≤ 1 . Indeed, the optimal facility for each demand point must be within a distance of 1 , as otherwise, we can reduce the cost by opening a new facility at the demand point. Therefore, we can without loss of generality to study predictions with η ∞ = O (1) .
Without the normalization, our theorem implies an impossibility result of o ( log nη ∞ OPT loglog n ) for online facility location with predictions.
Moreover, recall the deﬁnition of total prediction error η 1 = (cid:80) ni
=1 d ( f pred x i , f opt x i ) , which is at least η ∞ = max i d ( f pred x i , f opt x i ) . Our theorem states that even when the total error η 1 is constant times larger than the opening cost of 1 , there is no hope for a good algorithm. Note that our bound above holds for any constant value of η ∞ .
As an implication, our construction rules out the possibility of an o ( log η 1 OPT loglog n ) -competitive algorithm.
Proof.
By Yao’s principle, the expected cost of a randomized algorithm on the worst-case input is no better than the expected cost for a worst-case probability distribution on the inputs of the deterministic algorithm that performs best against that distribution.
For each η ∞ , we shall construct a family of randomized instance, so that the expected cost of any deterministic algorithm is at least Ω( log nη ∞ OPT loglog n ) -competitive.
We ﬁrst import the construction for the classical online facility location problem by Fotakis (2008).
Consider a hierarchically well-separated perfect binary tree.
Let the distance between root and its children as D .
For every vertex i of the tree, the distance between i and its children is 1 m times the distance between i and its parent.
That is to say, the distance between a height i vertex and its children of height i + 1 is Dm i .
Let the height of the tree be h .
The demand sequence is consisted of h + 1 phases.
For each 0 ≤ i ≤ h , in the ( i + 1) -th phase, m i demand points arrive consecutively at some vertex of height i .
For i ≥ 1 , the identity of the height i vertex is independently and uniformly chosen between the two children of i -th phase vertex.
Consider the solution that opens only one facility at the leaf node that is the ( h +1) -th phase demand vertex and assign all demand points to the leaf.
The cost of this solution equals
[Equation]
This value serves as an upper bound of the optimal cost.
I.e., OPT ≤ 1 + hD mm − 1 .
Next, we describe the predictions associated with the demand points.
Intuitively, we try the best to hide the identity of the leaf node in the last phase.
We denote the leaf node as f ∗ , which is also the open facility in the above described solution.
Our prediction is produced according to the following rule.
When the distance between the current demand point and f ∗ is less than η ∞ , let the prediction be the same as the demand vertex.
Otherwise, let the prediction be the vertex on the path from the current demand point to f ∗ , whose distance to f ∗ equals η ∞ .
We prove a lower bound on the expected cost of any deterministic algorithm.
We ﬁrst overlook the ﬁrst a few phases until the subtree of the current demand vertex has diameter less than η ∞ .
Let it be the h (cid:48)
-th phase.
We now focus on the cost induced after the h (cid:48) -th phase and notice that the predictions are useless as they are just the demand points.
When the m i demand points at vertex of height i comes, we consider the following two cases:
Case 1: There is no facility opened in the current subtree.
Then we either open a new facility bearing an opening cost 1 or assign the current demands to facilities outside the subtree bearing a large connection cost at least D m i − 1 per demand.
So the cost of this vertex is min { 1 , Dm } .
Case 2: There has been at least one facility opened in the current subtree.
Since the next vertex is uniformly randomly chosen in its two children, the expected number of facility that will not enter the next phase subtree is at least 12 .
We call it abandoned.
The expected sum of abandoned facility is 12 of the occurrence of case 2.
Thus the expected cost in every occurrence of case 2 is 12 .
We carefully choose D, m, h so that 1) mD = 1 ; 2) the total number of demand points is n , i.e. h (cid:80) i =
m i = n ; and 3)
Dm h (cid:48)
=
η ∞ .
These conditions give that ( h + 1) log m = log n , ( h (cid:48) + 1) log m = − log η ∞ .
Consequently, h − h (cid:48)
= log nη ∞ log m .
To sum up, an lower bound of any deterministic algorithm is ( h − h (cid:48) )
min { 12 , mD } = Ω (cid:16) log nη ∞ log m (cid:17) , while the optimal cost is at most 1 + hD mm − {+
+} = O (cid:16) log n m log m (cid:17) .
Setting m = log n loglog n , the optimal cost is O (1) . And we prove the claimed lower bound of Ω( log nη ∞ loglog n ) . Finally, it is straightforward to see that the summation of the prediction error η 1 ≤ OPT = O (1) .
Observe that our main error parameter η ∞ could be very sensitive to a single outlier prediction that has a large error. To make the error parameter bahave more smoothly, we introduce an integer parameter 1 ≤ t ≤ n , and deﬁne η ( t ) ∞ as the t -th largest prediction error, i.e., the maximum prediction error excluding the t − 1 high-error outliers. Deﬁne η ( t ) 1 similarly.
In the following, stated in Theorem F.1, we argue that our algorithm, without any modiﬁcation (but with an improved analysis), actually has a ratio of O (log(1 + t ) + log nη ( t ) ∞ OPT ) that holds for every t . This also means the ratio would be min 1 ≤ t ≤ n O (log(1 + t )
+ log nη ( t ) ∞ OPT )
, and this is clearly a generalization of Theorem 1.1, since η ( t ) ∞ =
η ∞ when t = 1 .
Moreover, we note that our lower bound, Theorem 1.2, is still valid for ruling out the possibility of replacing η ( t ) ∞ with η ( t ) 1 in the abovementioned ratio, since one can still apply Theorem 1.2 with t
= 1 .
However, it is an interesting open question to explore whether or not an algorithm with a ratio like O (log t + η ( t ) 1 OPT ) for some speciﬁc t (e.g., t ≥ √ n ) exists.
Theorem F.1.
For every integer≤ t ≤ n , Algorithm 1 is O (log( t + 1) + min { log n, max { 1 , log nη ( t ) ∞ OPT }} ) -competitive.
Proof sketch.
Let Γ =
( γ 1 , γ 2 , . . . , γ t − 1 ) be indices of the t − 1 largest prediction error
d ( f pred x γ , f opt x γ ) .
The high level idea is to break the dataset X into a good part X G :=
{ x i : i ∈ [ n ] \ Γ } and a bad part X B := { x i : i ∈ Γ } according to whether or not the prediction is within the outlier, and we argue that the expected cost of ALG on X G is O ( nη ( t ) ∞ OPT ) times larger than that in OPT, and show the expected cost on X B is O (log( t + 1)) times.
For the good part X G , we let X − ( f ∗ ) :
= X ( f ∗ ) \ Γ and apply a similar analysis as in the proof of
Lemma 3.5 to show that
[Equation]
For the bad part X B , we assume all predictions for points in X B are of inﬁnite error (which could only increase the cost of the algorithm), and let X + ( f ∗ ) :
= X ( f ∗ ) ∩ Γ .
Then this lies in the case of
Section D, where 7 η ∞ > 4 w ( f ∗ ) , which essentially means the prediction is almost useless and the whole proof reverts to pure Meyerson’s algorithm. Combine the arguments from Section D and the analysis for the short distance stage, we have [Equation] We ﬁnish the proof by combining the bound for the two parts.