Exact distributional analysis of online algorithms with lookahead

In online optimization, input data is revealed sequentially. Optimization problems in practice often exhibit this type of information disclosure as opposed to standard offline optimization where all information is known in advance. We analyze the performance of algorithms for online optimization with lookahead using a holistic distributional approach. To this end, we first introduce the performance measurement method of counting distribution functions. Then, we derive analytical expressions for the counting distribution functions of the objective value and the performance ratio in elementary cases of the online bin packing and the online traveling salesman problem. For bin packing, we also establish a relation between algorithm processing and the Catalan numbers. The paper shows that an exact analysis is strongly interconnected to the combinatorial structure of the problem and algorithm under consideration. Results further indicate that the value of lookahead heavily relies on the problem itself. The analysis also shows that exact distributional analysis could be used in order to discover key effects and identify related root causes in relatively simple problem settings. These insights can then be transferred to the analysis of more complex settings where the introduced performance measurement approach has to be used on an approximative basis (e.g., in a simulation-based optimization).


Introduction
Online optimization with lookahead deals with sequential decision making under incomplete information where each decision must be made based on a limited, but certain preview (lookahead) of future input data. In many applications, this optimization paradigm provides a better view of a decision maker's informational state than pure offline and online optimization since not all may be known about the future, but information concerning the near future may be available.
The input of an online optimization problem -both with and without lookaheadconsists of a sequence σ = (σ 1 , σ 2 , . . . , σ n ) of input elements σ 1 , σ 2 , . . . , σ n . One of the most prominent lookahead types is request lookahead where a new input element is revealed only when an old one has just been served (Allulli et al. 2008;Tinkl 2011). Under request lookahead of size l ∈ N, an algorithm has access to a fixed number l of unserved input elements (or to all of the remaining unserved input elements if there are less than l of them). The first of these input elements would also be known in the pure online situation, but the remaining l − 1 input elements are known only due to the lookahead capability. If an algorithm is allowed to process the known input elements in an arbitrary order, this type of lookahead corresponds to a buffer of size l where input elements can be reordered for subsequent processing. In stricter settings of online optimization with lookahead, buffers may be forbidden requiring to process input elements in the given order. In this paper, we will consider online optimization with lookahead where lookahead allows for buffering. An overview on various lookahead concepts throughout different applications can be found in Dunke (2014). Note that for l = 1, we obtain the setting without lookahead. Request lookahead construes the lookahead set as dependent on the processing statuses of the input elements and not in an independent process of release. There are other types of lookahead, e.g., time or property lookahead (Dunke 2014).
Basic online problems have been studied in the framework of competitive analysis (Borodin and El-Yaniv 1998;Fiat and Woeginger 1998): Algorithms for an online optimization problem have to compete with an optimal offline algorithm which knows the whole input in advance, and quality guarantees have to hold for all possible input sequences. Hence, competitive analysis is a worst-case analysis; results are overly pessimistic and do not reflect an algorithm's practical abilities (Dorrigiv 2010;Fiat and Woeginger 1998). We conclude that more comprehensive analysis methods are required to display an algorithm's overall behavior in a way supportive for decision makers in applications.
Advances in information technologies such as RFID, GPS, or GIS enable decision makers nowadays to obtain certain information about the near future. This information could be used algorithmically as a lookahead. However, lookahead is often still only considered an add-on to online optimization. The intermediate setting of lookahead has been addressed sporadically for a competitive analysis in the following areas: Routing and transportation (Allulli et al. 2008;Jaillet and Wagner 2006;Tinkl 2011), scheduling (Li et al. 2009;Mandelbaum and Shabtay 2011;Zheng et al. 2013), organization of data structures (Albers 1997(Albers , 1998Breslauer 1998;Young 1991), data transfer (Imreh and Németh 2007), packing (Grove 1995), and metrical task systems (Ben-David and Borodin 1994;Koutsoupias and Papadimitriou 2000).
In this paper, we theoretically investigate what can be achieved through lookahead relative to the pure online case without lookahead. Since the choice of the right algorithm is most crucial to overall system performance, we assess algorithm performance with respect to practical needs. The following results and contributions are obtained in the paper: An exact distributional analysis is carried out for basic settings in two important classes of online problems (packing and routing). The analysis provides a holistic view of the performance of online algorithms; in particular, it yields considerably more information than conventional competitive analysis. To the best of our knowledge, such a comprehensive analysis has not been accomplished before in online optimization. Through our derivations, concrete explanations for observable lookahead effects in the classes of packing and routing problems are found which relate to the combinatorial structure of the problem settings. We also recognize that the human limits of grasping the combinatorial structure are likely to be reached soon when more complex settings need to be analyzed. Nonetheless, the validity of the methodological approach shown in this paper provides motivation to pursue this type of performance analysis on a sampling basis in more complex settings.
The remainder of the paper is organized as follows: In Sect. 2, we present a holistic distributional approach to performance measurement which allows comparing algorithms with different lookahead regimes to each other. Sections 3 and 4 validate the method in a theoretical analysis of the bin packing and traveling salesman problem. Exact analysis is possible because the implications of lookahead on the objective can be traced back to a combinatorial structure. We are aware that the considered problem settings are fairly simple. Yet, the performance analysis becomes quite involved. However, in the given problem settings we gain insight into why algorithms may substantially profit from additional information (in the case of the traveling salesman problem) or why not (in the case of bin packing). For more complex settings, the introduced approach of performance measurement is recommended to be used on an approximative basis (e.g., in a simulation-based optimization as carried out in Dunke 2014). The paper ends with a conclusion in Sect. 5.

Performance measurement in online optimization with lookahead
There are many perspectives on assessing algorithm performance: Worst-case analysis gives strong guarantees, but lacks in displaying the overall behavior. Averagecase analysis addresses the overall behavior, but requires distributions on instances. Distributional analysis illustrates the whole performance spectrum and submits a finegrained quality image. We first give an overview of existing performance measures which are related to our approach in Sect. 2.2. We denote an optimal offline algorithm which knows σ in advance by Opt and the set of all input sequences by ; the cost of an algorithm Alg on input sequence σ is denoted by Alg [σ ]. The discussion is restricted to minimization.

Literature review
Competitive analysis (Borodin and El-Yaniv 1998;Johnson 1973;Karlin et al. 1988;Sleator and Tarjan 1985) has become the standard for measuring the performance of online algorithms. Alg is called c-competitive if there is a constant a such that Alg[σ ] ≤ c · Opt[σ ] + a for all σ ∈ . The competitive ratio c r of Alg is the greatest lower bound over all c such that Alg is c-competitive, i.e., c r = inf{c ≥ 1 | Alg is c-competitive}. It states how much Alg deviates from Opt due to missing information in the worst case. However, there are notable disadvantages of the competitive ratio (Dorrigiv 2010; Fiat and Woeginger 1998): First, results are overly pessimistic because single worst-case instances, often pathologically construed, decide upon algorithm quality, and also competing with an omniscient offline algorithm may be irrelevant in practice. Second, competitive analysis is oblivious to overall algorithm behavior since performance is reduced to a single, worst-case-related figure; this makes discriminating algorithms with the same worst case, but different average case impossible. Third, a direct comparison between two algorithms is impossible. And fourth, the method often fails to reproduce the beneficial impact of lookahead.
Comparative analysis (Koutsoupias and Papadimitriou 2000) differs from competitive analysis as it relates the best objective value of a class of algorithm candidates to that of another class of algorithm candidates which are weaker than Opt, but stronger than those in the first class. Let A, B be algorithm classes where B is more powerful than A, e.g., due to lookahead, then the comparative ratio is .
To maximize c comp r , B chooses candidate B, whereupon A answers with A, whereupon B chooses the worst instance σ ∈ for A. Comparing algorithm classes with varying lookahead levels to each other (without reference to Opt) is also the foundation of our approach.
In an average-case analysis, stochasticity refers to probabilities for input sequence occurrences. Let D be a probability distribution over all input sequences, then Alg The expectation can also be taken over all ratios: Opt[σ ] ≤ c . According to Souza (2006), the expected performance ratio should be favored because sequences with small (large) objective would be underrepresented (overrepresented) in the isolated expectations. The expected performance ratio indicates which algorithm performs better on most sequences, and by Markov's inequality the probability for a sequence with ratio far from the expectation can be bounded.
The main advantage of distributional performance analysis is that an algorithm is judged by a distribution instead of a single key figure. Relative interval analysis (Dorrigiv et al. 2009) is a preliminary stage of distributional analysis since it only considers the extreme values of a distribution for two algorithms. Define then the relative interval of Alg 1 and Alg 2 is The relative interval of an algorithm pair corresponds to its asymptotic range of amortized costs, and it allows for a direct comparison of two algorithms without reference to Opt. Stochastic dominance (Müller and Stoyan 2002) origins from statistics where it is used to establish an order between distributions of two random variables. By interpreting the objective value obtained by an algorithm as a random variable, this concept has been transferred to online optimization (Hiller 2009) If Alg 1 stochastically dominates Alg 2 at first order, then E(Alg 1 ) ≥ E(Alg 2 ). Unfortunately, stochastic dominance does not admit a total ordering among all distributions and we cannot expect a relation to hold for arbitrary algorithms. However, when comparing an algorithm without lookahead Alg 1 to one with lookahead Alg 2 (in minimization), Alg 1 ≥ st Alg 2 would illustrate the benefit of lookahead because Alg 2 attains smaller objective values on more instances than Alg 1 .
Bijective analysis (Angelopoulos and Schweitzer 2013) is a special case of stochastic dominance where input sequences are uniformly distributed. The idea is to find a bijection b : ↔ such that the objective value of Alg 1 on σ is never worse than that of Alg 2 on the image b(σ ) of σ . Essentially, the approach consists in establishing an order of the elements in such that Alg 1 outperforms Alg 2 on every pair (σ, b(σ )). Alg 1 is called no worse than Alg 2 (Alg 1 Alg 2 ) if for all n ≥ n 0 ≥ 1 with some for all σ ∈ . Alg 1 is called better than Alg 2 if Alg 1 Alg 2 and not Alg 2 Alg 1 . Hence, Alg 1 does not have to outperform Alg 2 on each sequence, but there has to be a relabeling of the sequences such that this relation holds between the original and relabeled sequences. We point out the advantages in Angelopoulos and Schweitzer (2013) for bijective analysis that can be transferred to any distributional approach: First, the idea is simple and intuitive, yet powerful. Second, algorithms can be compared directly without reference to an optimal offline algorithm. And third, typical algorithm properties are likely to be uncovered.

Counting distribution functions
Inspired by the bijective analysis of Angelopoulos and Schweitzer (2013), our analysis of algorithm performance is based on a distributional approach facilitating a comprehensive performance evaluation. We choose a performance measurement approach which summarizes the global behavior of an algorithm over all instances, but also takes into account local quality of algorithms in terms of comparing their performance on the same problem instance. The approach has been introduced in Dunke and Nickel (2013) and is further discussed in Dunke (2014).
In online optimization, nothing is known about the future. Likewise, in online optimization with lookahead, a limited amount of information about the future is available. Therefore, it is reasonable to impute this assumption also in the analysis method for algorithm performance. When no probabilities for instance occurrences are given, from the principle of insufficient reason the maximum entropy distribution is the best way to emulate the state of informational nescience as it minimizes the amount of a-priori information in the distribution (Jaynes 1957a, b). The uniform distribution over is the maximum entropy distribution among all distributions with support (which follows from Langrangian relaxation by the definition of the entropy together with the constraint that the sum over all probabilities equals 1). For finite , this leads to counting results saying how many instances yield a certain objective value. The counting distribution function 1 subsumes these frequency information of objective values over : Definition 2.1 (Counting distribution function of objective value). Let σ ∈ be an input sequence, let Alg be an algorithm, and let Alg[σ ] be the objective value of Alg on σ . If is a discrete set, then the function F Alg : R → [0, 1] with is called the counting distribution function of the objective value of Alg over .
For objective value v ∈ R, the counting distribution function of the objective value F Alg (v) relates the number of input sequences with objective value smaller than or equal to v to the number of all possible input sequences. As every instance is considered with equal weight, this yields a counting result in the sense that F Alg (v) can be understood as the proportion among all input sequences leading to an objective value smaller than or equal to v.
A first step of comparing two algorithms Alg 1 and Alg 2 by their counting distribution functions of the objective value (see Fig. 1a) can be done by graphically examining the relative positions of their plots. For instance, when -in a minimization problem -the plot of F Alg 1 (v) lies below that of F Alg 2 (v) for a major proportion of objective values v, we can conclude as a first rule of thumb that F Alg 1 (v) outperforms F Alg 2 (v) on the majority of input sequences. b Counting distribution function of the performance ratio of Alg 1 relative to Alg 2 The following definitions account for the relative performance of two algorithms to each other when both are restricted to operate on the same input sequence: Definition 2.2 (Performance ratio). Let σ ∈ be an input sequence, and let Alg 1 , Alg 2 be two algorithms for processing σ , respectively. r Alg 1 ,Alg 2 (σ ) := Alg 1 [σ ] Alg 2 [σ ] is called the performance ratio of Alg 1 relative to Alg 2 with respect to σ .

Definition 2.3 (Counting distribution function of performance ratio).
Let σ ∈ be an input sequence, let Alg be an algorithm, and let r Alg 1 ,Alg 2 (σ ) be the performance ratio of Alg 1 relative to Alg 2 on σ . If is a discrete set, then the function F Alg 1 ,Alg 2 : is called the counting distribution function of the performance ratio of Alg 1 relative to Alg 2 over .
In a first step, comparing Alg 1 and Alg 2 by their counting distribution function of the performance ratio (see Fig. 1b) can be done by partitioning all instances into subsets with ratio smaller than 1 (favoring Alg 1 ), with ratio larger than 1 (favoring Alg 2 ), and with ratio equal to 1 (displaying indifference between Alg 1 and Alg 2 ). The cardinalities of these subsets then can be put into relation to each other to provide a first impression about instance-wise algorithm qualities. Note that the competitive ratio of Alg 1 is obtained as max σ ∈ r Alg 1 ,Alg 2 (σ ) if Alg 2 is Opt.
The two-sided approach has the following advantages: First, the objective value distribution gives a global view on algorithm quality over all instances; the performance ratio distribution offers a local view on the quality of both algorithms relative to each other on the same instance. Second, distribution-based analysis also yields information about ranges and variability. And third, algorithms with arbitrary lookahead levels can be compared.
In the sequel, we derive exact expressions for the counting distribution functions in two fundamental online optimization problems (bin packing in Sect. 3 and traveling salesman problem in Sect. 4) to assess the influence of lookahead on algorithm performance. The study shows that already in fairly easy problem settings, an exact analysis becomes quite involved. On the other hand, the analysis allows us to gain insight why lookahead does not prove that much beneficial in packing problems as compared to routing problems. To the best of our knowledge, an explicit consideration of all input sequences as conveyed by the exact distributional analysis has never been conducted before.

Online bin packing with lookahead
The bin packing problem is a fundamental combinatorial problem from the class of cutting and packing problems (Csirik and Woeginger 1998). It consists of packing the items (or more precisely their sizes) from input sequence σ = (σ 1 , . . . , σ n ) into the least possible number of bins of capacity C. The online bin packing problem has been in the research focus of Computer Science ever since the 1970s (Johnson 1973(Johnson , 1974 due to a series of appealing worst case analyses that could be established in this field. Surveys of the competitive analysis results on classical bin packing algorithms can be found in Borodin and El-Yaniv (1998), Csirik and Woeginger (1998) and Sgall (2014). In particular, it deserves mentioning that (in the limit) the well-known algorithms BestFit and FirstFit are 17 10 -competitive and their decreasing type (offline) variants where items are preordered by non-increasing size BestFitDecreasing and FirstFitDecreasing are 11 9 -competitive.

Problem setting and notation
In the online version, items are packed one after another without knowing any remaining item. In the online version with request lookahead of size l, items are packed sequentially with knowing l remaining items (or all remaining items if there are less than l of them); in particular, it is allowed to have a packing order different from the revelation order. Recall that the case l = 1 coincides with the pure online setting without additional lookahead. We now compare the pure online setting with the setting enhanced by lookahead: Online algorithm BestFit puts the (only) known item into the fullest open bin that can accommodate it, if any; otherwise a new bin is opened and the item is put in it (Csirik and Woeginger 1998). Online algorithm BestFit l with request lookahead l first sorts the known items in order of non-increasing sizes and then puts the largest known item into the fullest open bin that can accommodate it, if any; otherwise a new bin is opened and the largest item is put in it (Csirik and Woeginger 1998). Observe that BestFit 1 conincides with BestFit. Under lookahead of one additional item (l = 2), we derive exact expressions for the counting distribution functions of the objective value and the performance ratio for the case of two item sizes 0.5 + and 0.5 − with arbitrary ∈ (0, 1 6 ) and C = 1. Under these conditions at most two items fit into a single bin. A similar situation has been considered by Kenyon (1996) as a motivation to introduce the random order performance ratio as an alternative to competitive analysis.  BestFit 2 emulates BestFit with the additional feature that the two known items are always sorted by decreasing size. From now on, we refer to BestFit as Bf and BestFit 2 as Bf 2 . As stated above, the following analysis is restricted to item sequences σ = (σ 1 , . . . , σ n ) with σ i ∈ {0.5 + , 0.5 − }, ∈ (0, 1 6 ), and n ∈ N. The following additional notation is used: • Large / small item: Item of size 0.5 + / 0.5 − • n l (σ ) / n s (σ ): Number of large / small items in σ • Bf(n, m) / Bf 2 (n, m): Number of item sequences of length n which need exactly m bins under BestFit / BestFit 2 • C i : ith Catalan number 2 given by As the main result of the analysis in this section, we find that the benefit attainable through lookahead in bin packing is of small magnitude which becomes evident in the plots of the counting distribution functions in Fig. 2. According to Sect. 3.2, this minor effect is attributable to rather restrictive conditions which have to hold for an input sequence in order to facilitate a saving of one bin through lookahead. Moreover, the combinatorial relation of the problem setting to the Catalan numbers becomes evident in the analysis, and it becomes clear that algorithm performance is closely related to the combinatorial structure of the problem. Exact expressions for the counting distribution functions of the number of bins used and the performance ratio are then derived in Sect. 3.3.

Combinatorial analysis of the lookahead effect
We analyze the behavior of Bf and Bf 2 from a combinatorial perspective. The analysis shows that there is a close relation between the Catalan numbers and the extent of improved algorithm performance through lookahead. Additionally, we find that a bin saving through lookahead can only be achieved when several conditions on the item sequence are fulfilled at the same time. Hence, through our combinatorial analysis, we identify the core reason for the minor effect of lookahead in online bin packing.

Theorem 3.1 For any item sequence
Proof The first difference in the packings of Bf and Bf 2 occurs when item subsequence (0.5 − , 0.5 − , 0.5 + ) appears and there is no bin to accommodate any of these items. Bf 2 packs the first and third item into a single bin at full capacity and keeps the second (small) item unpacked in the lookahead until the end of the sequence (since items are homogenous), whereas Bf packs the first two items in a bin at capacity 1−2 and the third item in a second bin. Thus, Bf 2 leads with one bin less used, but also one small item less packed. Bf 2 also loses its lookahead power as it holds the small item in the lookahead and will not change orders of two lookahead items ever again. Thus, both Bf 2 and Bf will process the remaining items in parallel, but starting from a different bin configuration. The number of upcoming new bins for the remaining items by Bf can only be the same or one less than that of Bf 2 (without considering the left-over small item) because items have to be packed in the same order andas a result of the different bin configurations-Bf can pack one small item without opening a new bin, whereas Bf 2 has to open a new bin immediately. Finally, Bf 2 has to pack the left-over small item: When the number of new bins in the previous step is the same for Bf 2 and Bf and in the packing of Bf 2 there is room for a small item, Bf 2 will end up with one bin less than Bf, otherwise Bf 2 will have to open a new bin resulting in a tie for the numbers of bins used.
From Theorem 3.1 it follows that Bf 2 dominates Bf in the sense that for each item sequence it produces the same number of bins or even needs one bin less.

Definition 3.1 (Condensation of an input sequence). Let
The condensation σ c of σ is the input sequence that arises by repetitively removing all pairs (0.5 − , 0.5 − ) starting in an odd position if the number of large items encountered previously is not larger than the number of small, unremoved items encountered previously.
A pair of removed small items in Definition 3.1 is also referred to as a condensed pair or as a condensation in an input sequence. Observe that condensed pairs of small items will be packed together in a single bin by Bf with an unused capacity of 2 , whereas for Bf 2 there remains hope that either of the two small items will be combined with a large item without any unutilized capacity. Hence, the term condensation will be helpful in the analysis.

Theorem 3.2 For any item sequence
= 1 if and only if there is an odd j ∈ N such that the following conditions are satisfied: and both algorithms produce the same bin configurations (albeit in a different order) for σ i . In particular, this means that Bf 2 will pack σ j−1 before σ j . Among all these splits there exists one with longest σ i which we refer to as σ i from now on.
Recall that the first difference in the packings of Bf and Bf 2 occurs when item subsequence (0.5 − , 0.5 − , 0.5 + ) appears and no open bin can accommodate any of these items. By definition, σ i immediately precedes this subsequence. If |σ i | was odd, any algorithm would leave a bin with space at least 0.5 − after packing the odd number of items in σ i . Hence, the first (small) item of the subsequence could also be added contradicting that no open bin can accommodate any of the items. Thus, |σ i | is even and j is odd.
From Definition 3.1, it follows that n l (σ i ) ≥ n s ((σ i ) c ) because any pair of small items that would lead to more small than large items immediately after this pair has been deleted in n s ((σ i ) c ) and |σ i | is even. For n l (σ i ) = n s ((σ i ) c ), each large item has a matching small item which comes after or immediately before the large item. Thus, the configuration determined by Bf is composed of n l (σ i ) completely filled bins and bins with two small items. Clearly, this number of bins is optimal. From the proof of Theorem 3.1, both Bf 2 and Bf attain the optimal number of bins by the same bin configurations for n l ( we show by contradiction that σ i cannot be a longest possible subsequence such that Bf 2 and Bf produce the same bin configurations: Assume that σ i is a longest possible subsequence such that Bf 2 and Bf produce the same bin configurations and n l ( Then there is at least one bin containing a large item without a matching small item. An additional small item will be put into such a bin, an additional large item will need a new bin, but the configurations of both algorithms will remain the same contradicting the definition of σ i . Thus, n l ( According to (i) and the definition of σ i , there must be an odd j such that Bf 2 starts to exhibit an advantage over Bf on σ ii = (σ j , σ j+1 , σ j+2 , . . .) after σ i has been packed resulting in the same bin configurations with no space left by both algorithms. Only (σ j , σ j+1 ) = (0.5 − , 0.5 − ) potentially produces a difference. To make this happen, Bf 2 need not pack these two items into the same bin, whereas Bf has to. This happens if and only if σ j+2 = 0.5 + : Bf 2 will not pack σ j+1 immediately, but delay it until the end of the item sequence, whereas σ j+2 will be matched with σ j . This establishes (ii).
To see (iii), note that the processing of Bf 2 on σ ii = (0.5 − , 0.5 − , 0.5 + , σ j+3 , . . . , σ n ) is emulated by Bf onσ ii = (0.5 − , 0.5 + , σ j+3 , . . . , σ n , 0.5 − ). Assume there is a condensed pair of small items in the subsequence starting with σ j+3 ; if there is more than one condensation, consider the first one. Let σ j be the first small item of this condensation. Bf produces a bin with two small items for σ j and σ j+1 , but not for σ j and σ j +1 since two small items starting in an even position of the original sequence cannot be put in the same bin by Bf. Bf 2 processes (σ j , σ j+1 , σ j+2 , . . . , σ n−1 , σ n ) as (σ j , σ j+2 , . . . , σ n−1 , σ n , σ j+1 ) emulated by Bf, i.e., it does not produce a bin with two small items for σ j and σ j+1 , but for σ j and σ j +1 since in (σ i ,σ ii ) these items are condensed items. Between σ j+3 and σ j , neither algorithm produces another bin with two small items since we consider the first condensation in the subsequence starting from σ j+3 . In particular, there cannot be a condensation of the original sequence starting in an odd position between σ j+4 and σ j −1 . If there was such a condensation, it would follow from (i) and (ii) that there must be another even index j < j + 4 starting a condensation in the subsequence starting with σ j+3 contradicting to j being the first such index. Hence, both Bf and Bf 2 produce one additional bin with two small items for . . , σ j ) as compared to σ i , and σ i could not have been the longest possible first part among all splits of σ .
From (i), (ii), (iii), we know that in Bf 2 's processing there is no bin with two small items from σ j onwards, whereas Bf creates such a bin for (σ j , σ j+1 ). Hence, in order to pack σ j+1 at the end of Bf 2 's processing into an already open bin and to save a bin as compared to Bf, we need an open bin with a large item only. This is the case if and only if in the subsequence starting from σ j+3 at least one more large item exists, i.e., iv).
⇐: We have that for item sequence σ , there is an odd j ∈ N such that conditions (i) to (iv) are fulfilled. In the sequel, a bin is called matched if it contains a large and small item, otherwise it is called unmatched. From (ii) and (iii), we know that Bf 2 will not produce a bin with two small items from σ j onwards, whereas Bf creates such a bin for (σ j , σ j+1 ). From iv), we conclude that the number of matched bins in Bf 2 is two higher than in Bf. From the pigeonhole principle, it follows that the number of unmatched bins in Bf is three higher than in Bf 2 . Thus, guarantees that in the bin configurations induced both by Bf 2 and Bf there is a matching small item for any large item such that there is no bin with a large item only after (σ 1 , . . . , σ j−1 ) have been processed. Since |(σ 1 , . . . , σ j−1 )| is even, there is no bin with a small item only after (σ 1 , . . . , σ j−1 ) has been packed. Hence, the initial position for processing (σ j , σ j+1 , . . . , σ n ) is the same for Bf 2 and Bf and can be viewed as restarting with no bins used so far. In In Theorem 3.4, we characterize the number of item sequences of a given length which yield a saving of one bin by applying Bf 2 instead of Bf. To this end, we make use of the notion of (recurring) unit-sloped paths (Michaels and Rosen 1991).
Note that if we restrict s k ≥ 0 for all k = 0, 1, 2, . . . , 2i, this definition coincides with that of the well-known Dyck path (see, e.g., Deutsch 1999;Deutsch and Shapiro 2001). Figure 3 shows an example for a recurring unit-sloped path and a Dyck path, respectively. The number of item sequences of length 2i without any condensation is equal to the Catalan number C i+1 as a consequence of the following Lemma 3.3.

Lemma 3.3 (a) The number of recurring unit-sloped paths of length
We are now in a position to provide an expression for the number of item sequences of given length which lead to a a saving of one bin by applying Bf 2 instead of Bf.

Counting distribution functions
We go on to establish exact expressions for the counting distribution functions of the objective value and performance ratio related to algorithms Bf and Bf 2 . The analysis illustrates how a comprehensive assessment of algorithm quality can be obtained for the online bin packing setting under consideration. While the previous results on the number of item sequences for which Bf 2 incurs a bin saving over Bf cannot be used directly for the counting distribution functions, many proof ideas are reused subsequently. The numbers a n,k = k+1 n+1 2n+2 n−k with k, n ∈ N 0 , n ≥ k (cf. Deutsch and Shapiro 2001) will be used in several of the following results leading to the counting distribution functions for the objective value in Corollary 3.11 and for the performance ratio in Corollary 3.13.
We now give another formula to compute the numbers Bf(2n, m) and Bf(2n+1, m).

Lemma 3.8 For n
Using this result, the proof of Theorem 3.7 can be completed for even length 2n of σ by where the last equality follows for n < m ≤ 2n − 1 from the proof of Lemma 9 in Regev (2012) and condition iv) from Theorem 3.2. For odd length 2n + 1 of σ , the proof is analogous with 2n − 2i replaced by 2n − 2i + 1.

Corollary 3.9 The number of item sequences σ of length n with Bf[σ ] = m and
Bf 2 [σ ] = m is given by n m for m = n 2 + 1, . . . , n. Proof See "Appendix A.5".
We now state the central relation between the objective values attained by Bf 2 and Bf. Theorem 3.10 The number of item sequences σ of length n where Bf 2 [σ ] = m is given by Proof Because of item sizes in {0.5 − , 0.5 + }, at most two items can be packed in a bin so that packing n items in less than n 2 bins is infeasible. Likewise, each item of σ is packed separately if and only if each item is large, and there is only one such item sequence σ .
The number of item sequences of length n for which Bf 2 attains objective value m can be computed as n 1 + n 2 − n 3 − n 4 where n 1 is the number of item sequences σ of length n with Bf From Theorem 3.7, we have that the number of all item sequences σ of length n with Bf[σ ] = m and Bf 2 [σ ] = m − 1 is n 3 = n m+1 for m = n 2 + 1, . . . , n − 1; from Corollary 3.9, we have that the number of all item sequences σ of length n with Bf[σ ] = m + 1 and Bf 2 [σ ] = m + 1 is n 4 = n m+1 for m = n 2 , . . . , n − 1, and the result follows.
From the previous results, we obtain expressions for the counting distribution functions of the objective value F Bf (v) and F Bf 2 (v), respectively. We restrict ourselves to item sequences of even length since analogous conclusions can be drawn immediately in case of odd length.

Corollary 3.11
The counting distribution functions of the objective value F Bf (v) and F Bf 2 (v) of Bf and Bf 2 for item sequences of length 2n are given by Proof Direct consequence of Theorems 3.6 and 3.10. Figure 2a exemplarily plots F Bf (v) and F Bf 2 (v) for all item sequences of length n = 100. We observe a rather small lookahead effect as a result of the (relatively restrictive) conditions in Theorem 3.2 which are collectively found only in a minor fraction of all item sequences.
Part (a) of the following corollary expresses Bf 2 's dominance over Bf. As seen from Theorem 3.1, stochastic dominance of all orders is established. As a consequence of part (b), knowing one additional item is worthless in the limit. Taking into account Theorem 3.1, this result was to be expected. The reason for this ineffectiveness lies in the total forfeiture of the power of the lookahead capability once a small item occurs and occupies the lookahead set.

Corollary 3.12 (a) For item sequences of length 2n, we have F
Proof See "Appendix A.6".
We next derive an expression for the counting distribution function of the performance ratio.

Corollary 3.13
The counting distribution function of the performance ratio F Bf,Bf 2 (r ) of Bf relative to Bf 2 for item sequences of length 2n is given by Proof According to Theorem 3.7, we have: Apart from these item sequences, no other sequences change their objective due to application of Bf 2 instead of Bf. Thus, the performance ratio ranges in [1, n+1 n ] and the number of item sequences of length 2n which leave the number of bins unchanged in both algorithms is Exploiting this relation, we immediately get the given expression for the counting distribution function of the performance ratio as F Bf,Bf 2 (r ).
In Fig. 2b, an exemplary plot of F Bf,Bf 2 (r ) is given for n = 100 confirming that the lookahead effect is also relatively small with respect to an instance-wise comparison.

Online traveling salesman problem with lookahead
The traveling salesman problem (TSP) lies at the core of nearly every transportation or routing problem as it seeks to find a round trip (also called tour) for a given set of locations (also called requests) to be visited such that some cost function depending on the total travel distance or travel time is minimized (Lenstra and Rinnooy Kan 1975). The online TSP has been considered in several flavors for competitive analyses: A typical objective is makespan minimization. For this problem, a 2-competitive algorithm PlanAtHome is known (Ausiello et al. 1995) where the problem also involves request release dates. In an online variant with lookahead, customer requests pop up some time ahead of the earliest possible visit times. It is shown in Allulli et al. (2008) that lookahead leaves the competitive factor at 2, i.e., no better algorithm with respect to the optimal offline solution is found in competitive analysis. Another paper on the online TSP with lookahead is due to Jaillet and Wagner (2006). Here, lookahead is given by disclosure dates which differ from release dates. It is shown that the advanced information leads to improved competitive ratios.

Problem setting and notation
The setting considered in this paper refrains from request release dates and applies total distance as the objective criterion. We conduct an exact combinatorial analysis and explain the improvements that can be achieved through lookahead on typical input sequences. Hence, the TSP as considered in this paper is a pure sequencing problem. For input sequence σ = (σ 1 , . . . , σ n ), let a request σ i with i ∈ N correspond to a point x i in a space M with metric d : M × M → R, then the TSP consists of visiting the points of all requests -each one not before its release-with a server in a tour of minimum length starting and ending in some distinguished origin o ∈ M.
A permutation π(σ ) = (π 1 (σ ), π 2 (σ ), . . . , π n (σ )) of the set {σ 1 , σ 2 , . . . , σ n } of requests represents a tour (o, x π 1 (σ ) , x π 2 (σ ) , . . . , x π n (σ ) , o), i.e., a feasible solution to an instance of the TSP. The tour length of π(σ ) is given by the value The online version without lookahead is trivial: Requests are served in their order of appearance since no temporal aspects such as release dates are considered. In the online version with request lookahead of size l, requests are served sequentially with knowing l remaining requests (or all remaining requests if there are less than l of them); in particular, requests do not need to be served in their order of appearance. Recall that the case l = 1 coincides with the pure online setting without additional lookahead. We now compare the pure online setting with the setting enhanced by lookahead: Online algorithm FirstComeFirstServed has no choices, i.e., the server has to visit the requests in their order of appearance in a first-come first-served manner. Online algorithm NearestNeighbor l with request lookahead l always moves the server to the closest known point in terms of distance from its current location.
Under lookahead of one additional request (l = 2), we derive exact expressions for the counting distribution functions of the objective value and the performance ratio for the case of a metric space consisting of two points only, i.e., M = {0, 1} with d(0, 1) = d(1, 0) = 1, d(0, 0) = d(1, 1) = 0 and o = 0. Thus, this version of the TSP can also be recast as a 1-server problem on two points.
From now on, we refer to FirstComeFirstServed as Fcfs and NearestNeighbor 2 as Nn. We use the following additional terminology: • A pass is the transition between two successive requests (σ i , σ i+1 ); a pass pair is a request subsequence (σ i , σ i+1 , σ i+2 ).
• A free point at a given time is a point which is not occupied by the server at that time.
Note that because of the return to o, only even overall tour lengths are possible. In contrast to bin packing, the analysis in this section will show significant reductions in overall tour lengths through lookahead. This becomes possible due to the large and irrevocable effect on the objective function that the resequencing of requests brings along. The major positive effect of lookahead in the TSP is seen in the plots of the counting distribution functions in Fig. 4. As presented in a stringent analysis in Sect. 4.2, the root cause for the advantage of Nn over Fcfs lies in its ability to crack pass pairs (0, 1, 0) or (1, 0, 1) in order to build pass pairs (0, 0, 1) or (1, 1, 0).

Counting distribution functions
In this section, we derive expressions for the counting distribution functions of the objective values attained by algorithms Fcfs and Nn, respectively, as well as an expression for the counting distribution function of the performance ratio of Fcfs and Nn. The counting distribution functions thoroughly reflect the advantage of Nn over Fcfs which lies in the ability of pooling requests on the same location. The analysis is rather direct, i.e., we first provide a theorem giving the number of request sequences leading to a specific objective value or performance ratio, respectively, and then conclude with a corollary specifying the expression for the counting distribution function. Proof A sequence of n points starting and ending in o has n + 2 requests including the two dummy requests at o and encounters n + 1 passes to either the current or the free point.

Counting distribution functions of the objective value
(a) For Fcfs in order to result in objective value m, a request sequence has to exhibit exactly m change passes out of the n + 1 passes. (b) For m = 0, the formula obviously holds. Denote by σ the original request sequence and by σ the visiting order under Nn. For m > 0, first observe that each resulting sequence σ after being processed by Nn exhibits a last change from 0 to 1 and a last change from 1 to 0 in the visiting order of requests which together contribute a total of 2 to the objective value. We conclude that a contribution of max{0, m − 2} is due to all previous passes that do not involve the 1 of the last change from 0 to 1. There are two cases how this 1 could be obtained: Either it was at the same position originally and remained there also under processing of Nn (case 1), or it had been shifted to that position as a result of the processing of Nn (case 2). For n = 9 and m = 4, we give an example of case 1 by 0 , 0 , 1 , 1 , 0 ) and of case 2 by 0 , 1 , 1 , 0 ), For each of the m −2 changes incurred by Nn, of course, there must also have been a corresponding change pass in the original sequence (right arrow). Additionally, through the processing of Nn, this change pass can only be responsible for a change if in the processing order of Nn the (potentially shifted) destination of the original change pass is succeeded by another pass which has to be a remain-pass (left arrow).
In the first case, m − 2 change passes along with their affirmative remain-passes in the transformed sequence and two additional change passes (underlined) incur changes, i.e., 2(m − 2) + 2 = 2m − 2 out of the n + 1 passes have to be chosen. In the second case, because of the last change from 0 to 1, which resulted from a shifted change pass (left double arrow), and its affirmative remain-pass (right double arrow), m − 2 + 1 = m − 1 change passes along with their affirmative remain-passes in the transformed sequence and two additional passes (underlined), whereof the first one is a pass from 1 to 0 ensuring that the 1 will be shifted to the right (cf. definition of case 2), incur changes, i.e., 2(m − 1) + 2 = 2m out of the n + 1 passes have to be chosen.
From the previous result, we immediately obtain expressions for the counting distribution functions of the objective value F Fcfs (v) and F Nn (v), respectively. Note that Fcfs and Nn have possible tour lengths in {0, 2, 4, . . . , 2 n 2 } and {0, 2, 4, . . . , 2 n 4 } , respectively, for n + 2 requests including the first and last request to o (cf. proof of Theorem 4.1).

Corollary 4.2
The counting distribution functions of the objective value F Fcfs (v) and F Nn (v) of Fcfs and Nn for request sequences of length n + 2 (including the first and last request to o) are given by Figure 4a exemplarily plots F Fcfs (v) and F Nn (v) for all item sequences of length n = 100. We observe a significant lookahead effect as a result of permuting request triples with two successive change passes such that these turn into one change pass and one remain pass.
Counting distribution function of the performance ratio Theorem 4.3 Let m Nn (σ ) and m Fcfs (σ ) denote the objective values of algorithms Nn and Fcfs on request sequence σ , respectively, and let n Nn, Fcfs (n, a, b) be the number of request sequences σ of length n + 2 (including the first and last request to o) with m Nn (σ ) = a and m Fcfs (σ ) = b for a = 0, 2, 4, . . . , 2 n 4 and b = 0, 2, 4, . . . , 2 n 2 , then it holds that Proof Notice that Nn can never be worse than Fcfs because whenever Nn changes the order, a saving occurs without future drawbacks. Nn needs at least a third of the distance of Fcfs as seen by (0, 1, 0, 1, 0, 1, 0) which requires two units from Nn and six units from Fcfs. There are no sequences with a larger percentage of savings because at the end of this sequence only two requests on 0 are seen by Nn, i.e., there is no value of lookahead in this moment, and modifying the above sequence by additional requests cannot improve the advantage of Nn over Fcfs any further. Due to the return to o, both Fcfs and Nn lead to an even objective value. Therefore, it is sufficient to consider n Nn,Fcfs (n, a, b) with a, b as even numbers and a b ∈ [ 1 3 , 1]. For a request sequence with n points (apart from the dummy requests at the beginning and end), b can attain values up to 2 n 2 as seen by the worst-case sequences for Fcfs: Sequences of odd length consist only of change passes; sequences of even length consist only of change passes except for one remain pass. For a request sequence with n points (apart from the dummy requests at the beginning and end), a can attain values up to 2 n 4 as seen by the worst-case sequences for Nn as follows: In any visiting order under Nn, defined as σ , an isolated 0 may only occur at the first and/or last request to o = 0; likewise, the only possible isolated 1 is the last request to 1. Hence, apart from these three requests, σ consists of a series of subsequences with minimum length 2 with requests on 1 only or 0 only. The largest objective value is incurred when the largest number of such subsequences appears in σ which is the case for subsequences in the form of pairs. Input sequences σ of this form result from (0, (1, 1, 0, 0) c , x, 0) with x being a request subsequence of minimum length 1 and maximum length 4 containing at least one 1 representing the last visit to 1. b = a = 0: The only sequence with b = a = 0 has σ i = 0 for i = 1, . . . , n. b = a = 0: The visiting order of the points in σ is identical for Fcfs and Nn because Nn has a lookahead of one additional request. In particular, we know that the pass immediately following each of the first a − 2 change passes has to be a remain pass since otherwise Nn would have reorganized the order. (The last two change passes do not have to exhibit this structure because these changes cannot be extinguished by Nn due to the forced return to the origin.) Thus, since for a − 2 passes we know the type of the immediate successor pass, we only have to choose a change passes out of n + 1 − (a − 2) = n + 3 − a passes. b = 3a: The largest possible advantage of Nn over Fcfs is achieved. A saving through Nn over Fcfs is obtained whenever the lookahead holds both a 0 and a 1 with the first request in the lookahead being different from the current location. Moreover, this saving will lead to another saving if the location of the first request in the lookahead is requested later again. Clearly, Nn could not anticipate the second saving as it involves a request not seen in the lookahead, but only got lucky that this request occurred. Hence, each time Fcfs requires a distance of 3, Nn only requires a distance of 1. Hence, it follows that the request sequence has to consist only of disjunct subsequences of the form (0 c 0 , 1, 0 c 1 , 1 c 2 , 0, 1 c 3 , 0 c 4 ) with c i ∈ N for i = 0, 1, 2, 3, 4 where x c stands for a request on x ∈ {0, 1} for c times in a row. The requests of each such subsequence will be visited in the order (0 c 0 , 0 c 1 , 1, 1 c 2 , 1 c 3 , 0, 0 c 4 ) by Nn producing two moves, whereas Fcfs needs six. In particular, we know that in the original sequence after the first pass from 0 to 1 a pass to 0 immediately follows and that the pass from 0 to 1 c 3 is immediately preceded by a 1. Hence, for each pass in σ that leads to one of the a moves of Nn, there is also another associated pass known in σ . Thus, we choose out of n + 1 − a passes rather than out of n + 1 passes. Within each such subsequence, we have to choose the ends of 0 c 0 , 0 c 1 , 1 c 2 , 1 c 3 by selecting c 0 , c 1 , c 2 , c 3 . Since there are a 2 such subsequences for objective value a, in total we have to choose 4 · a 2 = 2a out of n + 1 − a passes. In the sequel, we call a subsequence (0, 1, 0) or (1, 0, 1) a change-change pass pair (c/c-pair) and a subsequence (0, 1, 1) or (1, 0, 0) a change-remain pass pair (c/r-pair). Moreover, observe that for a difference of b − a in the outcome, one has to encounter exactly b−a 2 non-overlapping c/c-pairs before the final return to o. b = 3a − 2: We need 3a−2−a 2 = a − 1 non-overlapping c/c-pairs. Further, one additional (isolated) change pass has to occur within σ because a − 1 is odd and the server has to return to o. For each of the a − 1 c/c-pairs (0, 1, 0) or (1, 0, 1), we also have to specify the position until which the sequence continues with 0 and 1, respectively. Hence, we have to choose (a − 1) + 1 + (a − 1) = 2a − 1 passes. There are two cases for the position of the isolated change pass: Case 1: The isolated change pass occurs after all non-overlapping c/c-pairs.
Then we have to choose the first passes of the non-overlapping c/c-pairs and the isolated change pass out of n + 1 − (a − 1) = n + 2 − a passes. There are n+2−a 2a−1 possibilities to do so. Case 2: The isolated change pass occurs prior to all or within the sequence of non-overlapping c/c-pairs. Then we have to choose the first passes of the non-overlapping c/c-pairs and the isolated change pass out of n + 1 − (a − 1) − 1 = n + 1 − a passes because we know that the isolated change pass is succeeded by a remain pass since otherwise it would not be an isolated change pass. There are a − 1 positions to locate the isolated change pass prior to all or within the sequence of the a − 1 non-overlapping c/c-pairs. Hence, there are (a − 1) n+1−a In Fig. 4b, an exemplary plot of F Nn , Fcfs(r ) is given for n = 100 confirming that the lookahead effect is also enormous with respect to an instance-wise comparison.

Conclusion
We analyzed special cases of bin packing and the TSP using the concept of counting distribution functions. To the best of our knowledge, displaying exactly the algorithm behavior over all possible input sequences has never been done before. The derivations of the analytical expressions revealed that exact analysis in combinatorial online optimization is intertwined with the combinatorics of the problem setting (choice of parameter values) and the processing rules of algorithms. This could obviously be seen in bin packing with two item sizes where algorithm performance is described by the Catalan numbers. Clearly, these structures are recognizable by cognitively only when algorithms are simple and problems are elementary. However, even under this assumption the analysis became involved. To the best of our knowledge, our analysis is the first to give an exact image reproducing algorithm behavior over all input sequences in the respective problems. As a byproduct, the proofs yielded explanations for the magnitudes of the lookahead effects. For larger lookahead and general settings, it will be virtually impossible to track the effects of lookahead in the processing of an algorithm over all input sequences. Hence, we are led to conducting experimental analysis. Empirical results in further academic online optimization problems and in real world applications can be found in the author's thesis (Dunke 2014). In particular, we emphasize that applying the performance measurement approach based on counting distribution functions has proven to be a powerful tool in the simulation-based analysis of real world problems.
Since an exact analysis in the style of this paper is likely to be out of scope for more complex settings, it has to be checked next which mathematical statements are realistic to be elicited in future works. An exact analysis of other lookahead types, e.g., time lookahead, and a subsequent comparison to the results of request lookahead represents a further step towards the general understanding of lookahead mechanisms. Likewise, an exact distributional analysis in other basic online optimization problems such as paging or scheduling is still missing.

Compliance with ethical standards
Conflict of interest The authors declare that they have no conflict of interest.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

A.1: Proof of Lemma 3.3
(a) See Michaels and Rosen (1991), chapter 7, pp. 115 and 116. (b) The proof is a straightforward consequence of the fact that the number of recurring unit-sloped paths of length 2i with s k ≥ −1 for k = 0, 1, 2, . . . , 2i is the number of all recurring unit-sloped paths of length 2i minus the number of all recurring unit-sloped paths of length 2i which hit the number −2 at least once. As a result of the reflection principle, counting the paths from (0, 0) to (2i, 0) hitting −2 at least once is the same as counting the paths from (0, 0) to (2i, −4) hitting −2 at least once. But any such path must hit −2 at some point, i.e., we are computing the total number of paths from (0, 0) to (2k, −4). In total, we obtain that the number of recurring unit-sloped paths of length 2i with s k ≥ −1 for k = 0, 1, 2, . . . , 2i is equal to the total number of paths from (0, 0) to (2i, 0) minus the total number of paths from (0, 0) to (2i, −4) which is equal to A.2: Proof of Lemma 3.5 (a) Since for 2n items at least n and at most 2n bins are needed, Bf(2n, m) = 0 for m < n and m > 2n. For the remaining m, we perform a reverse induction on m.
The base case m = 2n is valid because the only item sequence which needs 2n bins has 2n large items and it holds that n k=2n−n a n,k = a n,n = n+1 n+1 2n+2 0 = 1. For the inductive step, let Bf(2n, m) = n k=m−n a n,k be valid for some m with 2n ≥ m > n. We show that Bf(2n, m − 1) = n k=m−1−n a n,k . Because of m > n, there must be a pair of large items starting at an odd position for which no matching small items follow in every item sequence with objective value m since otherwise these large items could be matched with small items and would fit into a bin contradicting m > n. Hence, we obtain for any item sequence with objective value m an item sequence with objective value m −1 by replacing the first pair of large items starting at an odd position for which no matching small items follow with a pair of small items which in turn lead to a condensation. As a result, we have Bf(2n, m − 1) = Bf(2n, m) + | add | where add are the additional item sequences leading to objective value m − 1 which have not resulted from establishing a condensation in an item sequence with objective value m. These item sequences can be mapped to a unit-sloped path of length 2n not going below level −1 and ending at height 2(m − 1 − n). The next lemma is needed to complete the proof for even length 2n of σ . Lemma A.1 (a) The number a n,k of unit-sloped paths of length 2n with s k ≥ −1 for all k = 0, 1, 2, . . . , 2n which end at position (2n, 2k), i.e., at height 2k, is given by a n,k = k+1 n+1 2n+2 n−k . (b) The number of item sequences σ of length 2n without condensations where Bf[σ ] = m for m ∈ {n, n + 1, . . . , 2n} is given by a n,m−n .
Proof (a) The proof is an immediate consequence of the bijection between Dyck paths of length 2n +2 and path pairs of length n given in Deutsch and Shapiro (2001) and the included remark concerning the relaxation of the restriction of path pairs having to end in the same point. To this end, we first modify the bijection by omitting the appended u-step at the beginning and the appended d-step at the end of the Dyck path in order to facilitate recurring unit-sloped paths that are allowed to hit the level of −1. Moreover, since the number of path pairs of length n having endpoints k √ 2 apart is a n,k , it follows from the bijection that the number of unit-sloped paths ending at height 2k is a n,k . (b) A total number of m bins with m ∈ {n, n + 1, . . . , 2n} is obtained when in an item sequence without condensations m − n out of the n pairs of successive items are pairs of large items for which no matching small items can be found afterwards. Each such item sequence corresponds to a unit-sloped path of length 2n with s k ≥ −1 for k = 0, 1, 2, . . . , 2n ending at height 2(m − n) because each pair of large items contributes an amount of 2 to the total height achieved at the end of the path, and the result follows.
(b) Since for 2n + 1 items at least n + 1 and at most 2n + 1 bins are needed, Bf(2n + 1, m) = 0 for m < n + 1 and m > 2n + 1. Notice that whenever m > n + 1 for an item sequence of length 2n + 1, we have m > n for the same item sequence where the last item is deleted. Thus, there must be a pair of large items beginning at an odd position in the truncated sequence from the same reasoning as in part (a) of the proof. Objective value m with n + 1 < m ≤ 2n + 1 for an item sequence of length 2n + 1 can be attained in two ways: First, Bf needed m − 1 bins after 2n items and the 2n + 1st item leads to the mth bin. Second, Bf needed m bins after 2n items and the 2n + 1st item needs no new bin. In the first case, we have Bf(2n, m − 1) item sequences which must incur a new bin upon appending a large item; appending a small item would leave the objective value at m because there are at least two large items which could be matched with the small item. In the second case, Bf(2n, m) item sequences will not incur a new bin upon appending a small item as this item can be matched with one of the large items; appending a large item would lead to objective value m + 1 since after 2n items there can never be a bin with a small item only. We obtain Bf(2n + 1, m) = Bf(2n, m − 1) + Bf(2n, m) = n k=m−1−n a n,k + n k=m−n a n,k = 2 n k=m−n a n,k + a n,m−1−n .
Objective value n + 1 can be attained in three ways: First, Bf needed n bins after 2n items and the 2n + 1st item is large leading to the n + 1st bin. Second, Bf needed n bins after 2n items and the 2n + 1st item is small leading to the n + 1st bin. Third, Bf needed n + 1 bins after 2n items and the 2n + 1st item is small, but does not lead to a new bin. The first case is trivial. In the second case, we seek for the same item sequences because neither of them can exhibit a pair of large items starting in an odd position. In the third case, we seek for the item sequences of length 2n with objective value n + 1 which have at least one pair of large items beginning at an odd position such that the appended small item does not incur a new bin. These item sequences are counted by Bf(2n, n + 1). We obtain Bf(2n + 1, n + 1) = Bf(2n, n) + Bf(2n, n) + Bf(2n, n + 1) = n k=0 a n,k + n k=0 a n,k + n k=1 a n,k = 3 n k=0 a n,k − a n,0 .
The result now immediately follows from the formula given in part (b) of Lemma 3.5.