1 Introduction
The online buffer management problem proposed by Aiello et al. [1] formulates the management of buffers to store arriving packets in a network switch with Quality of Service (QoS) support as an online problem. This problem has received much attention among online problems and has been studied for the last fifteen years, which leads to developing various variants of this problem (see comprehensive surveys [16, 28]). Kesselman et al. [23] proposed the bounded delay buffer management problem as one of the variants, whose definition is as follows: Packets arrive to a buffer over time. A packet is specified by the release time , value and deadline . An algorithm is allowed to transfer at most one packet at each integer time. If the algorithm transmits a packet between its release time and deadline, it can gain its value as the profit. The objective of this problem is to maximize the gained profit. The performance of an online algorithm for this problem is evaluated using competitive analysis [11, 29]. If for any problem instance, the profit of an optimal offline algorithm is at most times that of an online algorithm , then we say that the competitive ratio of is at most . We call a problem instance the bounded instance (or bounded delay buffer management problem) in which for any packet , . For any , Hajek [18] showed that the competitive ratio of any deterministic algorithm is at least . Also, it is conjectured that for any , there exists a deterministic algorithm with a competitive ratio of (see, e.g. [16]), which has not been proved yet.
There is much research among online problems to reduce the competitive ratio of an online algorithm for the original problems by adding extra abilities to the algorithm. One of the major methods is called the lookahead ability, with which an online algorithm can obtain information about arriving packets in the near future. This ability is introduced to various online problems: The bin packing problem [17], the paging problem [2, 12], the list update problem [3], the scheduling problem [27] and so on. Then, Böhm et al. [10] introduced the lookahead ability to the bounded delay buffer management problem, that is, they gave an online algorithm for this problem an ability to obtain the information about future arriving packets and analyzed its performance.
Previous Results and Our Results. Böhm et al. [10] studied the 2bounded bounded delay buffer management problem with lookahead. They designed a deterministic algorithm whose competitive ratio is at most . Also, they proved that the competitive ratio of any deterministic algorithm is at least .
In this paper, we showed an optimal online algorithm for this problem, that is, its competitive ratio is exactly .
Related Results. As mentioned above, for the bounded delay model without lookahead, Hajek [18] showed that the competitive ratio of any deterministic algorithm is at least in the case of . Independently, this bound was also shown in [13, 4, 30]. For , Englert and Westermann [15] developed a deterministic online algorithm whose competitive ratio is at most , which is the current best upper bound. For each [23], 3 [5, 9], and 4 [10], an algorithm with a competitive ratio of was designed. For any , an algorithm with a competitive ratio of larger than but less than 2 was shown [5, 9]. Moreover, in the case where an algorithm must decide which packet to transmit on the basis of the current buffer situation, called the memoryless case, some results were shown [5, 9, 15]. The agreeable deadline variant has also been studied. In this variant, the larger the release times of packets are, the larger their deadlines are. Specifically, for any packets and , if . The lower bound of by Hajek [18] is applicable to this variant. Li et al. [25, 21] displayed an optimal algorithm, whose competitive ratio matches the lower bound. The case in which for any packet , has also been studied, called the uniform delay variant, which is a specialized variant of the agreeable deadline variant. The current best upper and lower bounds for this variant are [25, 21] and [14], respectively.
The research on randomized algorithms for the bounded delay buffer management problem has also been conducted extensively [13, 5, 9, 6, 19, 20, 21, 22]. In the case in which is general, the current best upper and lower bounds are [5, 9, 22] and [13], respectively, against an oblivious adversary were shown. Upper and lower bounds of [6, 22] and [6], respectively, against an adaptive adversary were shown. For any fixed , lower bounds are the same with the bounds in the case in which is general while upper bounds are [22] against the both adversaries.
A generalization of the bounded delay buffer management problem has been studied, called the weighted item collection problem [7, 8, 22]. In this problem, an online algorithm does not know the deadline of each packet but knows the relative order of the deadlines of packets. Many other variants of the buffer management problem have been studied extensively (see e.g. [16, 28]).
2 Model Description
We formally give the definition of the 2bounded delay buffer management problem with lookahead, which is addressed in this paper. An input of this problem is a sequence of phases. Time begins with zero and a phase occurs at an integer time. Each phase consists of three subphases. The first occurring subphase is the arrival subphase. At an arrival subphase, arbitrary many packets can arrive to a buffer. The buffer has no capacity limit and hence, all arriving packets can always be accepted to the buffer. A packet is characterized by the release time, deadline and value, denoted by , and respectively. Arrival times and deadlines are nonnegative integers and values are positive reals. holds because we focus on 2bounded instances. The second subphase is the transmission phase. At a transmission subphase, an algorithm can transmit at most one packet from its buffer if any packet. At the transmission subphase at a time , the algorithm can obtain the information about packets arriving at time using the lookahead ability. The third subphase is the expiration subphase. At an expiration subphase, a packet which has reached its deadline is discarded from its buffer. That is, at the expiration subphase at a time , all the packets in the buffer such that are discarded.
The profit of an algorithm is the sum of the values of packets transmitted by the algorithm. The objective of this problem is to maximize the gained profit. Let denote the profit of an algorithm for an input . Let be an optimal offline algorithm. We say that the competitive ratio of an online algorithm is at most if for any input , .
For ease of analysis, we assume that when does not store any packet in its buffer, the input is over. It is easy to see that this assumption does not affect the performance analysis of an algorithm.
3 Matching Upper Bound
3.1 Notation and Definitions for Algorithm
We give definitions before defining our algorithm CompareWithPartialOPT (). For any integer time , denotes the set of packets in ’s buffer immediately before the arrival subphase at time . That is, each packet in the set is not transmitted before , and . For integer times and and an input , let be an offline algorithm such that if the packets in ’s buffer immediately before the arrival subphase at time is equal to those in , and the subinput of during time is given to , that is, packets such that arrive to ’s buffer during time , then is allowed to transmit packets only from time to inclusive, and chooses the packets whose total profit is maximized. If there exist packets with the same value in ’s buffer, follows a fixed tie breaking rule. Also, denotes the set of packets transmitted by during time . Note that for any and , the following relations hold because of the optimality of packets transmitted by during time :
(1) 
(2) 
and
(3) 
We define for any and ,
and
Also, we define
Furthermore, we describe each value in the algorithm definition for ease of presentation as follows:
and
In addition,
and
uses the internal variable for holding the name of a packet which transmits at a time . null holds at first for any integer . uses the two constants tmp1 and tmp2 if at time , cannot decide which packet to transmit at in Cases 1.2.3.4 and 2.2.2.3. On the other hand, once the name of a packet is set to at time , certainly transmits the packet at .
3.2 Algorithm
CompareWithPartialOPT ()
Initialize:
For any integer time ,
null.
Consider the transmission subphase at a time .
If the buffer stores no packets,
do nothing.
Otherwise,
do one of the following three cases and then
transmit the packet whose name is set to .
Case 1 (null):
Case 1.1 ():
.
Case 1.2 ():
Case 1.2.1 ():
and .
Case 1.2.2 ():
and .
Case 1.2.3 ():
Case 1.2.3.1 ( and ):
and .
Case 1.2.3.2 ( and ):
and .
Case 1.2.3.3 ( and ):
and .
Case 1.2.3.4 ( and ):
and tmp1.
Case 2 (tmp1):
Case 2.1 ():
and .
Case 2.2 ():
Case 2.2.1 ():
and .
Case 2.2.2 ():
Case 2.2.2.1 ():
.
Case 2.2.2.2 ( and ):
and .
Case 2.2.2.3 (Otherwise):
and tmp2.
Case 3 (tmp2):
Case 3.1 ():
and .
Case 3.2 ():
Case 3.2.1 ():
and .
Case 3.2.2 ( and ):
.
Case 3.2.3 ( and ):
and .
3.3 Overview of the Analysis
Consider a given input . Let be the time at which transmits the last packet. We partition the time sequence into sequences to evaluate the competitive ratio of , in which depends on and if , then , , and for any , . The size of each depends on which case executes at each time. Specifically, it is defined as follows: Suppose that and then

If Case 1.1 is executed at , then .

If Case 1.2.1, 1.2.2, 1.2.3.1, 1.2.3.2 or 1.2.3.3 is executed at , then .

If Case 1.2.3.4 is executed at and Case 2.1, 2.2.1 or 2.2.2.2 at , then .

If Cases 1.2.3.4 and 2.2.2.1 are executed at and , respectively, then .

If Cases 1.2.3.4 and 2.2.2.3 are executed at and , respectively, and Case 3.1, 3.2.1 or 3.2.3 is executed at , then .

If Cases 1.2.3.4 and 2.2.2.3 are executed at and , respectively, and Case 3.2.2 is executed at , then .
For a time , a packet whose release time is and deadline is is called a packet. On the other hand, we also partition the time sequence into time sequences , in which is the time at which transmits the last packet. We will compare the total value of packets transmitted by during the time with that by during the time . is defined as follows: Suppose that . Then, we define , in which if transmits a packet at time and transmits at time , then and otherwise, . Moreover, if transmits a packet and transmits at time , then . Otherwise, .
We give the lemma about .
Lemma 3.1
A time is contained in some .

We prove this lemma by contradiction and assume that a time is not contained in any . By the assumption of a given input, transmits a packet at . If transmits a packet at , then is contained in some and is contained in either or by the definition of . Thus, does not store any packet at and does not transmit a packet. That is, no packets arrive at . A packet transmitted by at is a packet. If not, can transmit at . Hence, transmits at time . By the definition of , executes Case 1.2.3.2, 1.2.3.3, 2.2.2.2 or 3.2.3 and transmits at , which is the last time of . Therefore, is contained in by the definition of , which contradicts the above assumption.
For any , let () denote the total value of packets transmitted by () during (). By definition,
By Lemma 3.1,
Since
we have using Lemma 3.7,
Therefore, we have the following theorem:
Theorem 3.2
The competitive ratio of is at most .
3.4 Analysis
To show Lemma 3.7, we first prove the following lemmas. Let denote the total value of packets in . That is, .
Lemma 3.3
For integer times and , suppose that and a packet that transmits at is not a packet. Then, .

Suppose that . First, we consider does not transmit a packet at time . Then, by definition,
(4) Furthermore, all the packet, which arrive at , are stored in ’s buffer at time . Hence, since we discussed the 2bounded instance in this paper, all the packets in ’s buffer at are stored in ’s buffer. Thus, by the optimality of from Eq. (4),
Next, we consider the case in which transmits a packet at . First, let us consider the case in which does not transmit at . By definition,
(5) At time , ’s buffer may store but ’s buffer does not. However, it does not affect a packet which transmits at whether is stored in ’s buffer because does not transmit at . Hence, by the optimality of from Eq. (5),
Second, we discuss the case in which transmits at . By definition,
Therefore,
in which the second inequality follows from Eq. (3).
Lemma 3.4
For integer times and , suppose that and a packet that transmits at is a packet. Then, .

Suppose that . We have in a similar way to the proof of Lemma 3.3, either or . Thus,
Hence, by Eq. (2),
Second, we consider the case in which transmits a packet at which transmits at . If transmits a packet at and transmits at , then . Otherwise, . In the either case, we have in a similar way to the proof of Lemma 3.3,
Since transmits a packet at time which arrives at time , packets arriving at does not matter to . Thus,
which leads to
Lemma 3.5
Let be an integer time. If executes Case 2.2.2.1 at time , then transmits and at times and , respectively.

Suppose that Case 2.2.2.1 is executed at a time . Then, note that by the condition of Case 2.2.2.1. First, let us consider the case in which . By the definition of , . However, is neither nor by the definition of . Also, obtains a higher profit by in instead of in . That is, . Thus, , which contradicts the optimality of .
In the following, we consider the case in which . contains one packet which transmits at time . Also, contains , which is not in . transmits at or after . Furthermore, because by the condition of Case 2.2.2. In a similar way to the proofs of Lemmas 3.3 and 3.4, we can show that packets in ’s buffer at is included in ones in ’s buffer at . Therefore, transmits and at or after and transmits and at and .
Lemma 3.6
Let be an integer time. If executes Case 3.2.2 at time , then transmits , and at times , and , respectively.

We can show the proof of this lemma in a similar way to the proof of Lemma 3.5. Suppose that Case 2.2.2.3 is executed at a time and Case 3.2.2 is executed at . Note that by the condition of Case 2.2.2.3 and by the condition of Case 3.2.2. If , then can transmit during time instead of concerning , which contradicts the optimality of .
Thus, . contains one packet transmitted by at time . Also, contains , which is not in , and transmits at or after . Moreover, since by the condition of Case 2.2.2, . Therefore, transmits and at or after and transmits , and during time .
We are ready to prove Lemma 3.7.
Lemma 3.7
.

Suppose that executes Case 1 at a time and is contained in . Note that if executes Case 1.2.3.4 at , then executes Case 2 at time . Moreover, if executes Case 2.2.2.3 at , then executes Case 3 at time . For ease of presentation, and denote and , respectively.
Before proceeding to the proof, we give some inequalities used often later. When executes Case 1.2.3.4 at , by the condition of Case 1.2.3.4,
(6) and
(7) When executes Case 2.2 at ,
(8) When executes Case 3.2 at ,
(9) When executes Case 2.2.2.3 at ,
By rearranging this inequality, we have
(10) Now we discuss the profit ratio for the execution of each case. When executes Case 1.1, transmits at and . On the other hand, by Lemma 3.3. Thus, .
When Case 1.2.1 or 1.2.2 is executed, transmits both and and . By Lemma 3.3, . Thus, .
We consider Case 1.2.3.1. transmits and at times and , respectively, by definition. Thus,
Since by the definition of , by Lemma 3.3,
Hence,
in which the second inequality follows from and , which is the condition of Case 1.2.3.1, and the last equality follows from the definitions of and .
Let us consider Case 1.2.3.2. Since transmits and at and , respectively, by definition,
and by definition. If does not transmit at , we have using Lemma 3.3,
Thus, . If transmits at , we have using Lemma 3.4,
By these inequalities,
in which the second inequality follows from and , which is the execution condition of Case 1.2.3.2, and the last equality is immediately from the definitions of and .