Abstract 1 Introduction 2 Preliminaries 3 Online prize-collecting set cover 4 Rent-or-Buy for node-weighted Steiner forest References

To Buy or Not to Buy: Online Rent-Or-Buy on Node-Weighted Graphs

Sander Borst ORCID Max-Planck Institute for Informatics, Saarland Informatics Campus, Saarbrücken, Germany Moritz Venzin ORCID Bocconi University, Milan, Italy
Abstract

We study the rent-or-buy variant of the online Steiner forest problem on node- and edge-weighted graphs. For n-node graphs with at most n¯ nodes of non-zero weight, and at most k~ different arriving terminal pairs, we obtain the following:

  • A deterministic, O(lognlogn¯)-competitive algorithm against adaptive adversaries. This improves on the previous best, O(log4n)-competitive algorithm obtained by the black-box reduction from [5] combined with the previously best deterministic algorithms for the simpler “buy-only” setting.

  • A deterministic, O(n¯logk~)-competitive algorithm against adaptive adversaries. This generalizes the O(logk~)-competitive algorithm for the purely edge-weighted setting from [24].

  • A randomized, O(logk~logn¯)-competitive algorithm against oblivious adversaries. All previous approaches were based on the randomized, black-box reduction from [3] that achieves a O(logk~logn)-competitive ratio when combined with an algorithm for the “buy-only” setting.

Our key technical ingredient is a novel charging scheme to an instance of online prize-collecting set cover. This allows us to extend the witness-technique of [24] to the node-weighted setting and obtain refined guarantees with respect to n¯, already in the much simpler “buy-only” setting.

Keywords and phrases:
online network design, node-weighted Steiner forest, derandomization
Copyright and License:
[Uncaptioned image] © Sander Borst and Moritz Venzin; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Online algorithms
Related Version:
Full Version: https://arxiv.org/abs/2507.08698
Editors:
Meena Mahajan, Florin Manea, Annabelle McIver, and Nguyễn Kim Thắng

1 Introduction

The Steiner forest problem is a cornerstone of network design. Given a graph G=(V,E) and pairs of terminals TV×V, the goal is to select a minimum weight subgraph that connects each pair. In the online, node-weighted setting, there is a cost function c:V0 on the vertices of the graph, and terminal pairs arrive one-by-one. After every arrival, we need to ensure that the pair is connected. Crucially, decisions cannot be altered in hindsight, i.e. we must augment a set of selected vertices so that their induced subgraph connects all arrived pairs so far. The goal is to minimize the total cost of selected vertices. In this paper, we consider the online node-weighted Steiner forest problem in the rent-or-buy setting. Given some parameter M, every vertex can either be rented at cost cv, in which case, we may only use it to connect the current pair of terminals, or bought at cost Mcv, in which case it may be used indefinitely from then on. The goal is to minimize the total cost of rented vertices and bought vertices. More specifically, the aim is to minimize the competitive ratio; the supremum of the ratio between the cost of the online algorithm, and the minimum cost of any feasible solution, for any sequence of terminal pairs.

This problem is centrally situated between several prominent problems in (online) network design. Indeed, the node-weighted setting sits between the edge-weighted setting and the directed setting111To reduce the edge-weighted to the node-weighted setting, we replace each edge by an unweighted edge subdivided by a node of node-weight equal to the original edge-weight. To reduce the node-weighted to the directed setting, we turn each edge into two (unweighted) directed edges, and split each vertex into vin and vout. For each vertex v, we direct all incoming edges to vin, all outgoing edges from vout, and set the weight of the directed edge vin to vout to be cv.. On the other hand, the rent-or-buy setting generalizes over the simpler “buy-only” setting, and serves as a stepping stone for the even more general buy-at-bulk setting.222The cost of selecting x times an edge/vertex of cost c is f(x)c, for some concave function f(). The rent-or-buy setting is a special case by setting f(x):=min{x,M}. The buy-only setting corresponds to f(x):=min{x,1}. The latter is often also referred to as multicommodity buy-at-bulk. There have been considerable efforts in devising online algorithms for these problems, both for the Steiner forest and the less general Steiner tree setting. We summarize those algorithmic results in Table 1.

Table 1: State of the art competitive ratios for online network design. The number of vertices in the graph is denoted by n, the number of arriving terminal pairs by k, and the number of distinct terminal pairs by k~. Ratios written with a Θ() are asymptotically tight. Results marked with are only valid for the case of single-source (e.g. analog to Steiner tree). Results marked with a dice are randomized, the corresponding competitive ratio holds in expectation over the random bits of the algorithm. Results marked with only hold against oblivious adversaries, e.g. the adversary cannot observe the algorithms actions and choose the next request adaptively. The algorithm for online directed buy-at-bulk only applies to single-source buy-at-bulk, the version for multicommodity being at least as hard as Label Cover, [13]. It runs in quasi-polynomial time .

The rent-or-buy setting is a common theme in decision making. Problems such as ski-rental, TCP-acknowledgment, snoopy caching or the parking permit problem, are prototypical examples, see for instance [19, 20, 22]. More related to the context of network design is the file replication problem, which corresponds to a rent-or-buy problem on a tree, see [8, 4]. The first to study the rent-or-buy setting in the context of Steiner problems were Awerbuch, Azar and Bartal, see [3]. In fact, they show that for any online problem that can be cast as a type of metrical task system, network design problems being a particular case, there is a simple procedure to adapt an online algorithm to the rent-or-buy setting. More specifically, given any online algorithm that is c-competitive against adaptive online adversaries in the buy-only setting, their procedure yields a randomized online algorithm for the rent-or-buy setting, that is O(c)-competitive against adaptive online adversaries.333In Section 2.3 we give a formal overview of the adversarial settings. Subsequently, this was further extended to yield a deterministic procedure that yields a O(c2)-competitive deterministic online algorithm, see [5].

Using these two procedures and the corresponding algorithms from the edge-weighted setting, see [18, 6], this directly yields a Θ(logk~)-competitive randomized online algorithm for Steiner forest in the rent-or-buy setting, as well as an O(log2k~)-competitive deterministic algorithm. Here, we denote by k~ the number of distinct terminal pairs, as opposed to the buy-only setting, terminal pairs may reappear. Later, a Θ(logk~)-competitive deterministic online algorithm was given in [24].

Contrary to the edge-weighted setting, the competitive ratios of all known algorithms for online node-weighted Steiner problems (in the buy-only setting) depend on whether the adversary is adaptive or oblivious (non-adaptive). The first approaches were inherently randomized and only hold against oblivious adversaries, [23, 16]. The subsequent algorithm from [16], was then made deterministic at a small loss, by giving a deterministic online algorithm for non-metric facility location, see [7]. Consequently, since any deterministic online algorithm is competitive against adaptive adversaries, combined with the procedure from [3], this yielded the first randomized O(log2nlogk~)-competitive algorithm for node-weighted Steiner forest in the rent-or-buy setting. The most recent online algorithm for node-weighted Steiner forest achieves a competitive ratio Θ(logklogn) against oblivious adversaries. It can be derandomized, resulting in a competitive ratio of Θ(log2n), see [10]. We note that these two bounds are analogous to (and match) the Θ(logklogm)- resp. Θ(lognlogm)-competitive ratios for online Set Cover in the randomized / deterministic setting444(Online) Set Cover reduces to (online) node-weighted Steiner forest / tree. k corresponds to the number of arriving elements / pairs of arriving terminals, m to the number of vertices in the graph / sets, and n to the number of possible elements / possible pairs of terminals (n=(m2)). See [10, Section 2.2] for an illustration.. Moreover, these competitive ratios are optimal for polynomial-time algorithms, and they are almost tight even in the absence of computational restrictions [1, 21, 11]. In particular, from the reduction from online Set Cover it follows that it is not possible to obtain a competitive ratio of O(logklogn) against adaptive adversaries.

Applying the procedures from [3, 5] to the deterministic algorithm from [10] in a black-box way, we obtain a deterministic O(log4n) online algorithm, as well as a randomized, O(log2n)-competitive online algorithm. It is also possible to do the same for the randomized version of this algorithm, yielding an O(logk~logn)-competitive algorithm. However, this needs a more careful argument. We will elaborate on this in Section 1.3.

This leaves quite a gap between the randomized and the deterministic setting. As suggested by the edge-weighted setting, it might indeed be possible to completely match the respective competitive ratios from the buy-only setting. In this paper we confirm this. In fact, we obtain a refined bound which depends on n¯, the number of nodes of non-zero weight555This also applies to nodes of small degree: any node v with constant degree can be replaced by a node with node-weight 0, where we add cv to its incident edge-weights. This increases the overall cost by at most a constant.. Our main result is a deterministic, O(lognlogn¯)-competitive online algorithm for Steiner forest in the rent-or-buy setting. This even improves over the respective algorithm in [10] for the buy-only setting. It can be modified to give a deterministic O(n¯logk~)-competitive algorithm, which generalizes the deterministic algorithm of [24] to the edge- and node-weighted setting. Finally, our last result is a randomized, O(logk~logn¯)-competitive algorithm against oblivious adversaries.

1.1 Our results

We now formally present our results. We consider edge- and node-weighted graphs with n vertices, denote by n¯ the number of nodes with non-zero node-weight, and denote by k~ the number of distinct terminals pairs arriving.

All our results are obtained through the same algorithmic framework, but using three different algorithms for prize-collecting set cover as a subroutine. We present the three resulting results separately.

Theorem 1.

There is a deterministic, polynomial-time online algorithm for node-weighted Steiner forest in the rent-or-buy setting which is O(lognlogn¯)-competitive against an adaptive adversary. If the terminal pairs are known to come from some subset TV×V, the competitive ratio can be improved to O(log|T|logn¯).

We consider this to be our main result. All previously known deterministic algorithms use [5], and were a multiplicative factor of O(log2n) worse than the corresponding randomized version. This result closes this gap. We also note that it matches the currently best deterministic algorithm for the buy-only version (e.g. the special case M=1) from [10], and even slightly improves on it, as the dependency is now with respect to logn¯, instead of logn.

The competitive ratio can be slightly improved to O(logk~logn¯), to depend on the number of distinct, actually arriving terminals pairs k~, instead of the number of distinct terminal pairs |T| that could arrive. However, to do so, it is necessary to rely on randomization, as already demonstrated in the corresponding lower bounds for online set cover in [2]. This again matches (and slightly improves) the corresponding result from [10] for the buy-only setting.

Theorem 2.

There is a randomized, polynomial-time online algorithm for node-weighted Steiner forest in the rent-or-buy setting which is O(logk~logn¯)-competitive against an oblivious adversary.

If one does not care about the logarithmic dependency on n¯, it is possible to make this deterministic. The resulting competitive ratio is O(n¯logk~), it depends linearly on the number of nodes with non-zero node-weights. This recovers the deterministic, O(logk~)-competitive algorithm of [24] in the edge-weighted setting.

Theorem 3.

There is a deterministic, polynomial-time online algorithm for node-weighted Steiner forest in the rent-or-buy setting which is O(n¯logk~)-competitive against an adaptive adversary.

1.2 Our techniques

On a high-level, we combine the witness technique from the edge weighted variant for Rent-or-Buy from [24] with an instance of prize-collecting set cover. Before describing our approach, we briefly describe the approach for the edge-weighted setting, as well as the relevant techniques necessary for handling the node-weighted setting.

For the rent-or-buy setting, the difficulty lies in deciding whether it is worthwhile to buy an edge since we can reuse it at least M times in the future, or whether we should rent. In the Ski Rental problem, e.g. Rent-or-Buy on a graph consisting of a single edge, a simple way to decide this and guarantee 2-competitiveness is as follows: we rent M times, then we buy. On a high level, this charging scheme was adapted to the edge-weighted Steiner problems in [24], surprisingly by a simple greedy procedure (though the analysis is quite involved!): if the new request r lies close to M previous requests for which we rented, buy the greedy path the algorithm selects for r. The cost of the bought path can be charged against these M witnesses and all future requests close to any of them can be routed through the bought path. This ensures there cannot appear any clusters of Ω(M) rented paths for which it would have been beneficial to just buy once, allowing for a charging scheme against the optimal solution.

Such a greedy approach cannot work in the node-weighted setting, even in the buy-only setting. Because the weights are on the nodes, it is possible for some vertex v to be close to many (eventually) arriving terminals, but, all these terminals are quite far from each other. Indeed, this happens if these terminals have small distance to v, but v has significant weight. Hence, even if we always buy a path for each arriving request, we might still end up with huge clusters of terminals for which an optimal offline solution only buys a single node. Hence, it is necessary to strategically buy certain nodes, which will decrease the distance of future requests. As shown in [23, 17], in the buy-only setting, these nodes can be selected through an instance of online non-metric facility location.

There are two main challenges to extend this to the rent-or-buy setting. First, analogous to the charging scheme for Ski-Rental problem, we need to balance the cost of renting and buying for every node and edge. Second, the number of requests is no longer bounded by the size of the graph: when we opt to rent, the same request can reappear again and incur an extra cost (unlike in the buy-only setting). Both of these issues cannot be handled by the charging scheme based on standard non-metric facility location. Our main contribution is to introduce a new charging scheme that instead relies on a prize-collecting variant of set cover, which itself is a special case of non-metric facility location. This extension to the prize-collecting variant takes care of these issues: It allows us to set up a charging scheme based on [24, 17], that ensures that no more than M reappearances of terminals can “cluster”, balancing their cost against the cost of the prize-collecting instance of set cover, and naturally handling reappearances of terminals, with the competitive ratio only depending on the number of distinct terminals.

Finally, as a by-product of our conceptual simplification of using online (prize-collecting) set cover instead of (prize-collecting) non-metric facility location, our obtained bounds depend on n¯, the number of nodes with non-zero node-weights, instead of n, the total number of vertices. This results in a framework that truly generalizes and recovers the best-known results from the edge-weighted setting, without incurring an extra O(logn) factor.

1.3 Related work

Most relevant to our work is the randomized procedure from [3]. This procedure can convert any algorithm for the buy-only setting into a randomized algorithm for the rent-or-buy setting with only a constant loss in the competitive ratio. It works in a very simple way: each request is passed to the buy-only algorithm with probability 1/M, and for the remaining requests the algorithm rents. In their original paper, they only claim competitiveness against online adaptive adversaries when the algorithm for the buy-only setting is competitive against online adaptive adversaries. This would rule out using the O(logklogn)-competitive algorithm from [10], as that algorithm is not competitive against adaptive adversaries. However, a slightly more careful analysis of the result from [3] reveals that the same procedure can be applied, resulting in a randomized, Θ(logk~logn)-competitive algorithm against oblivious adversaries. This is a weaker adversarial setting than that of an adaptive online adversary. We elaborate on this in the appendix of the full version.

2 Preliminaries

This section is divided in three parts. First, in Section 2.1, we present the necessary background from graph theory. In Section 2.2, we give a formal description of online problems under consideration. Finally, in Section 2.3, we describe the relevant adversarial settings

2.1 Graph Theory

We consider undirected graphs G=(V,E) with a node-weight function c:V0. This setting also captures edge-weights and is purely for convenience. For any pair of vertices u,vV, we set dG(u,v) to be the distance with respect to c() between u and v, excluding the weights of u and v. Given some set AV, the subgraph induced by A is denoted by G[A], and consists of all vertices in A as well as all edges from E that have both endpoints in A. G/A denotes the graph G where the weight of all nodes in A have been set to 0, and dG/A(u,v) denotes the shortest distance between u and v in G/A, again excluding the weights of u and v. Finally, given some radius r>0 and some vertex u, we define the open ball of radius r around u to be B(u,r):={vVdG(u,v)+cvr}, and its boundary to be 𝖻𝖽B(u,r):={vVdG(u,v)r<dG(u,v)+cv}. We set B¯(u,r):=B(u,r)𝖻𝖽B(u,r).

2.2 Online problems

In the online node-weighted Steiner forest problem (𝖭𝖶𝖲𝖥) in the rent-or-buy setting, we are given a node-weighted graph upfront, as well as a parameter M. Then, one-by-one, we receive pairs of terminals (s1,t1),,(sk,tk)V×V. At each timestep i[k], we need to maintain (augment) a set B of bought nodes and select a set of nodes Ri such that (si,ti) is connected in G[BRi]. The total cost is Mc(B)+i1kc(Ri). The Steiner tree problem is defined analogous, except that we need to maintain a connected subgraph connecting all the arrived terminals s1,,sk; this corresponds to the Steiner forest problem in the setting where the terminal pairs are of the form (s1,s2),(s1,s3),,(s1,sk).

An instance of the set cover problem (𝖲𝖢) is given by a set system (X,𝒮,𝖼𝗈𝗌𝗍), where X is a groundset of elements, 𝒮2X is a set of subsets of X, and 𝖼𝗈𝗌𝗍:𝒮0 is a cost function. In the online setting, the elements are revealed one-by-one, and we need to ensure it is covered by a set. Sets from the cover cannot be removed, and the goal is to minimize the total cost of the selected sets. This problem has been studied in two settings. In the first, we have no knowledge of the set system. Only upon arrival of an element, we learn which sets contain it. In the second setting, we learn the set system (X,𝒮) upfront. The subset of elements in X that needs to be covered is revealed in an online fashion. Deterministic algorithms for online set cover are only meaningful in the second setting. In contrast, randomized algorithms against oblivious adversaries also apply in the first setting.

2.3 Adversarial settings

An online problem is a game between an online algorithm and an adversary. The adversary reveals the input I𝖠𝖽𝗏 to some problem piece by piece, after each reveal, the online algorithm must augment their current solution to maintain feasibility. The cost incurred by the online algorithm is compared to that of the adversary, its ratio is referred to as the competitive ratio. This notion does depend on the type of adversary, i.e. how the adversary is allowed to generate the sequence I𝖠𝖽𝗏 and how it has to service it. We give a brief description of three adversarial settings that we consider in this paper, as well as the corresponding notion of competitiveness. For a more detailed exposition, see [9].

Adaptive adversaries

An adaptive adversary can create the input sequence I𝖠𝖽𝗏 adaptively. In each time-step, it selects the next request to be presented to the online algorithm based on previous actions of the online algorithm so far.

Semi-adaptive adversaries

This adversarial setting was introduced recently in [10]. A semi-adaptive adversary commits to a super-instance I^𝖠𝖽𝗏 of the input sequence. In the online phase, it adaptively selects I𝖠𝖽𝗏I^𝖠𝖽𝗏 to be presented to the online algorithm. This adversarial setting is relevant in settings where the competitive ratio depends on the size of I^𝖠𝖽𝗏, such as online set cover against an adaptive adversary.

Oblivious adversaries

An oblivious adversary has to commit to the whole input sequence upfront, and cannot change it based on the actions of the online algorithm.

To define the competitive ratio, we further distinguish between online and offline adversaries. An online adversary needs to service their own request sequence I𝖠𝖽𝗏 in an online fashion, i.e. cannot wait to observe the actions of the online algorithm and service their requests accordingly, while an offline adversary can service their request sequence I𝖠𝖽𝗏 after it is finished presenting it to the online algorithm. Denoting by 𝖺𝗅𝗀(I𝖠𝖽𝗏) the cost of the online algorithm and by c(𝖠𝖽𝗏) the cost of the (respective) adversary, the online algorithm is said to be γ-competitive if

𝔼𝖺𝗅𝗀[𝖺𝗅𝗀(I𝖠𝖽𝗏)]γ𝔼𝖺𝗅𝗀[c(𝖠𝖽𝗏)].

Note that the expectation of the right-hand-side is also over the randomness of the actions, since, whenever the adversary is adaptive, the actions of the online algorithm may influence future requests. If the adversary is oblivious, the right-hand-side holds deterministically, and if the online algorithm is deterministic, both sides hold deterministically.

3 Online prize-collecting set cover

In this paper, we will make use of the prize-collecting variant of the online set cover problem.

This is essentially the online set cover problem, with a small twist: for each arriving element e, there is a penalty p if e is left uncovered. Crucially, elements can reappear (with varying penalties). Formally, such an instance is given by (X~,𝒮,𝖼𝗈𝗌𝗍:𝒮0,p:X~×0). Here, we denote the ground set by X~ to emphasize the difference to the (multi-)set of eventually arriving elements. We will refer to k~ as the number of distinct arriving elements.

It is important to note that the naive reduction from (online) set cover, i.e. duplicate each element proportionally to its number of reappearances and add singleton sets with corresponding penalty cost, does not yield any meaningful competitive ratio. Indeed, such a reduction creates a number of elements which is proportional to the number of arriving elements, which may be considerably higher than k~. As an example, for the 𝖭𝖶𝖲𝖥 problem in the rent-or-buy setting with parameter M, this can be of order Mk~, which would result in a competitive ratio that depends on M.

3.1 Background on online set cover

All approaches for online set cover are based on the following general framework. Throughout the online phase, a monotonically increasing fractional solution is maintained, that is feasible for all arrived elements. In parallel, a rounding scheme is run to convert these fractional values to an actual integral solution, i.e. actually picking sets covering the arrived elements. For the first part, we rely on the following result.

Theorem 4 (Theorem 3.2, [12]).

There is a deterministic online algorithm that maintains a monotonically increasing fractional solution to the online set cover problem. The algorithm is O(log)-competitive with respect to an optimal fractional solution, where :=maxxX|{S𝒮|xS}| is the maximum number of sets that an element is contained in.

Note that this fractional solution is compared to the best fractional solution in hindsight, and can be maintained deterministically. Hence this holds against an offline adversary in any adversarial model. In contrast, the rounding part does depend on the adversarial setting. Against an oblivious or semi-adaptive adversary, the rounding scheme is randomized and the guarantees hold in expectation. However, in contrast to the deterministic rounding scheme (against adaptive adversaries), the underlying set system does not need to be revealed upfront. We resume these results in the following two theorems.

Theorem 5 (Theorem 3, [10]).

There is a randomized procedure that rounds a monotonically increasing solution to an instance of online set cover. Against a semi-adaptive adversary that commits to an unrevealed super-instance I^=(X^,𝒮,𝖼𝗈𝗌𝗍) upfront and adaptively selects XX^ to be presented to the algorithm, we have that:

𝔼[𝖼𝗈𝗌𝗍(𝖺𝗅𝗀)]O(log|X^|)𝔼[𝗏𝖺𝗅𝖿𝗋𝖺𝖼].

Here, 𝗏𝖺𝗅𝖿𝗋𝖺𝖼 is the cost of the fractional solution provided to the procedure.

Note that this generalizes the result for online set cover against oblivious adversaries. If the adversary is oblivious to the actions of the rounding procedure, their actions may as well be fixed. Hence, we may assume that X=X^ and that the right-hand-side holds deterministically. In that case, combined with Theorem 4, this recovers the O(logklog)-competitive ratio against (offline) oblivious adversaries of [11], where k=|X| is the number of arriving elements. Against adaptive adversaries, we rely on the following.

Theorem 6 (Theorem 5.2, [11]).

There is a deterministic online rounding procedure that rounds a monotonically increasing solution to an instance of online set cover, provided the set system I^=(X^,𝒮,𝖼𝗈𝗌𝗍) is revealed upfront. The adversary adaptively selects a subset of the elements that will arrive. The algorithm satisfies:

𝔼[𝖼𝗈𝗌𝗍(𝖺𝗅𝗀)]O(log|X^|)𝔼[𝗏𝖺𝗅𝖿𝗋𝖺𝖼].

Here, 𝗏𝖺𝗅𝖿𝗋𝖺𝖼 is the cost of the fractional solution provided to the procedure.

3.2 Algorithm for prize-collecting online set cover

We now give an online algorithm for the prize-collecting variant of online set cover.

We begin by describing an auxiliary instance of set cover (X,𝒮^). For each reappearance of an element eX~ with penalty p, there is an element (e,p)X. For each set S𝒮, there is a set S^𝒮^ of same weight, so that S^ contains all copies of the elements contained in S, i.e. (e,p)S^eS. Finally, for each element corresponding to (e,p)X~, there is a singleton set S^(e,p) of weight p in 𝒮^. This construction is illustrated in Figure 1. Clearly, any integral (fractional) solution to this auxiliary instance corresponds to an integral (fractional) solution to the original instance of prize-collecting set cover of same cost and vice-versa.

(a) The prize-collecting set cover instance (X~,𝒮).
(b) The auxiliary set cover instance (X,𝒮^).
Figure 1: In the prize-collecting instance, element e1, appears once, e2 twice, e3 once, and e4 three times. In the auxiliary instance, each copy is contained in the same sets as the original instance, but is also contained in a singleton set of weight corresponding to its penalty.

We now describe our main algorithm for online prize-collecting set cover on instance (X~,𝒮). We start by initializing an (empty) auxiliary instance Iaux of online fractional set cover, (X,𝒮^), for which we will maintain a monotonically increasing fractional solution {xS^}S^𝒮^ by the algorithm of [12], see Theorem 4. We also initialize an instance I~ of online set cover on the same set system as (X~,𝒮). We will maintain monotonically increasing values {xS}S𝒮, for which we will use a rounding scheme for online set cover such as [2, 11, 10] to decide which sets to select for (X~,𝒮). Specifically, upon the arrival of an element (e,p)X~, we pass a copy of the element to the auxiliary instance of set cover (X,𝒮^) as detailed above, and we update our fractional solution. If the fractional value of the singleton set containing (e,p) is at least 1/2, i.e.

xS^(e,p)>12,

we pay the penalty. In parallel, we set xS=2xS^, i.e. the fractional value of each set S𝒮 is twice that of its corresponding set in 𝒮^. We add any sets that the rounding scheme on (X~,𝒮) selects based on {xS}S𝒮.

Theorem 7.

There is a randomized algorithm for online prize-collecting set cover against a semi-adaptive adversary that commits to super-instance (X~,𝒮,𝖼𝗈𝗌𝗍), but not on the values of the respective penalties. We have that

𝔼[c(𝖠𝖫𝖦)]O(log|X~|log|𝒮|)𝔼[c(𝗈𝗉𝗍𝖿𝗋𝖺𝖼)],and,
c(𝖠𝖫𝖦𝗉𝖾𝗇)O(log|𝒮|)𝔼[c(𝗈𝗉𝗍𝖿𝗋𝖺𝖼)].

Here c(𝖠𝖫𝖦) denotes the total cost incurred by the algorithm, c(𝖠𝖫𝖦𝗉𝖾𝗇) the cost incurred on penalties, and 𝗈𝗉𝗍𝖿𝗋𝖺𝖼 an optimum fractional solution to the sub-instance presented to the algorithm. If the set system (X~,𝒮,𝖼𝗈𝗌𝗍) is revealed upfront, the algorithm can be made deterministic and the above competitive ratio holds deterministically.

Proof.

By Theorem 4, the fractional solution {xS^}S^𝒮^ for the auxiliary instance I𝖺𝗎𝗑 is O(log) competitive, where is the maximum number of sets any element is contained in. Note that this is deterministic and does not require the assumption that the instance be revealed upfront. By construction, is at most |𝒮|+1. Since we only pay the penalty if the singleton set has weight at least 1/2, the total cost incurred on penalties is at most

O(log|𝒮|)c(𝗈𝗉𝗍frac).

Hence, whenever we do not pay the penalty for element (e,p), the fractional weight of all sets S^(e,p) except for the singleton set must sum up to at least 1/2. Since xS=2xS^, the values {xS}S𝒮 fractionally cover e. Their fractional cost is O(log|𝒮|)𝗈𝗉𝗍frac. Hence, by Theorem 5 resp. 6, these values are rounded in an online fashion (ensuring e is covered), incurring an O(log|X~|) multiplicative loss. This concludes the proof.

To conclude this section, we describe Theorem 8, a deterministic, O(|𝒮|)-competitive algorithm for online prize-collecting set cover that is 1-competitive with respect to penalties. Specifically, we use a dual charging scheme to decide when to pay the penalty and when to buy which sets. The dual is given by (D), the primal, e.g. the fractional relaxation to (X,S^), by (P).

minS𝒮^cS^xS^
 (P)s.t.S^:(e,p)S^xS^1,(e,p)XxS^0,S^𝒮^ (1)
max(e,p)Xy(e,p)
 (D)s.t.(e,p)S^y(e,p)cS^,S^𝒮^y(e,p)0,(e,p)X (2)

The algorithm is very simple. Whenever an element eX~ with penalty p arrives, we pass (e,p) to the fractional auxiliary instance of set cover described above. We raise the value of the corresponding dual variable y(e,p) until one of the dual constraints (indexed by S^𝒮^) becomes tight, i.e.

(e,p)S^y(e,p)=cS^.

We buy the set in 𝒮 corresponding to such a set S^, or pay the penalty if it is the singleton set S^(e,p).

Theorem 8.

If the set system (X~,𝒮,𝖼𝗈𝗌𝗍) is not revealed upfront, there is a deterministic, O(|𝒮|)-competitive algorithm for prize collecting set cover. Furthermore, it holds that

c(𝖠𝖫𝖦𝗉𝖾𝗇)c(𝗈𝗉𝗍𝖿𝗋𝖺𝖼),

where c(𝖠𝖫𝖦𝗉𝖾𝗇) denotes the cost incurred on penalties, and c(𝗈𝗉𝗍𝖿𝗋𝖺𝖼) denotes the optimal fractional cost to sub-instance presented to the online algorithm.

Proof.

Clearly, throughout the algorithm, we maintain a feasible dual solution y(e,p) for (D), and each arriving element is covered. To bound the cost, we observe that by weak duality, (D)(P). Since we only pay the penalty p for element e if y(e,p)=p, the total amount spent on penalties (i.e. the singleton sets in 𝒮^) is at most (D). To bound the total cost, we observe that each y(e,p) contributes its value to at most |𝒮|+1 sets, meaning that c(𝖠𝖫𝖦)(|𝒮|+1)(D)O(|S|)𝗈𝗉𝗍𝖿𝗋𝖺𝖼.

4 Rent-or-Buy for node-weighted Steiner forest

In this part we show Theorems 1, 2 and 3. The algorithm is in Section 4.1, the analysis in Section 4.2.

4.1 The algorithm

Our algorithm relies on an auxiliary instance of online prize-collecting set cover. We describe it in Algorithm 1.

Set-up

We assume that for all arriving terminal pairs, we have that 1dG/A(si,ti)k~6, where k~ is the number of arriving terminal pairs (set k~:=|T| for Theorem 1), and A is the set of bought nodes. This is without loss of generality, as shown in the full version of this paper. This allows us to group pairs (si,ti) into layers jL:={0,1,,6logk~} corresponding to logdG/A(si,ti)+1. For ease of presentation we transform the node- and edge-weighted graph into a purely node-weighted graph as follows. Each edge with non-zero edge-weight ce is subdivided by 81/ce+1 nodes, each of node-weight strictly less than 1/8 and summing exactly to ce. Note that this transformation is only done for the purpose of the description and analysis of the online algorithm, but is not necessary to construct explicitly.

An instance of online prize-collecting set cover (𝗣𝗖𝗦𝗖)

We describe the set system (X~,𝒮). For each node uG, and each jL:={0,1,,6logk~}, there is an element ru,j. Also, for each node vG, there is a set Sv with cost log(k~)Mcv. We define Ru,j to be the family of sets Sv with v𝖻𝖽B(u,2j5) for which cv2j6. Element ru,j is contained in all sets in Ru,j and its penalty is 2j. Whenever clear, we drop the prize-collecting and simply refer to this instance as an instance of set cover (𝖲𝖢).

Description of the algorithm

We now give a short overview. We start by initializing an instance of prize-collecting set cover as described above, |L| witness sets F0,F1,,F|L|, as well as a counter yw,j0 for each node wG. Every time a terminal pair (s,t) arrives, we proceed as follows. We compute d:=dG/A(s,t), the distance of s to t, and we refer to j:=logd+1 as the layer the demand pair is on. We always rent the greedy path from s to t (hence satisfying the connectivity requirement), however, we will also buy some nodes. To decide this, we distinguish between two cases, depending on whether s or t is uncovered on layer j: s is said to be uncovered on layer j, if no witness set on layer j containing s has been added to the set cover, and, for all vertices v in the open ball of radius 2j5 centered at s, the counter yv,j is strictly less than M; e.g.

Rs,jFj=, and ,wB(s,2j5):yw,j<M.

If this holds, we pass s (or t, whatever is uncovered) to the auxiliary instance of set cover.

If the instance of set cover adds a new set to the cover, we buy the corresponding node and add it to Fj. For all nodes wB(s,2j5) we increase the counter yw,j by one. If this does not hold, i.e. both s and t are covered, we proceed as follows. We pick two nodes ws,wtFj on layer j, where ws (resp. wt) lies in the closed ball of radius 2j3 around s (resp. t). If this set is empty, we add s (resp. t) to the witness set Fj and set ws=s (resp. wt=t). We then buy the shortest path between ws and wt in G/A.

Size of set system

From the description of the algorithm, it is clear that the only elements ru,j that are released to the instance of 𝖯𝖢𝖲𝖢, correspond to some terminal u in the original graph. Hence, the number of arriving elements of X~ is at most O(k~logk~), and the number of elements that could potentially arrive is at most O(|T|log|T|). To see that we can bound the number of sets by n¯, note that the nodes corresponding to non-zero edge-weights in the original graph have node-weights strictly less than 1/8 and do not contain any elements. As such, they are irrelevant and can be disregarded. All remaining sets correspond to one of the n¯ original nodes with non-zero node-weight.

Algorithm 1 Node-weighted Rent-Or-Buy Steiner Forest.

4.2 The analysis

In this section we prove Theorems 1, 2 and 3. To do so, we are going to show that the cost of Algorithm 1 can be charged against the optimum cost of the instance of prize-collecting set cover.

We will consider the if-case and the else-case separately. Let C𝗂𝖿 be the cost incurred in iterations that execute the if-case and C𝖾𝗅𝗌𝖾 be the cost incurred in the else-case. Let C𝖲𝖢 be the cost of the constructed solution to the prize-collecting set cover instance and let C𝖲𝖢,𝗉𝖾𝗇 and C𝖲𝖢,𝗌𝖾𝗍𝗌 be the penalty costs and the costs for the added sets in the solution, respectively. Note that C𝖲𝖢=C𝖲𝖢,𝗉𝖾𝗇+C𝖲𝖢,𝗌𝖾𝗍𝗌. We rely on the following four claims.

Claim 9.

C𝖾𝗅𝗌𝖾6Mj2j|Fj|.

Proof.

The total cost incurred in an iteration in which the else-case is executed can be upper bounded by 3M2j: at most 2M2j is incurred on Line 14, and at most 2j is incurred on Line 15. So we can prove the above claim by simply bounding the number of iterations in which the else-case is executed for each j by 2|Fj|. Each such iterations falls into one of the following categories:

  • If si or ti are added to Fj in Lines 11 and 12, then |Fj| increases by at least 1 in this iteration. Clearly, this can happen at most |Fj| times.

  • Otherwise, some vFjB¯(si,2j3) and wFjB¯(ti,2j3) are chosen. Now we claim that no path connecting v and w has been bought so far, i.e. v and w are not connected in G/A. If this was the case, then the distance d between si and ti in G/A would be at most 2j3+2j3=2j2, contradicting the fact that j=log(d)+1 . Since v and w become connected in this iteration, the number of components in A that contain a node in Fj decreases by at least 1. Since the number of such components is at most |Fj|, this can happen at most |Fj| times.

Since the number of iterations for each of the categories is at most |Fj|, the total number of iterations in which the else-case is executed for each j is at most 2|Fj|. This implies the claim.

Claim 10.

Mj2j|Fj|128(C𝖲𝖢,𝗉𝖾𝗇+C𝖲𝖢,𝗌𝖾𝗍𝗌logk~).

Proof.

Let Fj,1 be the set of nodes in Fj that were added on Line 8 and let Fj,2 be the set of nodes in Fj that were added on Lines 11 and 12. Note that Fj=Fj,1Fj,2. We will show that for each time that |Fj,1| or |Fj,2| increases by 1, the right-hand side of the inequality increases by at least M2j.

  • When some new set Su for uRv,j is added to the set cover solution, |Fj,1| increases by one for all j with cv2j6. Hence, the left-hand side of our claimed inequality grows by at most Mi=026icv128Mcv, while the right-hand side increases by 128Mcv.

  • When a node v is added to Fj,2 (on Lines 11 or 12), node v can not have been uncovered on layer j. This means that either there exists a zRv,jFj or there is a wB(v,2j5):yw,jM. However, in the former case, zFjB¯(v,2j5), in which case v would not be added to Fj. So, there must be some wB(v,2j5) such that yw,jM. Call yw,j a witness for v.

    We will now charge the increase in |Fj,2| to all iterations in which yw,j was increased. Note that in each such iteration, either a set of cost at least log(k)M2j6 is added to the set cover solution or a penalty of 2j is paid. So in M such iterations, the right-hand side of our claimed inequality increases by at least M2j.

    However, we need to be careful that an iteration in which yw,j is increased is not charged by multiple nodes v. We will show that this is not the case. Consider an iteration in which yw,j is increased for all wB(v,2j5). Suppose that yw1,j and yw2,j for w1,w2B(v,2j5) are witnesses for v and v respectively with vv. Assume that v gets added to Fj before v. By the definition of the witnesses, we have d(w1,v)2j5 and d(w2,v)2j5. However, since yw1,j and yw2,j are both increased in the same iteration, we must have d(w1,w2)22j5. This implies that d(v,v)d(v,w1)+d(w1,w2)+d(w2,v)42j5=2j3, which contradicts the fact that v is added to Fj even though v is already in Fj. Hence, each iteration in which yw,j is increased is charged by at most one node v.

Claim 11.

C𝗂𝖿O(C𝖲𝖢,𝗉𝖾𝗇+C𝖲𝖢,𝗌𝖾𝗍𝗌logk~).

Proof.

We will show that each iteration the right-hand side increases faster than the left-hand side. Whenever the if-case is executed there are two cases:

  • For iterations in which new set Sv is added to the set cover solution, C𝖲𝖢,𝗌𝖾𝗍𝗌 increases by at least logk~Mcvlogk~M2j6. To buy v, a cost of Mcv is incurred. A cost of at most d2j is incurred on Line 15 for renting the path between si and ti. So, C𝗂𝖿 increases by at most Mcv+2j, which matches the increase in O(C𝖲𝖢,𝗌𝖾𝗍𝗌logk~) on the right-hand-side.

  • In all other iterations in which the if-case is executed, rv,j is not covered and a penalty of 2j is incurred in C𝖲𝖢,𝗉𝖾𝗇. The only cost incurred in C𝗂𝖿 is for renting a path between si and ti on Line 15 of cost at most 2j.

Claim 12.

𝗈𝗉𝗍𝖲𝖢O(logk~)𝗈𝗉𝗍𝖱𝗈𝖡.

Proof.

Consider 𝗈𝗉𝗍, an optimal solution to the given Rent-Or-Buy problem, and denote A to be the set of nodes that are bought in 𝗈𝗉𝗍. We will construct a solution to prize-collecting set cover of cost at most O(logk~) times the cost of this optimal solution. To do so, we let the set cover consist of all sets sv corresponding to nodes v that are bought in 𝗈𝗉𝗍. This incurs a set cost of vAMlog(k~)cvO(logk~)𝗈𝗉𝗍. It remains to show the same bound on the penalty costs.

Consider such an arriving element rv,j that is not covered by the set cover. Let v1,v2,,vr be a sequence of nodes that connect v=v1 to a node in vr𝖻𝖽B(v,2j5) in the optimal Rent-Or-Buy solution. Suppose that cvr2j6. Then we must have vrA, since otherwise, we would have added svr in our set cover solution and rv,j would have been covered. So, renting vr incurred a cost of at least 2j6 in 𝗈𝗉𝗍𝖱𝗈𝖡. So we can charge the penalty of 2j incurred in 𝗈𝗉𝗍𝖲𝖢 to this cost.

On the other hand, if cvr<2j6, then we will charge cvilogk~ of the penalty incurred by the arrival of rv,j to the cost paid for buying or renting vi in the optimal Rent-Or-Buy solution for i{2,r1}. So, in this case we are charging i=2r1cvilogk~2j52j6logk~=2j6logk~. This is indeed only a factor of 26logk~ less than the connection cost of rv,j.

The only thing to check is that the cost for buying or renting a node in the optimal Rent-Or-Buy solution is larger than the charged cost. Nodes that are not bought in the optimal solution have to be rented at cost cv each time they are used. So this rental cost is clearly at least as large as the charged cost.

For a node v that is bought in the optimal rent-or-buy solution, observe that yv,j is increased for some j each time that cvilogk~ is charged to it. Note that yv,j never becomes larger than M. So, the total charged cost for v is at most Mcvlogk~ for each j. Hence, the total charged cost for v is at most Mcv, which is exactly the cost of buying v in the optimal solution.

Proof of Theorems 1, 2 and 3.

By Claims 9, 10 and 11, the cost of incurred by online algorithm is at most O(C𝖲𝖢,𝗉𝖾𝗇+C𝖲𝖢,𝗌𝖾𝗍𝗌logk~). By Claim 12 we know that the optimal solution to the prize-collecting set cover instance is at most O(logk~) times the optimal solution to the Rent-Or-Buy Steiner Forest problem.

Plugging in the algorithms for prize-collecting set cover from Theorem 7 in our algorithm, gives us C𝖲𝖢,𝗉𝖾𝗇O(log|𝒮|)𝗈𝗉𝗍𝖲𝖢 and C𝖲𝖢,𝗌𝖾𝗍𝗌O(log|X^|log|𝒮|)𝗈𝗉𝗍𝖲𝖢. Hence, the cost of the online algorithm is at most:

C𝖲𝖢,𝗉𝖾𝗇+C𝖲𝖢,𝗌𝖾𝗍𝗌logk~ O(log|𝒮|+log|X^|log|𝒮|logk~)𝗈𝗉𝗍𝖲𝖢
O(log|𝒮|(logk~+log|X^|))𝗈𝗉𝗍𝖱𝗈𝖡.

Since |X~|=O(k~logk~) (recall that we set k~:=|T| when we instantiate Algorithm 1 with the deterministic algorithm from Theorem 7) and |𝒮|=n¯, Theorems 1 and 2 follow. Similarly, plugging in the deterministic algorithm from Theorem 8 gives us a competitive ratio of O(n¯logk~). This proves Theorem 3.

References

  • [1] Noga Alon, Baruch Awerbuch, Yossi Azar, Niv Buchbinder, and Joseph (Seffi) Naor. A general approach to online network optimization problems. ACM Trans. Algorithms, 2:640–660, 2006. doi:10.1145/1198513.1198522.
  • [2] Noga Alon, Baruch Awerbuch, Yossi Azar, Niv Buchbinder, and Joseph (Seffi) Naor. The online set cover problem. SIAM J. Comput., 39:361–370, 2009. Preliminary version in STOC’03. doi:10.1137/060661946.
  • [3] Baruch Awerbuch, Yossi Azar, and Yair Bartal. On-line generalized steiner problem. Theoretical Computer Science, 324:313–324, 2004. Preliminary version in SODA’96. doi:10.1016/j.tcs.2004.05.021.
  • [4] Y. Bartal, A. Fiat, and Y. Rabani. Competitive algorithms for distributed data management. Journal of Computer and System Sciences, 51(3):341–358, 1995. doi:10.1006/jcss.1995.1073.
  • [5] Yair Bartal, Moses Charikar, and Piotr Indyk. On page migration and other relaxed task systems. Theoretical Computer Science, 268(1):43–66, 2001. On-line Algorithms ’98. doi:10.1016/S0304-3975(00)00259-0.
  • [6] Piotr Berman and Chris Coulston. On-line algorithms for steiner tree problems (extended abstract). In STOC, 1997. doi:10.1145/258533.258618.
  • [7] Marcin Bienkowski, Björn Feldkord, and Paweł Schmidt. A Nearly Optimal Deterministic Online Algorithm for Non-Metric Facility Location. In STACS, 2021. doi:10.4230/LIPIcs.STACS.2021.14.
  • [8] D. Black and D. Sleator. Competitive algorithms for replication and migration problems. Technical report, Carnegie-Mellon, 1989.
  • [9] Allan Borodin and Ran El-Yaniv. Online computation and competitive analysis. Cambridge University Press, 1998.
  • [10] Sander Borst, Marek Eliáš, and Moritz Venzin. Stronger adversaries grow cheaper forests: online node-weighted steiner problems. In SODA, 2025. doi:10.1137/1.9781611978322.129.
  • [11] Niv Buchbinder and Joseph (Seffi) Naor. The design of competitive online algorithms via a primal–dual approach. Foundations and Trends® in Theoretical Computer Science, 3:93–263, 2009. doi:10.1561/0400000024.
  • [12] Niv Buchbinder and Joseph (Seffi) Naor. Online Primal-Dual Algorithms for Covering and Packing. Mathematics of Operations Research, 34(2):270–286, May 2009. doi:10.1287/moor.1080.0363.
  • [13] Yevgeniy Dodis and Sanjeev Khanna. Design networks with bounded pairwise distance. In STOC, 1999. doi:10.1145/301250.301447.
  • [14] Alina Ene, Deeparnab Chakrabarty, Ravishankar Krishnaswamy, and Debmalya Panigrahi. Online buy-at-bulk network design. In FOCS, 2015. doi:10.1109/FOCS.2015.40.
  • [15] Anupam Gupta, R. Ravi, Kunal Talwar, and Seeun William Umboh. Last but not least: Online spanners for buy-at-bulk. In SODA, 2017. doi:10.1137/1.9781611974782.38.
  • [16] MohammadTaghi Hajiaghayi, Vahid Liaghat, and Debmalya Panigrahi. Near-optimal online algorithms for prize-collecting steiner problems. In ICALP, 2014. doi:10.1007/978-3-662-43948-7_48.
  • [17] MohammadTaghi Hajiaghayi, Vahid Liaghat, and Debmalya Panigrahi. Online Node-weighted Steiner Forest and Extensions via Disk Paintings. SIAM J. Comput., 46:911–935, 2017. doi:10.1137/14098692X.
  • [18] Makoto Imase and Bernard M. Waxman. Dynamic steiner tree problem. SIAM J. Discrete Math., 4:369–384, 1991. doi:10.1137/0404033.
  • [19] Anna R. Karlin, Claire Kenyon, and Dana Randall. Dynamic tcp acknowledgement and other stories about e/(e1). In STOC, 2001. doi:10.1145/380752.380845.
  • [20] Anna R. Karlin, Mark S. Manasse, Lyle A. McGeoch, and Susan Owicki. Competitive randomized algorithms for non-uniform problems. In SODA, pages 301–309, 1990. URL: http://dl.acm.org/citation.cfm?id=320176.320216.
  • [21] Simon Korman. On the use of randomization in the online set cover problem. Master’s thesis, The Weizmann Institute of Science, 2004.
  • [22] A. Meyerson. The parking permit problem. In FOCS, 2005. doi:10.1109/SFCS.2005.72.
  • [23] Joseph Naor, Debmalya Panigrahi, and Mohit Singh. Online node-weighted steiner tree and related problems. In FOCS, 2011. doi:10.1109/FOCS.2011.65.
  • [24] Seeun Umboh. Online network design algorithms via hierarchical decompositions. In SODA, 2015. doi:10.1137/1.9781611973730.91.