SlowGuess/NeurIPS_2023_OCR huggingface dataset:
Theorem 2.5. Consider any online covering problem with predictions  $\mathcal{P}$ . Let  $\mathrm{ALG}_1$ ,  $\mathrm{ALG}_2$  be two algorithms for the prize-collecting version of  $\mathcal{P}$  with monotone (online amortized) costs  $\mathrm{OA}_1$ ,  $\mathrm{OA}_2$  respectively such that (a)  $\mathrm{ALG}_1$  is Lagrangian  $\beta_1$ -subset-competitive using  $\mathrm{OA}_1$  w.r.t. the prediction  $S$ , and (b)  $\mathrm{ALG}_2$  is Lagrangian  $\beta_2$ -subset-competitive using  $\mathrm{OA}_2$  (against general OPT).
Then there exists ALG for  $\mathcal{P}$  such that for every partition of the input  $Q$  into  $Q_{1}, Q_{2}$  we have
$$
\operatorname {A L G} (Q) \leq O (\beta_ {1}) \cdot \operatorname {O P T} _ {S} (Q _ {1}) + O (\beta_ {2}) \cdot \operatorname {O P T} (Q _ {2})
$$
We later show that Theorem 2.5 implies Equation (6) for facility location and set cover.
3 Online Facility Location
In this section, we consider metric, nonuniform facility location with predictions and present a novel prize-collecting algorithm TREEPROXY. This algorithm is Lagrangian  $O(\log |S|)$ -subset-competitive w.r.t. the prediction  $S$  of possible facilities; thus, it is used in our framework to prove Theorems D.2 and D.3, which in turn imply Theorems 1.1 and 1.2, respectively. In addition, TREEPROXY is a result independent of our framework/predictions: the competitiveness guarantee shown for TREEPROXY also achieves  $O(\log m)$  competitiveness where  $m = |X|$  is the size of the metric space. We prove the following theorem:
Theorem 3.1. For facility location with predictions, there exists a randomized prize-collecting algorithm ALG with a monotone online amortization OA which is Lagrangian  $O(\log |S|)$ -subset competitive using OA w.r.t.  $S$ .
3.1 The Algorithm
Weighted hierarchically-separated trees (HSTs). The algorithm starts by embedding the metric space into the leaves of a weighted 3-HST, a metric space in which edge weights decrease at least exponentially as one descends from the root.
Definition 3.2. For  $\gamma >1$ , a rooted tree with weights  $c$  to the edges is a weighted  $\gamma$ -HST if for every two edges  $e_1,e_2$  such that  $e_2$  is a parent edge of  $e_1$ , it holds that  $c(e_{2})\geq \gamma c(e_{1})$ .
The following result is often used for embedding general metric spaces into weighted HSTs; it involves composing the embeddings of Fakcharoenphol et al. [17] and Bansal et al. [12].
Theorem 3.3 (Due to [17] and [12]). For every metric space  $(X, \delta)$  and constant  $\gamma$ , there exists a distribution  $\mathcal{D}$  over weighted  $\gamma$ -HSTs of depth  $O(\log |X|)$  in which the points in  $X$  are the leaves of the HST, such that for every two points  $x_1, x_2 \in X$  we have:
1.  $\delta (x_{1},x_{2})\leq \delta_{T}(x_{1},x_{2})$  for every  $T$  in the support of  $\mathcal{D}$
2.  $\mathbb{E}_{T\sim \mathcal{D}}[\delta_T(x_1,x_2)]\leq O(\log |X|)\cdot \delta (x_1,x_2).$
The algorithm starts by embedding the induced metric space of  $S$  into a weighted HST using Theorem 3.3;  $T$  denotes the resulting tree, and  $r$  denotes its root. For each edge  $e \in T$ , we denote by  $c(e)$  the cost of the edge  $e$ . Denote the set of leaves in the subtree rooted at  $\nu$  by  $L(\nu)$ ; note that  $L(r) = S$ . Denote the distance between two nodes  $u, \nu$  in the tree by  $\delta_T(u, \nu)$ . For every point  $u \in X$ , define  $p(u) \coloneqq \arg \min_{u' \in S} \delta(u, u')$ ; that is,  $p(u)$  is the closest predicted point to  $u$  (abusing notation, we similarly define  $p(q)$  for request  $q$ ).
Proxy list. After embedding  $S$  into the leaves of a tree, the algorithm must open facilities on those leaves to serve requests. Intuitively, at any point the algorithm considers some (possibly internal) node  $\nu \in T$ , and considers connecting the current request through  $\nu$  to a facility in  $L(\nu)$ . Choosing from  $L(\nu)$  introduces a tradeoff between the cost of opening the facility and its distance from  $\nu$ . For every  $\nu$ , we identify the leaves in  $L(\nu)$  which offer the best points in this tradeoff (i.e., a Pareto frontier), and only allow the algorithm to choose from these leaves. This subset is called the proxy list of  $\nu$ , and denoted  $P(\nu) \subseteq L(\nu)$ .
We now define the proxy list  $P(\nu)$ . For ease of notation, define the logarithmic class operator  $\ell(x) \coloneqq \lfloor \log x \rfloor$ . For node  $\nu \in T$ , we construct the proxy list  $P(\nu) \subseteq L(\nu)$  as follows:
1. Start with  $V \gets L(v)$ .
2. While there exist distinct  $\nu_{1}, \nu_{2} \in V$  such that  $\ell(o_{\nu_{1}}) \geq \ell(o_{\nu_{2}})$  and  $\ell(\delta_{T}(\nu, \nu_{1})) \geq \ell(\delta_{T}(\nu, \nu_{2}))$ , remove  $\nu_{1}$  from  $V$ .
3. Output  $V$  as  $P(\nu)$
We denote by  $k(\nu)$  the size of the proxy list  $P(\nu)$ . We order the proxy list of  $\nu$  by increasing facility cost, thus writing  $P(\nu) = (s_1^\nu, \dots, s_{k(\nu)}^\nu)$ . For every  $\nu, i$ , we use the shorthands  $o_i^\nu \coloneqq o_{s_i^\nu}$  and  $\delta_i^\nu \coloneqq \delta_T(\nu, s_i^\nu)$ . Slightly abusing notation, for every node  $\nu \in T$  we define  $c(\nu) \coloneqq c(e_\nu)$  where  $e_\nu$  is the edge connecting  $\nu$  to its parent node (for  $r$ , we define  $c(r) = \infty$ ). For a more streamlined notation, for every node  $\nu \in T$  we define  $\delta_0^\nu \coloneqq c(\nu)$  and  $o_{k(\nu)+1}^\nu \coloneqq \infty$ .
Observation 3.4. For every node  $\nu \in T$ , the proxy list  $P(\nu)$  satisfies:
1. For every  $u\in L(\nu)$  , there exists index i such that  $\ell (o_i^\nu)\leq \ell (o_u)$  and  $\ell (\delta_i^{\nu})\leq \ell (\delta_T(\nu ,u))$
2. For every distinct  $1 \leq i < j \leq k(v) + 1$ , it holds that  $\ell(o_i^\nu) < \ell(o_j^\nu)$ .
3. For every distinct  $0 \leq i < j \leq k(\nu)$ , it holds that  $\ell(\delta_i^\nu) > \ell(\delta_j^\nu)$ .
When  $i = 0$ , the third item in Observation 3.4 uses the fact that  $T$  is a weighted 3-HST; thus, the cost of an edge is at least twice the distance from the child node of that edge to any descendant leaf.
Counters. For every node  $\nu$  and every  $i \in \{1, \dots, k(\nu) + 1\}$ , we define a counter  $\lambda(\nu, i)$  of size  $o_i^\nu$ .
Algorithm description. The algorithm for facility location with predictions is given in Algorithm 2. Initially, the algorithm embeds the metric space induced by  $S$  into a weighted 3-HST  $T$ , using Theorem 3.3; upon each node in this  $T$  the proxy lists are computed, and the corresponding counters are assigned. Upon the release of a request  $(q, \pi)$ , the function UPONREQUEST is triggered. Upon receiving  $(q, \pi)$ , it maps the request to the closest point  $p(q)$  in  $S$  (that is, a leaf of the HST). Then, the algorithm attempts to solve the request on the HST through a process of increasing counters, which we soon describe. (While the described algorithm raises these counters continuously, the process can easily be discretized, replacing the continuous growth with jumping discretely to the next event.) The algorithm keeps track of (some measure of) the cost involved; if during UPONREQUEST that amount exceeds the penalty  $\pi$ , the algorithm pays the penalty instead (see Line 9).
When solving the request on  $u = p(q)$ , the algorithm climbs up the branch of  $u$ , until a facility is found (or opened) to connect  $u$ . At each ancestor  $v$  of  $u$ , the algorithm invests a growing amount  $\tau_v$  in advancing the proxy list of  $v$  (i.e., buying a facility in  $P(v)$  closer to  $v$ ). It raises the counter for the next item on the proxy list until full, at which point the relevant proxy facility is opened, and the next counter in the proxy list begins to increase. (Note that the same facility can be "opened" more than once due to being on multiple proxy lists.) Once  $\tau_v$  reaches the cost of connecting  $v$  to an open proxy, the algorithm stops increasing counters and makes the connection. When no proxy in  $P(v)$  is open, it could be that  $\tau_v$  exceeds the cost of moving from  $v$  to its parent  $p(v)$ ; in this case, we ascend the branch and explore proxies for  $p(v)$ . Note that the function UPONREQUEST of Algorithm 2 also returns a value; this return value is the online amortization cost of the request, to be used in the analysis of the algorithm. (See Figure 1 for an example.)
The analysis of Algorithm 2, and the proof of Theorem 3.1, appear in Appendix A.
Algorithm 2: TREEPROXY for Prize-Collecting Facility Location with Pre-dictions
1	Initialization
2	Embed the prediction S into a weighted 3-HST T using Theorem 3.3.
3	For every v ∈ T, and every i ∈ {1,···, k(v) + 1}, set λ(v, i) ← 0.
4	For every v ∈ T, set t(v) ← 0.
5	Event Function UPONREQUEST(q, π) // Upon the next request q with penalty π in the sequence
6	Define u, v ← p(q).
7	Define τ ← 0, τv ← 0.
8	continually increase τ, τv and λ(v, t(v) + 1) at the same rate until:
9	if τ + δ(u, q) ≥ π then // cost for request exceeds penalty; pay penalty instead.
10	Pay the penalty π for the request.
11	return τ + π. // return amortized cost.
12	if λ(v, t(v) + 1) = o′t(v)+1 then // counter for next proxy is full; open facility at proxy.
13	Open a facility at s′t(v)+1.
14	Increment t(v).
15	goto Line 8.
16	if τv ≥ δ′t(v) then
17	if t(v) = 0 then
18	// escalate the request to parent node.
19	Set v ← p(v).
20	Define τv ← 0.
21	goto Line 8.
22	Connect q to s′t(v). // connect request to closest proxy.
23	return τ + (τ + δ(u, q)). // return amortized cost.
Figure 1: A possible state of Algorithm 2, immediately before connecting a request  $q$ . Here,  $q$  has been mapped to  $u$ , which is the closest point in  $S$ . The variable  $\nu$ , an ancestor of  $u$ , is shown, as is its proxy list  $s_1^\nu, s_2^\nu, s_3^\nu$ . The counters of the proxy list are also shown:  $\lambda(\nu, 1)$  is full (and a facility thus exists in  $s_1^\nu$ ), and  $\lambda(\nu, 2)$  is partial (the last counter to be raised handling  $q$ ). At some point, the growth in the counters of  $\nu$  exceeded the distance from  $\nu$  to  $s_1^\nu$ , and thus the connection of  $q$  to  $s_1^\nu$  is made.
Algorithm 3: Online Prize-Collecting Fractional Set Cover
1 Initialization
2 Set  $x_{s}\gets 0$  for every set  $s$
3 Event Function UPONREQUEST  $(q,\pi)$
4 Set  $y_{q}\gets 0$
5 while  $\sum_{s\in U(q)}x_s\leq 1$  do
6 Set  $y_{q}\gets y_{q} + 1$
7 if  $\pi \leq y_{q}$  then
8 | | | Pay penalty  $\pi$  for  $q$ .
9 | return OA(q,π) = 3π.
10 | foreach  $s \in U(q)$  do
11  $\left\| \begin{array}{l}\big{\lfloor}x_{S}\gets x_{S}\cdot \left(1 + \frac{1}{c_{s}}\right) + \frac{1}{|U(q)|c_{s}} \end{array} \right.$
12  $\begin{array}{r}\boxed{\mathrm{return~OA}(q,\pi)} = 2y_q. \end{array}$
4 Online Set Cover
In this section, we present and analyze an algorithm for prize-collecting fractional set cover which uses the well-known multiplicative updates method, and show that it is Lagrangian subset-competitive. Using this algorithm together with Algorithm 1 yields Theorem 1.3 (the proof appears in Appendix C).
Preliminaries. In prize-collecting fractional set cover, we are given a universe with elements  $E$  and sets  $U$ ; we define  $m := |U|$ . A solution may fractionally buy sets, according to a cost function  $c$ . Requests then arrive online, where each request is for covering some element  $e \in E$ , which is contained in some subfamily of sets from  $U$ . To cover an element, an algorithm must hold fractions of sets containing  $e$  which sum to at least 1. Observe that fractional set cover with predictions conforms to the definition of an online covering problem with predictions; in this problem, the items are the sets. For prize-collecting fractional set cover, we prove the following theorem.
Theorem 4.1. There exists a deterministic algorithm ALG for prize-collecting fractional set cover that ALG is Lagrangian  $O(\log m)$ -subset-competitive
Theorem 4.1 implies that, in the framework of Algorithm 1, our algorithm can be used as the general component, independent of the prediction. But, given a prediction  $S \subseteq U$ , we can simply restrict the
family of sets used by the algorithm to the given prediction, yields an algorithm competitive against  $\mathrm{OPT}_S$ . Thus, Theorem 4.1 immediately yields the following corollary.
Corollary 4.2. There exists a deterministic algorithm ALG for prize-collecting fractional set cover such that ALG is Lagrangian  $O(\log m')$ -subset-competitive w.r.t. prediction  $S \subseteq U$ , where  $|S| = m'$ .
The Algorithm. The algorithm for prize-collecting set cover is given in Algorithm 3. The algorithm follows the standard multiplicative updates method: while the pending request is uncovered, sets containing that request are bought at an exponential rate (see [2, 15]). However, in this prize-collecting version, the algorithm never lets its cost for a specific request exceed its penalty. For ease of notation, define  $U(q)$  to be the collection of sets containing  $q$ ; that is,  $U(q) \coloneqq \{s \in U | q \in s\}$ .
Analysis. Where the input  $Q$  is fixed, and for  $(q,\pi)\in Q$ , we use  $\mathrm{ALG}(q,\pi)$  as a shorthand for  $\mathrm{ALG}(\{(q,\pi)\} |Q)$ ; i.e., the cost of ALG when handling the request  $(q,\pi)$  as part of  $Q$ . We prove the two following lemmas:
Lemma 4.3. For every  $(q,\pi)\in Q$ , it holds that  $\mathrm{ALG}(q,\pi)\leq 3\pi$
Lemma 4.4. For every subset  $Q' \subseteq Q$ , we have  $\mathrm{ALG}(Q'|Q) \leq O(\log m) \cdot \mathrm{OPT}(\overline{Q'})$ , where  $\overline{Q'}$  is the non-prize-collecting input formed from  $Q'$ .
These two lemmas imply penalty-robust subset competitiveness, a property shown in Proposition C.2 to be equivalent to Lagrangian subset-competitiveness. Thus, we focus on proving these lemmas; note that the proof of Lemma 4.4 appears in Appendix F.
Proposition 4.5. In every iteration of UPONREQUEST(q,π), it holds that the total buying cost is at most  $2y_{q}$ , where  $y_{q}$  is the final value of the variable of the same name.
Proof. Consider each time  $y_{q}$  is incremented. The total cost of buying sets is the following.
$$
\sum_ {s \in U (q)} c _ {s} \cdot \left(x _ {s} \cdot \frac {1}{c _ {s}} + \frac {1}{| U (q) | c _ {s}}\right) = 1 + \sum_ {s \in U (q)} x _ {s} \leq 2
$$
where the inequality is due to the fact that  $\sum_{s\in U(q)}x_s\leq 1$ . Thus, each time  $y_{q}$  is incremented by 1, the cost of buying sets is at most 2, completing the proof.
Proof of Lemma 4.3. Consider UPONREQUEST(q,π). If it returned through Line 11, it holds that  $y_{q} \leq \pi$ ; Proposition 4.5 shows that the total buying cost was thus at most  $2\pi$ , and this cost is also ALG(q,π). Otherwise, the function returned through Line 8; in this case, since  $y_{q}$  was incremented immediately before comparing  $y_{q}$  to  $\pi$ , the argument from the proof of Proposition 4.5 implies that the total buying cost is at most  $2(y_{q} - 1)$  (using the final value of  $y_{q}$ ). In turn, this is at most  $2\pi$ . In addition, the algorithm paid the penalty of  $\pi$ ; overall,  $\mathrm{ALG}(q,\pi) \leq 3\pi$ .
Proof of Theorem 4.1. Lemma 4.3 and Lemma 4.4 show that the algorithm is  $O(\log m)$ -PRSC; Proposition C.2 then yields that the algorithm is Lagrangian  $O(\log m)$ -subset-competitive.
Input Generation. Our set cover instances contain 100 elements. (The number of sets will vary in the experiments.) Every set contains every element with some constant probability  $\alpha$  (we choose  $\alpha = 0.02$ ); that is, the input is represented by a random bipartite graph in which each edge manifests independently. Since this may not cover every element, we also add singleton sets for all elements. We generate random costs for the sets, independently drawn from a log-normal distribution ( $\mu = 0, \sigma = 1.6$ ). For a given input, we generate a prediction in the following way:
1. Using an LP solver, we obtain an optimal fractional solution to the problem instance.
2. We randomly round the solution, such that every set appears in the prediction with probability proportional to its value in the fractional solution.
3. We apply noise to the prediction, of two types: false-positive noise, in which every set is added to the prediction with some probability  $p$ ; and false-negative noise, in which every set is removed from the prediction with some probability  $q$ . (The reader should think of  $p$  and  $q$  as the classification error where the predictions were generated using a classifier.)
p,q	ON
comp. ratio	PREDON
comp. ratio	BASEMERGE
comp. ratio	SMOOTHMERGE
comp. ratio
0,0	6.007 (0.244)	1.689 (0.070)	3.102 (0.565)	2.779 (0.122)
0,0.15	6.007 (0.244)	46.815 (54.436)	6.246 (1.516)	3.820 (0.555)
0,0.3	6.007 (0.244)	96.156 (76.196)	7.093 (1.358)	4.824 (0.687)
0.005,0	6.007 (0.244)	1.989 (0.106)	3.648 (0.630)	3.251 (0.184)
0.005,0.15	6.007 (0.244)	25.983 (30.294)	6.597 (1.642)	4.200 (0.534)
0.005,0.3	6.007 (0.244)	51.533 (43.375)	7.543 (1.541)	5.120 (0.642)
0.02,0	6.007 (0.244)	2.631 (0.154)	4.489 (0.660)	4.240 (0.266)
0.02,0.15	6.007 (0.244)	10.555 (7.549)	7.007 (1.496)	5.024 (0.498)
0.02,0.3	6.007 (0.244)	17.588 (9.549)	8.156 (1.433)	5.760 (0.569)
Table 1: Competitive ratios for varying  $p, q$ , in a "mean (standard deviation)" format. Best values in each row are underlined.
Figure 2: The competitive ratio for varying numbers of sets.
4. Finally, we add the singleton sets to the prediction, to ensure that the prediction covers all elements.
Baselines and evaluation. We evaluate our algorithm described in Section 4, denoted SMOOTHMERGE, against three baselines: the standard online algorithm without predictions, denoted ON; the online algorithm restricted to predicted sets, denoted PREDON; and the standard merging BASEMERGE of those two algorithms, which alternates between ON and PREDON whenever the overall cost doubles. For every choice of parameters, we measure the costs of the four algorithms; these costs are then averaged over 300 different random inputs. We then measure the expected competitive ratio of each algorithm. Our experiments were run on an AWS EC2 r5.16xlarge machine.
We ran the following experiments: (a) we vary the false-positive rate  $p$  and the false-negative rate  $q$  keeping the number of sets fixed at 10000 (Table 1), and (b) we vary the number of sets in the input, fixing  $p = 0.005$ ,  $q = 0.15$  (Figure 2).
Experimental Results. We ran two sets of experiments. In the first experiment, we varied the false-positive rate  $p$  and the false-negative rate  $q$  keeping the number of sets fixed at 10000. The results are reported in Table 1. We note that our algorithm SMOOTHMERGE outperforms the standard merging algorithm BASEMERGE and the online algorithm without predictions ON consistently across all values of  $p, q$ . SMOOTHMERGE also outperforms PREDON, the online algorithm restricted to the prediction, except when there are no false negatives, i.e.,  $q = 0$ . This is to be expected because  $q = 0$  implies that there is a good solution contained in the prediction. When  $q > 0$ , PREDON fails miserably and our algorithm SMOOTHMERGE obtains a competitive ratio that is an order of magnitude better than PREDON. This demonstrates the lack of robustness of PREDON because it is specifically tuned to correct predictions.
In the second set of experiments, we varied the number of sets in the input fixing the noise rates  $p = 0.005$ ,  $q = 0.15$ . The results are reported in Figure 2. Our algorithm SMOOTHMERGE consistently outperforms all the baseline algorithms. In particular, it is able to utilize predictions to outperform ON, which the standard merging BASEMERGE is unable to achieve. Moreover, as the number of sets in the input grows, the gap between the two merging solutions increases.
In this paper, we presented a novel framework for smooth interpolation between robustness and consistency guarantees in learning-augmented online algorithms, and applied it to set cover and facility location. More broadly, predictions for online algorithms are of two forms: prediction of the input and that of the solution. The notion of discrete-smoothness applies to any online combinatorial problem in the latter category, i.e., where a solution is provided in the form of a prediction to the algorithm. Many problems have been considered in this model including rent or buy problems, scheduling, matching, graph problems, etc. For all of these problems, the discrete-smoothness framework alleviates the need for problem-specific notions of prediction error and instead gives a common framework for arguing about the gradual degradation of solution quality with increase in prediction error. We hope that the current work will streamline the desiderata for learning-augmented online algorithms by adding this problem-independent notion of smoothness to the established (and also problem-independent) properties of consistency and robustness.
YA was supported in part by the Israel Science Foundation (grant No. 2304/20). DP was supported in part by NSF awards CCF-1750140 (CAREER) and CCF-1955703.
[40] Alexander Wei. Better and simpler learning-augmented online caching. In Jaroslaw Byrka and Raghu Meka, editors, Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques, APPROX/RANDOM 2020, August 17-19, 2020, Virtual Conference, volume 176 of LIPIcs, pages 60:1-60:17. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 2020.
[41] Alexander Wei and Fred Zhang. Optimal robustness-consistency trade-offs for learning-augmented online algorithms. In Hugo Larochelle, Marc'Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
[42] Chenyang Xu and Benjamin Moseley. Learning-augmented algorithms for online steiner tree. In Thirty-Sixth AAAI Conference on Artificial Intelligence, AAAI 2022, Thirty-Fourth Conference on Innovative Applications of Artificial Intelligence, IAAI 2022, The Twelveth Symposium on Educational Advances in Artificial Intelligence, EAAI 2022 Virtual Event, February 22 - March 1, 2022, pages 8744-8752. AAAI Press, 2022.
A Analysis of Algorithm 2
For this analysis section, we fix any input  $Q = ((q_{1},\pi_{1}),\dots ,(q_{n},\pi_{n}))$ . For both ALG and  $\mathrm{OPT}_S$  we use the superscript f to refer only to facility opening costs and c to refer only to connection costs. We denote by  $\mathrm{OA}(q,\pi)$  the value returned by UPONREQUEST in Algorithm 2 upon receiving the pair  $(q,\pi)$ ; we choose  $(\mathrm{OA}(q,\pi))$  as the online amortization of Algorithm 2.
Online Amortization. First, we show that the cost of the algorithm is bounded by the online amortization:
Lemma A.1. It holds that  $\mathrm{ALG}(Q)\leq \mathrm{OA}(Q)$
Proof. We use the subscript  $q$  to refer to the final value of a variable in UPONREQUEST( $q, \pi$ ). The cost of the algorithm has the following three components:
1. Penalties paid.
2. Opening costs for facilities in  $S$ .
3. Connection costs for facilities in  $S$ .
Let  $Q' \subseteq Q$  be the set of requests served by the algorithm (i.e., no penalty was paid).
Penalties for requests in  $Q \backslash Q'$ . Consider that whenever a penalty  $\pi$  is paid for a request in Line 10, the additive term  $\pi$  appears in the amortized cost of that request. We charge the penalty cost to that term.
Opening cost. Note that a facility  $s_i^\nu$  is only opened (at cost  $o_i^\nu$ ) when the counter  $\lambda(\nu, i)$  reaches  $o_i^\nu$ , and that counter is never used again; thus, the total opening cost can be charged to the sum over request  $q$  of the amount by which request  $q$  raises counters, which is  $\tau_q$ . We charge this to the term  $\tau_q$  in  $\mathrm{OA}(q, \pi)$ .
Connection cost for requests in  $Q'$ . Suppose a request  $(q, \pi) \in Q'$  is connected to some point  $w \in S$ . There exists an index  $i$  such that  $w = s_i^{v_q}$ . It holds that
$$
\delta (q, w) \leq \delta (q, u _ {q}) + \delta (u _ {q}, w) \leq \delta (q, S) + \delta_ {T} (u _ {q}, w) \leq \delta (q, S) + \delta_ {T} (u _ {q}, v _ {q}) + \delta_ {T} (v _ {q}, w). \tag {7}
$$