, Volume 67, Issue 4, pp 498–515

A Universal Randomized Packet Scheduling Algorithm

Open AccessArticle

DOI: 10.1007/s00453-012-9700-0

Cite this article as:
Jeż, Ł. Algorithmica (2013) 67: 498. doi:10.1007/s00453-012-9700-0


We give a memoryless scale-invariant randomized algorithm ReMix for Packet Scheduling that is e/(e−1)-competitive against an adaptive adversary. ReMix unifies most of previously known randomized algorithms, and its general analysis yields improved performance guarantees for several restricted variants, including the s-bounded instances. In particular, ReMix attains the optimum competitive ratio of 4/3 on 2-bounded instances.

Our results are applicable to a more general problem, called Item Collection, in which only the relative order between packets’ deadlines is known. ReMix is the optimal memoryless randomized algorithm against adaptive adversary for that problem.


Online algorithmsCompetitive analysisAdaptive adversaryPacket schedulingBuffer management with bounded delay

1 Introduction

In this paper, we consider the problem of Packet Scheduling, introduced by Kesselman et al. [14] (under the name Buffer Management with Bounded Delay). This problem models the behavior of a single network switch responsible for scheduling packet transmissions along an outgoing link as follows. We assume that time is divided into unit-length steps. At the beginning of a time step, any number of packets may arrive at a switch and be stored in its buffer. Each packet has a positive weight, corresponding to the packet’s priority, and a deadline, which specifies the latest time when the packet can be transmitted. Only one packet from the buffer can be transmitted in a single step. A packet is removed from the buffer upon transmission or expiration, i.e., reaching its deadline. The goal is to maximize the gain, defined as the total weight of the packets transmitted.

As many others, we prefer to call the problem Packet Scheduling since it is equivalent to a single machine scheduling of unit-length jobs, with given weights, release times and deadlines; the last two restricted to integer values. In this setting, the goal is to maximize the total weight of jobs completed before their respective deadlines.

As the process of managing a packet queue is inherently a real-time task, we model it as an online problem. This means that the algorithm, when deciding which packets to transmit, has to base its decision solely on the packets which have already arrived at a switch, without the knowledge of the future.

1.1 Competitive Analysis

To measure the performance of an online algorithm, we use the standard notion of competitive analysis [5], which, roughly speaking, compares the gain of the algorithm to the gain of the optimal solution on the same instance. For any algorithm Alg, we denote its gain on instance I by \(\mathcal{G}_{\scriptsize\textsc{Alg}}(I)\). The optimal offline algorithm is denoted by Opt. We say that a deterministic algorithm Alg is \(\mathcal{R}\)-competitive if on any instance I it holds that \(\mathcal{G}_{\scriptsize\textsc{Alg}}(I) \geq\frac{1}{ \mathcal{R}}\cdot\mathcal{G}_{\scriptsize\textsc{Opt}}(I)\).

When analyzing the performance of an online algorithm Alg, we view the process as a game between Alg and an adversary. The adversary creates the instance on the one hand, i.e., controls what packets are injected into the buffer, and solves the instance optimally on the other, i.e., chooses its packets for transmission. The goal is then to show that the adversary’s gain is at most \(\mathcal{R}\) times Alg’s gain.

If the algorithm is randomized, we consider its expected gain, \(\mathbb{E} [\mathcal{G}_{\scriptsize\textsc{Alg}}(I)]\), where the expectation is taken over all possible random choices made by Alg. However, in the randomized case, the power of the adversary has to be further specified. Following Ben-David et al. [2], we distinguish between an oblivious and an adaptive-online adversary, called adaptive for shortness from now on. An oblivious adversary has to construct the whole instance in advance. This instance may depend on Alg but not on the random bits used by Alg during the computation. The expected gain of Alg is compared to the gain of the optimal offline solution on I. In contrast, in case of an adaptive adversary, the choice of packets to be injected into the buffer may depend on the algorithm’s behavior up to the given time step. This adversary must also provide an answering entity Adv, which creates a solution in parallel to Alg. This solution may not be changed afterwards. We say that Alg is \(\mathcal{R}\)-competitive against an adaptive adversary if for any adaptively created instance I and any answering algorithm Adv, it holds that \(\mathbb{E}[\mathcal {G}_{\scriptsize\textsc{Alg}}(I)] \geq\frac{1}{\mathcal{R}} \cdot \mathbb{E}[\mathcal{G}_{\scriptsize\textsc{Adv}}(I)]\). We note that Adv is (wlog) deterministic, but as Alg is randomized, so is the instance I.

In the literature on online algorithms [5], the definition of the competitive ratio sometimes allows an additive constant, i.e., a deterministic algorithm is then called \(\mathcal {R}\)-competitive if there exists a constant α ≥0 such that for any instance I it holds that \(\mathcal{G}_{\scriptsize\textsc{Alg}}(I) \geq\frac{1}{ \mathcal {R}}\cdot\mathcal{G}_{\scriptsize\textsc{Opt}}(I) - \alpha\). An analogous definition applies to the randomized case. For our algorithm ReMix the bound holds for α=0, which is the best possible.

1.2 Basic Definitions

For a packet j, we denote its: weight by wj, relative deadline by dj, absolute deadline by Dj, and release time by rj. The absolute deadline is the exact point in time at which the packet expires, whereas the relative deadline is, at any time, the number of further steps after which the packet expires. To avoid nested subscripts we will use slightly different notation for sequences of packets: when considering a sequence of packets j1,j2,…,jn, instead of \(x_{j_{i}}\) (where x∈{d,D,r,w}), we simply write xi. We also denote a packet of weight w and relative deadline d by (w,d). A packet that is in the buffer, i.e., has already been released and has neither expired nor been transmitted by an algorithm, is called pending for the algorithm. The lifespan of a packet is its relative deadline value upon injection, or in other words the difference between its absolute deadline and release time.

The goal is to maximize the weighted throughput, i.e., the total weight of transmitted packets. We assume that time is slotted in the following way. We distinguish between points in time and time intervals, called steps. In step t, corresponding to the interval (t,t+1), Adv and the algorithm choose, independently, a packet from their buffers and transmit it. The packet transmitted by the algorithm (Adv) is immediately removed from its buffer and no longer pending. Afterwards, at time t+1, the relative deadlines of all remaining packets are decremented by 1, and the packets whose relative deadlines reach 0 expire and are removed from both Adv’s and the algorithm’s buffers. Next, the adversary injects any set of packets. At this point, we proceed to step t+1.

All known algorithms are scale-invariant, which means that they make the same decisions if all the weights of packets in an instance are scaled by a positive constant. A class of further restricted algorithms is of special interest for their simplicity: an algorithm is memoryless if in every step its decision depends only on the set of packets pending at that step.

1.3 Previous and Related Work, Restricted Variants

The currently best, 1.828-competitive, deterministic algorithm for general instances was given by Englert and Westermann [9]. Their algorithm is scale-invariant, but it is not memoryless. However, the same article provides a 1.893-competitive variant that is memoryless scale-invariant. The best known randomized algorithm is the 1.582-competitive memoryless scale-invariant RMix, proposed by Chin et al. [6]. For reasons explained in Sect. 2.1 the original analysis by Chin et al. is only applicable to the oblivious adversary model. However, a refined analysis shows that RMix remains 1.582-competitive in the adaptive adversary model [4].

The greedy algorithm (which always transmits the heaviest pending packet) has competitive ratio exactly 2 [12, 14], i.e., this memoryless scale-invariant algorithm is 2-competitive and no better than that. For a few years, no better deterministic algorithm for the general case was known, which led to a study of many restricted variants. Below we present some of them, together with known results. The most relevant bounds known are summarized in Table 1. Note that the majority of algorithms are memoryless scale-invariant.
Table 1

Comparison of known and new results. All the upper bounds in the middle column (randomized algorithms for adaptive adversary model) follow from this article, as does (cf. Sect. 3) the one for similarly ordered instances in oblivious adversary model; a reference next to one of these entries means that this particular bound was already known. The results without citations are implied by other entries of the table. An asterisk denotes that the algorithm attaining the bound is memoryless scale-invariant



(rand.) adaptive

(rand.) oblivious



1.828 [9], 1.893 [9]

1.582 [4]

1.582 [6]





similarly ordered


1.618 [16]


1.333 [13]







\(2-\frac{2}{s}+o(\frac{1}{s})^{*}\) [6]

\(1/ (1-(1-\frac{1}{s})^{s} )^{*}\)

\(1/ (1-(1-\frac {1}{s})^{s} )^{*}\)







1.618 [14]

1.333 [4]

1.25 [6]


1.618 [7, 12, 18]

1.333 [4]

1.25 [7]

For a general overview of techniques and results on buffer management, see the surveys by Azar [1], Epstein and Van Stee [10] and Goldwasser [11].

Uniform Sequences

An instance is s-uniform if the lifespan of each packet is exactly s. Such instances have been considered for two reasons. Firstly, there is a connection between them and the FIFO model of buffer management, also considered by Kesselmann et al. [14] (the connection itself stated in Corollary 5.5 therein). Secondly, the 2-uniform instances are among the most elementary restrictions that do not render the problem trivial. However, analyzing these sequences is not easy: while a simple deterministic \(\sqrt{2}\)-competitive algorithm for 2-uniform instances [18] is optimal among memoryless scale-invariant algorithms [6], for unrestricted algorithms, a sophisticated analysis shows the optimum competitive ratio is 1.377 [8].

Bounded Sequences

An instance is s-bounded if the lifespan of each packet is at most s; therefore every s-uniform instances is also s-bounded. The 2-bounded instances give rise to the strongest currently known lower bounds. These are ϕ≈1.618 for deterministic algorithms [7, 12, 18], 1.25 for randomized algorithms in the oblivious adversary model [7], and 4/3 in the adaptive adversary model [4]. For 2-bounded instances, algorithms matching these bounds are known [4, 6, 14]. A family of deterministic algorithms EDFβ is \(2-\frac{2}{s}+o(\frac{1}{s})\)-competitive for s-bounded instances [6]; β is a parameter suitably chosen as a function of s. Detailed analysis reveals that the ϕ-competitive deterministic algorithm for 2-bounded instances, itself a member of the EDFβ family, remains 3-competitive also on 3-bounded instances [6]. However, these algorithms’ competitive ratio guarantees present an improvement over Englert and Westermann’s algorithm only for small values of s.

Similarly Ordered Sequences

An instance is similarly ordered or has agreeable deadlines if for every two packets i and j their spanning intervals are not properly contained in one another, i.e., if ri<rj implies DiDj. Note that every 2-bounded instance is similarly ordered, as is every s-uniform instance, for any s. An optimal deterministic ϕ-competitive algorithm [16] and a randomized 4/3-competitive algorithm for the oblivious adversary model (as well as an alternative optimal deterministic algorithm) [13] are known for similarly ordered instances.

Other Restrictions

There are many other meaningful restricted variants of the problem, for which better algorithms are known. Interestingly, one of the optimal deterministic algorithms for similarly ordered instances [16] performs well in several restricted instance classes [15] (the performance of the other algorithm [13] was not studied). Let us mention one class of instances, studied by Kesselmann et al. in their seminal paper [14], for which our algorithm provides additional bounds: as various transmission protocols usually specify only several priorities for packets, it is sensible to bound the number of different packet weights.

Generalization: Collecting Weighted Items from a Dynamic Queue

The following generalization of Packet Scheduling has been studied [3], and called Item Collection by its authors. In Item Collection the algorithm is to collect weighted items, one per step, from a dynamic queue S, which is in fact an ordered list. The content of S varies over time, as it is updated between any two consecutive time steps. Such an update is performed by an external agent (the adversary), and consists of deleting any number of items at the front of S (a prefix of S) and inserting new items into arbitrary locations in S. Note that the collection is the algorithm’s action, not a queue update. However, the algorithm is allowed to collect an item only once, and only while it is in the queue. The objective is to maximize the total weight of the collected items.

Item Collection is easily seen to generalize Packet Scheduling: let the items in the queue correspond to packets, their locations in S determined by non-decreasing order of their deadlines, with ties broken arbitrarily. These items have the same weights as their corresponding packets, are inserted upon their release, and deleted upon expiration—ordering by deadlines ensures that a prefix of S is deleted.

Note that in Item Collection the algorithm does not know how many steps will lapse between deletions of two successive items in its queue—this is why ties between packets’ deadlines are broken arbitrarily in the reduction.

Some of the algorithms for Packet Scheduling extend to Item Collection, for example the greedy algorithm, which ignores the deadlines altogether. In general, any algorithm for Packet Scheduling that only compares packets’ deadlines, without resorting to their exact values, and can thus be presented with a list of packets ordered by their deadlines, extends to Item Collection. Among such algorithms are the EDFβ algorithms, RMix, and our algorithm ReMix—reader is advised to keep this in mind, because we present it for the more popular setting of Packet Scheduling.

While the paper of Bienkowski’s et al. [3] focuses on deterministic algorithms for Item Collection, it does provide a lower bound for memoryless randomized algorithms, matched by ReMix, cf. Sect. 5.3.

1.4 Our Contribution

We consider randomized algorithms against an adaptive adversary, motivated by the following observation. In reality, traffic through a switch is not at all independent of the packet scheduling algorithm. For example, lost packets are typically resent, and throughput through a node affects the choice of routes for data streams in a network. These phenomena can be captured by the adaptive adversary model but not by the oblivious one. The adaptive adversary model is also of its own theoretical interest and has been studied in other settings [5].

The main contribution of this paper is a simple memoryless scale-invariant algorithm ReMix, which unifies most of previously known randomized algorithms for Packet Scheduling. It also applies to the generalized Item Collection problem, for which it is optimal among memoryless randomized algorithms, cf. Sect. 5.3. As its name reflects, ReMix is very similar to RMix, proposed by Chin et al. [6]. The only, yet crucial difference between these two algorithms is the transmission’s probability distribution over pending packets. While RMix is essentially the EDFβ algorithm with β chosen in each step according to a fixed (same in every step) probability distribution, it is no longer so in ReMix.

This subtle change allows a refined analysis of ReMix, which yields an upper bound on the algorithm’s competitive ratio that depends on the maximum number of packets, over all steps, that have positive probability of transmission in the step. Specifically, if we denote that number by N, our upper bound on the competitive ratio of ReMix is \(f(n)=1/ (1-(1-\frac {1}{N})^{N} )\). Note that f(N) tends to e/(e−1) from below. The number N can be bounded a priori in certain restricted variants of Packet Scheduling, thus giving better bounds for them. Specifically, it is easily observed that Ns in instances with at most s different packet weights as well as in s-bounded instances. The particular upper bound of 4/3 we obtain for 2-bounded instances (known before) is optimal in the adaptive adversary model [4]; the bounds for s-bounded instances and s>2 (in both oblivious and adaptive adversary model) are new. Certain structural properties of optimum schedules for similarly ordered instances imply that N≤2 for that class of instances as well, at least in the oblivious adversary model, yielding an upper bound of 4/3 (also known before [13]). While details are given in Sect. 3, most of the implications are summarized in Table 1.

2 General Upper Bound

2.1 Analysis Technique

In our analysis, we follow the paradigm of modifying Adv’s buffer, introduced by Li et al. [16] (the development of this technique is covered in Sect. 4). Namely, we assume that in each step ReMix and Adv have precisely the same packets in their buffers. Once they both transmit a packet, we modify Adv’s buffer judiciously to make it identical with that of ReMix. This leads to a streamlined and intuitive proof.

When modifying the buffer, we may have to let Adv transmit another packet, inject an extra packet to his buffer, or upgrade one of the packets in its buffer by increasing its weight or deadline. We ensure that these changes are advantageous to the adversary in the following sense: for any adversary strategy Adv, starting with the current step and buffer content, there is an adversary strategy \(\overline{\textsc{Adv}}\) that continues computation with the modified buffer, such that the total gain of \(\overline{\textsc {Adv}}\) in this and the following steps, on any instance, is at least as large as that of Adv.

To prove R-competitiveness, we show that in each step the expected amortized gain of Adv is at most R times the expected gain of ReMix, where the former is the total weight of the packets that Adv eventually transmitted in this step. Both expected values are taken over random choices of ReMix.

We are going to assume that Adv never transmits a packet a if there is another pending packet b such that Adv is always better off by transmitting b. Formally, we introduce a dominance relation among the pending packets and assume that Adv never transmits a dominated packet.

We say that a packet a=(wa,da) is dominated by a packet b=(wb,db) at time t if at time t both a and b are pending, wawb and dadb. If one of these inequalities is strict, we say that a is strictly dominated by b. We also say that packet a is (strictly) dominated at time t if at that time there is a pending packet b that (strictly) dominates it. When a packet a is not strictly dominated, we call it a non-dominated packet (observe that a dominates itself). In Item Collection setting, a is dominated by b if b precedes a in the queue and wbwa; there is no distinction between dominance and strict dominance in Item Collection, since there are no ties between deadlines there.

Fact 1

For any adversary strategyAdv, there is a strategy\(\overline{\textsc{Adv}}\)such that:
  1. (i)

    the gain of\(\overline{\textsc{Adv}}\)on every sequence is at least the gain ofAdv,

  2. (ii)

    \(\overline{\textsc{Adv}}\)transmits a non-dominated packet in every step.



Adv can be transformed into \(\overline{\textsc{Adv}}\) by applying an exchange argument iteratively: take the minimum t0 such that Adv first violates (ii) in step t0, and transform Adv into an algorithm Adv′ with gain no smaller than that of Adv, which satisfies (ii) up to step t0, possibly violating it in further steps.

Let t0 be the first step in which (ii) is violated. Let y=(w,d) be the packet transmitted by Adv and x=(w′,d′) be a packet that strictly dominates y; then w′≥w and d′≤d. Let Adv′ transmit the same packets as Adv up to step t0−1, but in step t0 let it transmit x, and in the remaining steps let it try to transmit the same packets as Adv. It is impossible in one case only: when Adv transmits x in some step t. But then dd′>t, so let Adv′ transmit y, still pending at t. Clearly, (i) is preserved. □

The proof trivially extends to Item Collection.

We stress that Fact 1 holds for both oblivious and adaptive adversary model. Now we give an example of another simplifying assumption, common in the oblivious adversary model, which seems to break down in the adaptive adversary model.

In the oblivious adversary model the instance is fixed in advance by the adversary, so Adv may precompute the optimum schedule to the instance and follow it. Moreover, by standard exchange argument for the fixed set of packets to be transmitted, Adv may always send the packet with the smallest deadline from that set—this is usually called the earliest deadline first (EDF) property or order. This assumption not only simplifies analyses of algorithms but is often crucial for them to yield desired bounds [6, 8, 13, 16].

In the adaptive adversary model, however, the following phenomenon occurs: as the instance I is randomized, Adv does not know for sure which packets it will transmit in the future. Consequently, deprived of that knowledge, it cannot ensure any specific order of packet transmissions. For example, it might be the case that in one step Adv decides to transmit a packet x, and, depending on the outcome of the algorithm’s random choice, in the next step Adv might transmit either y or z, both pending for Adv already in the previous step, such that the deadlines of the three packets satisfy Dy<Dx<Dz. This example is elusive: while we are unable to preclude adversarial strategies of this kind, we are equally unable to come up with a specific instance where they would not be dominated by other adversarial strategies.

2.2 Algorithm and Its Analysis

Our algorithm roughly works as follows. In each step it finds a maximum chain of non-dominated pending packets h1,h2,…,hm, in decreasing order of weights, such that together they dominate all pending packets. By Fact 1, we may assume that Adv transmits one of those packets. ReMix chooses one of them at random, according to an appropriate probability distribution. The distribution is devised in such a way that the expected gain of ReMix in a step is on the one hand close to the maximum possible gain of Adv in that step, i.e., w(h1), but on the other hand it is spread over the whole chain to obfuscate the adversary. Details are presented in Algorithm 1.
Algorithm 1

ReMix (single step)

We introduce the packet h0 to shorten ReMix’s pseudocode. The packet itself is chosen in such a way that p0=0, to make it clear that it is not considered for transmission (unless h0=h1). The while loop itself could be terminated as soon as r=0, because afterwards ReMix does not assign positive probability to any packet. However, letting it construct the whole sequence h1,h2,…hm such that Hm=∅ streamlines our analysis. Before proceeding, we note that these easily follow from the algorithm.

Fact 2

The sequence of packetsh0,h1,…,hmselected byReMixsatisfies
Furthermore, every pending packet is dominated by one ofh1,…,hm.

Fact 3

The numbersp1,p2,…,pmform a probability distribution such that
$$ p_i \leq1-\frac{w_{i+1}}{w_i} \quad\text{\emph{for all} } i < m . $$
Furthermore, the bound is tight fori<n, whilepi=0 fori>n, i.e.,
$$ p_i = \begin{cases} 1-\frac{w_{i+1}}{w_i}, & \text{\textit{for} } i<n \\ 0, & \text{\textit{for} } i>n \end{cases} $$

With these, we can prove our main result.

Theorem 1

ReMixis\(1/ (1-(1-\frac{1}{N})^{N} )\)-competitive against an adaptive adversary, whereNis the maximum number of packets, over all steps, that are assigned positive probability in a step.


To prove the theorem, we will describe, for any given step, the changes to Adv’s scheduling decisions and modifications to its buffer that make it the same as ReMix’s buffer. These, as explained in Sect. 2.1, affect the adversary’s amortized gain. Having specified those, we will show that the expectations of the adversary’s amortized gain and the algorithm’s gain satisfy
where n is the number of packets assigned positive probability in the step. The theorem follows by summation over all steps.
We begin by describing modifications to Adv’s buffer. To this end, recall that, by Fact 1, Adv (wlog) sends a packet that is non-dominated. By Fact 2, the packets h1,h2,…hm dominate all pending packets, so the one sent by Adv, say p, is (wlog) one of h1,h2,…hm: if p is dominated by hi, but not strictly dominated, then p has the same weight and deadline as hi. The modifications to Adv’s buffer depend on the relation between the two non-dominated packets that Adv and ReMix transmit in the step. Suppose that Adv transmits hz=(wz,dz) whereas ReMix transmits (the randomly chosen) hf=(wf,df), respectively. Then there are two cases.
Case 1:

dfdz. Note that in this case wfwz, since hz is non-dominated. After both Adv and ReMix transmit their packets, we replace hf in the buffer of Adv by a copy of hz. This way their buffers remain the same afterwards, and the change is advantageous to Adv: this is essentially an upgrade of the packet hf in its buffer, as both dfdz and wfwz hold.

Case 2:

df>dz. After both Adv and ReMix transmit their packets, we let Adv additionally transmit hf, and we inject a copy of hz into its buffer, both of which are clearly advantageous to Adv. This makes the buffers of Adv and ReMix identical afterwards.

Now that we have specified the modifications, we can bound the adversary’s expected amortized gain, i.e., prove (5), For convenience, denote the amortized gain of Adv when it transmits hz by \(\mathcal{G}_{\scriptsize\textsc{Adv}}^{({z})}\). Clearly, \(\mathcal{G}_{\scriptsize\textsc{Adv}}^{({z})}\) is a random variable that equals wz+wf if dz<df (equivalently, z>f), and wz otherwise. Thus, when Adv transmits hz, its expected amortized gain is
$$ \mathbb{E} \bigl[\mathcal{G}_{\scriptsize\textsc {Adv}}^{({z})} \bigr] = w_z + \sum_{i<z} p_i w_i . $$
As the adversary’s expected amortized gain satisfies
$$ \mathbb{E} [\mathcal{G}_{\scriptsize\textsc{Adv}} ] \leq \max_{1\leq j \leq m} \bigl\{ \mathbb{E} \bigl[\mathcal{G}_{\scriptsize\textsc{Adv}}^{({j})} \bigr] \bigr\} , $$
to establish (5), we will prove that
$$ \max_{1\leq j \leq m} \bigl\{ \mathbb{E} \bigl[ \mathcal {G}_{\scriptsize\textsc{Adv}}^{({j})} \bigr] \bigr\} \leq\mathcal{G}_{\scriptsize\textsc{Adv}}^{({1})} = w_1 . $$
The equality in (9) follows trivially from (7). To see that the inequality in (9) holds as well, observe that, by (7), for all j<m,
$$ \mathbb{E} \bigl[\mathcal{G}_{\scriptsize\textsc {Adv}}^{({j})} \bigr] - \mathbb{E} \bigl[\mathcal{G}_{\scriptsize \textsc{Adv}}^{({j+1})} \bigr] = w_j - w_{j+1} - p_j w_j \geq0 , $$
where the inequality follows from (3). This end the proof of (5).
Now we turn to (6), the bound on the expected gain of ReMix in a single step. Obviously,
$$ \mathbb{E} [\mathcal{G}_{\scriptsize\textsc{ReMix}} ] = \sum _{i=1}^n p_i w_i . $$
By (4), piwi=wiwi+1 for all i<n. Also, pn=1−∑i<npi, by Fact 3. Making corresponding substitutions in (11) yields
As (4) implies wi=wi−1(1−pi−1) for all in, we can express wn as
$$ w_n = w_1 \prod_{i=1}^{n-1} (1-p_i) . $$
Substituting (13) for wn in (12), we obtain
$$ \mathbb{E} [\mathcal{G}_{\scriptsize\textsc{ReMix}} ] = w_1 \Biggl(1- \prod_{i=1}^{n-1} (1-p_i) \sum_{i=1}^{n-1} p_i \Biggr) . $$
Let xi=1−pi for 1≤i<n and let \(x_{n}=\sum_{i=1}^{n-1} p_{i}\); note that \(\sum_{i=1}^{n} x_{i}=n-1\). The inequality between arithmetic and geometric means for x1,…,xn yields
$$ \prod_{i=1}^{n-1} (1-p_i) \sum_{i=1}^{n-1} p_i = \prod_{i=1}^{n} x_i \leq \biggl(\frac{\sum_{i=1}^n x_i}{n} \biggr)^n = \biggl(1- \frac{1}{n} \biggr)^n . $$
Plugging (15) into (14) yields
$$ \mathbb{E} [\mathcal{G}_{\scriptsize\textsc{ReMix}} ] \geq w_1 \biggl( 1 - \biggl(1-\frac {1}{n} \biggr)^n \biggr) , $$
which proves (6), and together with (5), the theorem. □

3 Application to Similarly Ordered and Other Restricted Instances

We have already mentioned that for s-bounded instances or those with at most s different packet weights, Nms in Theorem 1, which trivially follows from Fact 2. Thus for either kind of instances ReMix is \(1/ (1-(1-\frac {1}{s})^{s} )\)-competitive. In particular, on 2-bounded instances ReMix coincides with the previously known optimal 4/3-competitive algorithm Rand [4] for the adaptive adversary model.

While in a similarly ordered instance the number of non-dominated pending packets in any step can be arbitrarily large, surprisingly enough, in every step an oblivious adversary (wlog) transmits a packet from a set \(\mathcal{H}\) of at most two packets that can be identified by the algorithm, assuming (as we did throughout the analysis) that the same packets are pending for the algorithm and the adversary. Hence, on such instances ReMix is 4/3-competitive against oblivious adversary, provided that H0 is initialized to \(\mathcal{H}\) in every step.

This surprising fact follows from Lemma 2, which we state and prove at the end of this section. As that lemma describes a property of optimum (offline) schedules, it applies to an oblivious adversary’s schedule only. The end result, i.e., a 4/3-competitive algorithm was known before [13], as was in fact Lemma 2 itself. The lemma’s and the analysis technique’s origins and development are surveyed in Sect. 4.

Before we proceed, we need to inspect some basic properties of schedules. Formally, a schedule is an injective function that assigns packets to time steps within their lifespans. It can thus be thought of as a matching in a bipartite graph whose partitions are the packets and the steps respectively, and edges connect packets to the steps in their lifespans. The edges incident to a packet are assigned the packet’s weight, in a sense making the graph vertex- rather than edge-weighted. Naturally, an optimal schedule for a set of packets corresponds to a maximum weight matching in the corresponding graph; for a set of packets X we denote that graph by GX. Structural properties of optimum schedules and algorithms to find them thus follow from those of and for matchings.

Firstly, we note a relation between optimum schedules for sets of packets Q and Q′ such that QQ′. While the lemma seems obvious and its proof is a simple reasoning about matchings, we prove it for completeness.

Lemma 1

LetQandQbe two sets of packets such thatQQ′. Then for every optimum scheduleSforQthere exists an optimum scheduleSforQsuch that the set inclusionS′∩QSholds


Let S and S″ be any given optimum schedules for Q and Q′ respectively. We demonstrate how to obtain an optimum schedule S′ for Q′ that satisfies S′∩QS. To this end view both S and S″ as matchings in GQ and consider their symmetric difference SS″, which is a disjoint sum of alternating paths and cycles. Unless there is some packet jS″∩QS, we are done by letting S′=S″. Note that such jS″∩QS is an endpoint of some alternating path P in SS″. In the following we will consider augmenting either S or S″ along P—such operation results in a matching representing some schedule. Note that all packets in P come from Q, as they are scheduled in S.

First we prove that P has even length, i.e., it ends in a vertex corresponding to a packet from Q′. Assume for contradiction that P’s length is odd, in which case P ends in a vertex corresponding to a time step t′∈T, i.e., no packet is assigned to t′ in S. Then the matching SP yields a schedule for Q that satisfies the set inclusion S∪{j}⊆SP, contradicting optimality of S. See Fig. 1(a) for an illustration.
Fig. 1

The alternating path P. Packets are represented by discs, time steps by squares. Dashed lines represent S″, solid lines represent S

Hence P has even length and thus ends with a vertex corresponding to a packet j′∈SS″. Both S and S″ can be augmented using P, and in terms of packets scheduled this operation simply swaps j and j′. Thus wj=wj follows from optimality of both S and S″. Hence S″⊕P is a matching in GQ of the same weight as S″, i.e., it is also an optimum schedule for Q′. See Fig. 1(b) for an illustration.

Applying such changes iteratively transforms S″ to S′ such that S′∩QS. To observe that a finite number of iterations suffices, define Δ(X):=|XQS| for any schedule X. It follows that Δ(S″⊕P)=Δ(S″)−1. Since Δ is non-negative and its value drops by one with each iteration, S′ is obtained in a finite number of steps. □

In our case, Q will be the set of packets pending for ReMix (or Adv, since these sets are the same in our analysis) at a certain step, with the lifespans of the packets restricted to that and future steps. A schedule for Q is typically called a provisional schedule. The set Q′, on the other hand, will be the union of Q with the set of all packets to be released in the future steps of the instance. Then Lemma 1 implies that (wlog) Adv is going to transmit one of the packets from the optimum provisional schedule. Obviously, there can be arbitrarily many packets in that schedule but in similarly ordered instances the sets Q and Q′ have additional properties, and Lemma 1 can be accordingly strengthened.

Lemma 2

Lettbe a step, and letQandQbe two sets of packets such thatrj=tfor alljQ, QQ′, t<min{rjjQ′∖Q}, and max{DjjQ}≤min{DjjQ′∖Q}. Also, letSbe an EDF-ordered optimal schedule overQ. Then, ifSis non-empty, there exists an optimal schedule Sover Qsuch that in step teither eor his transmitted in S′, where eand hare any earliest-deadline and any maximum-weight packet from Srespectively.


We assume (wlog) that S is EDF-ordered in such a way that S(t)=e. Let X be an optimal schedule over Q′ that starts in time step t such that XQS—its existence is guaranteed by Lemma 1. Moreover, we assume (wlog) that X is EDF-ordered in such a way that the packets from SX appear in X in exactly the same order as in S, and that they are all assigned before those from Q′∩X. If eX, then we let S′=X, and we are done.

Otherwise, observe that since X is optimal, it assigns some packet zQ to time step t. If hX, then we let S′ be X with h substituted for z—such S′ is optimal, as whwz. Otherwise, we claim that S′ can be obtained by reordering X so that h is assigned to time step t. To prove it, let us enumerate the packets from S in the order they are assigned: j1,j2,…,js. Observe that e=j1, z=jk, and h=jl for some 1<k<ls, by our assumptions (k<l, because z is assigned before h in both X and S). Let di denote the relative deadline of ji at time t, 1≤is. Then dii for i=1,…,s.

As e=j1X and dii for i=1,…,s, all the packets xXS have slack in X, i.e., they are not tight at the beginning of time steps they are assigned to, and thus could also be scheduled one step later. Hence we obtain S′ by the following reordering of X. Firstly, h=jl is assigned to time step t in S′. Then, for every packet xX∖{h} in the increasing order of X−1(x), the packet x is assigned to time step X−1(x) in S′ if this step was yet unassigned and otherwise it is assigned to step X−1(x)+1. Note that since we freed the time step X−1(h) in S′ by assigning h to time step t, for all τ>X−1(h) it holds that S′(τ)=X(τ). In particular, all the packets from X are assigned before their deadlines in S′. The reordering is illustrated in Fig. 2.
Fig. 2

Construction of the schedule S′. Packets from S are represented by circles: the ones included in S′ are filled, the remaining ones are hollow. The packets from S′∖Q are not illustrated, since their assignment does not change with respect to X


4 Origins and Development of Analysis Technique

As mentioned before, our analysis technique can be traced back to the article that introduced the first optimal deterministic algorithm for similarly ordered instances [16]. The principle of modifying Adv ’s buffer and Lemma 2 both appear there, though densely interwoven. Furthermore, the core analysis therein relied on obliviousness of the adversary (i.e., it following an optimal schedule) more than it was necessary: in what corresponds to Case 2 (df>dz) in our Proof of Theorem 1, Li et al. [16] first noted that in Adv’s (optimal) schedule f is transmitted later anyway, only then concluding that Adv may thus be allowed to transmit both z and f.

A later article about similarly ordered instances [13] separated the principle of the analysis and Lemma 2, though not completely. While the algorithm therein coincides with ReMix with H0 initialized to \({\mathcal{H}}=\{e,h\}\) (as defined in Lemma 2), in the analysis the lemma was used only to handle some of the cases (specifically, that of the algorithm transmitting he and Adv transmitting je), rather than to notice beforehand that (wlog) Adv transmits either e or h, just like the algorithm.

Subsequently, the technique was applied to analyze two algorithms for the adaptive adversary model: Rand, the optimum algorithm for 2-bounded instances, and RMix [4]. Comparing the preliminary conference version of [4] to the final one is illustrative: the original analysis of Rand used a potential function argument, which resulted in a longer proof with larger number of cases; also, it did not give any analysis of RMix, claiming that the original one [6] extends to the adaptive adversary model.

5 Probability Distribution and Tightness

In this section we prove tightness of our analysis, for all values of the parameter N. We begin with explaining how the probability distribution used by the algorithm was chosen; while it does not prove anything on its own, hopefully it is illuminating. Then we give Packet Scheduling instances that actually prove tightness, and finally we note that the algorithm is optimal (in the class of memoryless algorithms) for the generalized problem of Item Collection. All these have some implications, as we explain in Sect. 6.

5.1 Probability Distribution Rationale

Recall that the upper bound on the competitive ratio of ReMix is
$$ \frac{\max_{1\leq z \leq m} \{ \mathbb{E} [\mathcal {G}_{\scriptsize\textsc{Adv}}^{({z})} ] \}}{\mathbb{E} [\mathcal{G}_{\scriptsize\textsc{ReMix}} ]} , $$
irrespective of the choice of p1,…,pm.

The particular probability distribution used in ReMix is chosen to (heuristically) minimize the above ratio by maximizing \(\mathbb {E} [\mathcal{G}_{\scriptsize\textsc{ReMix}} ]\), while keeping (9) satisfied, which, together with (8), implies \(\mathbb{E} [\mathcal {G}_{\scriptsize\textsc{Adv}} ]\leq \mathcal{G}_{\scriptsize\textsc{Adv}}^{({1})}=w_{1}\).

The first goal can be trivially achieved by setting p1←1 but that would make \(\mathbb{E} [\mathcal{G}_{\scriptsize\textsc {Adv}}^{({z})} ] > w_{1}\) for all z>1. Therefore, some of the probability mass is transferred to p2,p3,… in the following way. To keep \(\mathbb{E} [\mathcal{G}_{\scriptsize\textsc {ReMix}} ]\) as large as possible, p2 is greedily set to its maximum, if there is any unassigned probability left, p3 is set to its maximum, and so on. As \(\mathbb{E} [\mathcal{G}_{\scriptsize \textsc{Adv}}^{({z})} ]\) does not depend on pi for iz, the values \(\mathbb{E} [\mathcal{G}_{\scriptsize \textsc{Adv}}^{({z})} ]\) can be equalized with w1 sequentially, with z increasing, until there is no unassigned probability left. Equalizing \(\mathbb{E} [\mathcal{G}_{\scriptsize\textsc {Adv}}^{({j})} ]\) with \(\mathbb{E} [\mathcal {G}_{\scriptsize\textsc{Adv}}^{({j-1})} ]\) consists in setting \(p_{j-1} \gets1- \frac{w_{j}}{w_{j-1}}\), as shown in (10). The same inequality shows what is intuitively clear: once there is no probability left and further values \(\mathbb{E} [\mathcal{G}_{\scriptsize\textsc{Adv}}^{({z})} ]\) cannot be equalized, they are only smaller than w1.

5.2 Tightness of Analysis

We present a simple Packet Scheduling instance that proves tightness of our analysis even in the oblivious adversary model; in fact, all the packets in this instance are released at once.

Let N be any positive integer and let TN be another integer. Let h1,h2,…,hN be a sequence of packets such that hi has weight wi=(1−1/N)i and absolute deadline Di=Ti. The instance starts at time 0, when T copies of each of h1,h2,…,hN are released. Note that in each step up to TN−1 inclusively, ReMix will find a chain of N packets: copies of h1,h2,…,hN—this is because it ignores the abundance of copies, whose number is enough so that the algorithm does not run out of hi’s copies (1≤iN) before they expire. It is easy to observe that ReMix will assign probability 1/N to a copy of hi for each i in each of these steps, and that its expected gain in each of these will be \((1-(1-\frac{1}{N})^{N} ) \cdot w_{1}\) because the sequence of weights w1,w2,…,wN (and the resulting sequence of probabilities p1,p2,…,pN) makes the inequalities (10) and (16) tight. In each of those steps, Adv transmits a copy of h1, gaining w1 per step. The last N−1 steps have negligible impact on both players’ gains, since NT. Hence, ReMix’s competitive ratio on these instances is arbitrarily close to \(1/ (1-(1-\frac {1}{N})^{N} )\).

As one readily observes, these instances are rather artificial: should the algorithm consider only the packets from the optimum provisional schedule in each step, it would gain just as much as Adv; such modification of ReMix is justified by Lemma 1. The same is true for all the variations of this instance we could think of crafted for the oblivious adversary model, i.e., with packet releases specified upfront. We don’t know any instance showing the tightness of our analysis of such a variation of ReMix in the oblivious adversary model. Therefore it is possible that such a variation of the algorithm attains better competitive ratio, if only in the oblivious adversary model.

In fact, in the adaptive adversary model our simple instance is easily modified in such a way that determining the optimum provisional schedule does not affect ReMix’s behavior. Let us sketch the modification: initially, only a single copy of each of h1,h2,…,hN is released, together with a tight (i.e., expiring at the beginning of the very next step) packet of weight wN+1:=wN⋅(1−1/N)=(1−1/N)N+1. Note that introduction of this packet does not affect ReMix’s probability distribution. In this step Adv transmits the packet ignored by ReMix. Then, for a number of steps much larger than N, say T/2, the adversary does the following: it releases a copy of the packet that ReMix last transmitted, and a single tight packet of weight wN+1. In each such step Adv transmits the latter packet, whereas ReMix transmits a copy of one of h1,h2,…,hN, chosen uniformly at random. The expected gain of ReMix in each step is the same as in the previous instance, i.e., \((1-(1-\frac{1}{N})^{N} ) \cdot w_{1}\). Afterwards, no further packets are released, and both players can transmit whatever packets are still pending for them. Again, ReMix’s gain for that is insignificant, since NT but in the remaining T/2 steps Adv will transmit all the packets that ReMix transmitted in previous steps. Hence, one might think that in each of the first T/2 steps Adv gains wN+1 for transmitting its packet plus the packet that ReMix transmits, as it were in our amortized analysis. Then Adv’s expected amortized gain in each of those steps is almost 1: precisely, it is \(w_{1} \cdot (1-(1-\frac{1}{N})^{N} ) + w_{N+1} = w_{1} \cdot (1-(1-\frac{1}{N})^{N}/N )\), which tends to 1 as N grows. Hence, the competitive ratio of ReMix on this instance also tends to e/(e−1) as N tends to infinity.

5.3 Optimality for Item Collection

As we mentioned before, ReMix is optimal among randomized memoryless algorithms for Item Collection [3, Theorem 7]. In fact, as noted therein, the lower bound proof gives an infinite sequence of adversary’s strategies parametrized by N such that the N-th one forces ratio \(1/ (1-(1-\frac{1}{N})^{N} )\), while ensuring that the number of packets pending for the algorithm never exceeds N. In such case ReMix is guaranteed to match that ratio, hence being the optimal randomized memoryless algorithm for Item Collection in a strong sense. We note though that, unlike the s-bounded instances of Packet Scheduling, any class of instances (parametrized by N) that would contain the ones defined in the lower bound construction would make little sense on their own: while at all times the algorithm has at most N packets pending, the lifespans of the packets are not restricted at all; in fact, the adversary successively “gathers copies” of the packets pending for the algorithm, only to transmit them all once no further packets are issued; while the proof is technically more involved, the basic idea in this lower bound is similar to the one behind the second instance discussed in Sect. 5.2. Note that this lower bound gives independent evidence that (17) is indeed minimized by the heuristic described in Sect. 5.1.

6 Conclusion

Our algorithm ReMix is very simple to analyze, yet it unifies almost all previous randomized algorithms for packet scheduling (the optimum algorithm against oblivious adversary for 2-bounded instances [6] is the only exception), all the while providing new bounds for some restricted variants of the problem, thanks to its universal analysis. However unlikely it seems, it may potentially yield further non-trivial upper bounds, should one be able to confine the adversary’s choice of packets for transmission for some class of instances in a similar manner to the one described in Sect. 3 for similarly ordered instances.

As explained in Sect. 5.3, ReMix is an optimal randomized memoryless algorithm for Item Collection. Therefore, to beat either the general bound of e/(e−1), or any of the \(1/ (1-(1-\frac{1}{s})^{s} )\) bounds for s-bounded instances for Packet Scheduling, one either needs to consider algorithms that are not memoryless scale-invariant, or better utilize the knowledge of exact deadlines—in the analysis at least, if not in algorithm itself.

This might be achieved with the very same algorithm if H0 is always initialized to (the set of packets included in) the optimum provisional schedule as discussed in Sect. 5.2. Note that resorting to an optimal provisional schedule takes the deadline values into account, so the lower bound for Item Collection no longer applies. It is conceivable that randomized algorithms might benefit from consulting the optimal provisional schedule, as there are already several algorithms that do so [9, 13, 16, 17]. However, among those the only randomized algorithm is the one for similarly ordered instances.

Bridging the gaps in any unresolved variant remains an obvious open problem. Let us point out that settling the question whether one may assume that an adaptive adversary obeys an EDF rule makes for another interesting question. Should the answer be affirmative, the 4/3 upper bound for similarly ordered instances would apply not only to the oblivious but also adaptive adversary model, and would be optimal for the latter.


This work was supported under the Polish Ministry’s of Science and Higher Education grant N N206 368839, 2010–2013, Approximation algorithms under uncertainty, and Grant Agency’s of the Academy of Sciences of the Czech Republic project IAA100190902, 2009–2013, Mathematical logic, complexity, and algorithms.

Copyright information

© The Author(s) 2012

Open Access This article is distributed under the terms of the Creative Commons Attribution License which permits any use, distribution, and reproduction in any medium, provided the original author(s) and the source are credited.

Authors and Affiliations

  1. 1.Institute of Computer ScienceUniversity of WrocławWrocławPoland
  2. 2.Institute of MathematicsAcademy of Sciences of the Czech RepublicPraha 1Czech Republic