1 Introduction

In the online bin stretching problem, we are given a sequence of items defined by their weights \(w_i\in [0;1]\). They all have to be packed into m bins with infinite capacities. We know in advance that all the items can be packed into m bins with unit size. The items are available and packed in the order of the sequence, without any knowledge on the number of remaining items and their weights. The value of a solution is equal to the size of the most stretched bin, which is the maximum between 1 and the size of the largest bin. An algorithm with stretching factor c for the online bin stretching problem is an online algorithm which successfully packs into m bins of size c, any sequence of items fitting into m unit sized bins. That is, for any instance I, the algorithm outputs a solution with value at most c. The aim is to find an algorithm having a stretching factor as small as possible.

This problem is equivalent to the scheduling problem \(Pm|online-list|C_{max}\) where we additionally know that the optimal makespan is smaller than or equal to a given value C (\(Pm|online-list, known-OPT|C_{max}\) is a subcase of this problem). The parameter \(online-list\) means that, as soon as a job is presented, all its characteristics are known (its processing time in our case) and this job has to be scheduled before the next job is seen. The reader can refer to Borodin and El-Yaniv (1998), Fiat and Woeginger (1998) for more details about online algorithms and computation and to Pruhs et al. (2004) for online scheduling problems.

The bin stretching problem has been introduced by Azar and Regev (2001). They proposed an algorithm of stretching factor 1.625 and proved that 4/3 is the optimal stretching factor with two bins. Other algorithms with improved stretching factor have then been proposed by Kellerer and Kotov (2013), Gabay et al. (2013), Gabay et al. (2015), Böhm et al. (2015) who respectively proposed algorithms with stretching factors \(11/7\approx 1.5714\), \(26/17 \approx 1.5294\) and then 1.5. The best known upper bound with 3 bins is 1.375 and is due to Böhm et al. (2015).

The upper bound on the competitive ratio (the stretching factor) for this problem has been improved while, in the meantime, the best known lower bound remained the same: 4/3. In this paper, we present a computational approach to derive improved lower bounds for this problem. We use this approach to obtain a new lower bound with value \(19/14\approx 1.3571\). This lower bound has been proven for instances with 3 or 4 bins, leaving a gap of \(1/56\approx 0.018\) between the best known lower bound and upper bound for this problem with 3 bins and \(1/7\approx 0.143\) with 4 or more bins.

In the following section, we define worst-case competitive analysis and present the classical 4/3 lower bound.

1.1 A lower bound

An online algorithm A for a minimization problem is c-competitive if, for any instance I, algorithm A provides a solution with value at most c times greater than the optimal value, i.e. for all instance I, we have \(A(I) \le c \times OPT(I)\). For the bin stretching problem, this yields \(A(I) \le c\) (we are guaranteed that \(OPT(I)=1\)).

Our objective is to improve lower bounds on c for a given problem. Ultimately, the aim is to find the smallest competitive ratio \(c^*\) among all online algorithms for the problem. This corresponds to finding the largest value \(c^*\) such that for any online algorithm A, there exists an instance I for which \({A(I) \ge c^*\times OPT(I)}\).

We now present the classical online scheduling lower bound for makespan minimization, adapted to the bin stretching problem. Consider the problem with 2 bins (\(m=2\)) and the two following sequences of items in the input:

$$\begin{aligned} \pi = \left( \frac{1}{3}, \frac{1}{3}, \frac{2}{3}, \frac{2}{3}\right) \qquad \pi ^{\prime }= \left( \frac{1}{3}, \frac{1}{3}, 1\right) \end{aligned}$$

Obviously, both of these sequences of items can be packed into two unit sized bins. Consider a c-competitive deterministic online algorithm A for the bin stretching problem. Algorithm A must pack both of these sequences of items with stretching factor at most c.

Either A packs both of the first two items, of size \(\frac{1}{3}, \frac{1}{3}\), in the same bin or in different bins. In the first case, with the sequence \(\pi \), the smallest bin is filled to at least 4/3, hence \(c\ge \frac{4}{3}\). Otherwise, with sequence \(\pi '\), the smallest bin is filled to at least 4/3, hence \(c\ge \frac{4}{3}\). In both cases, \(c\ge \frac{4}{3}\). Therefore, the stretching factor of any online algorithm is greater than or equal to \(\frac{4}{3}\).

Azar and Regev (2001) generalized this bound to any number of bins. This bound, however, has not been improved ever since. We remark that the lower bound from Azar and Regev (2001) can be extended to prove a lower bound of 7 / 6 for any randomized algorithms for the bin stretching problem and with any number of bins larger than or equal to two. This bound can be obtained by applying a uniform probability distribution on the two inputs considered by the authors.

Our aim is to improve the 4/3 lower bound. Obviously, one cannot work with all possible algorithms and instances. Yet, in order to prove that a lower bound is valid, it has to be proven for all deterministic algorithms. We remark that on a given input, considering all assignments for all items is the same as considering all algorithms. In the following, we model the problem of finding lower bounds as a game and restrict the choices of the adversary. This restriction limits the set of considered instances.

1.2 Contribution

We derive a new worst-case lower bound, with value \(19/14\approx 1.3571\). In order to obtain this bound, we model the problem as a request-answer game against an adaptive off-line adversary (Ben-David et al. 1994). That is, the problem is modeled as a two-player, zero-sum game. Then, we use the so-called adversary method in which a malicious, omnipotent, adversary is playing against the algorithm to derive improved lower bounds. In online scheduling literature, layering techniques are often used to derive lower bounds for deterministic algorithms, see e.g. Albers (1999), Bartal et al. (1994), Rudin and Chandrasekaran (2003). However, since the optimum is known in advance in the bin stretching problem, this approach is very unlikely to work. We use an automated approach based on the minimax algorithm (Neumann 1928), with alpha-beta pruning (Pearl 1982) to solve the game where the adversary has restricted choices on the weights of the items. Moreover, to comply with the known feasibility of the corresponding bin packing problem with unit sized bins, we use constraint programming to compute feasible decisions of the adversary.

The algorithm outputs a decision tree as a proof. All decisions of the adversary are provided in this tree, for all decisions of any algorithm. The proof for the 19/14 lower bound with 3 bins is provided in “Appendix”. The proof with 4 bins is not included in this paper as it is much larger and does not seem to provide more insights on a possible structure to prove the 19/14 lower bound for any number of bins.

Similar approaches have already been applied to other problems (Gormley et al. 2000). This computational approach relies on several classical tools of computer science and combinatorial optimization and can be generalized and applied to any online or semi-online problem. In this paper, we demonstrate how we apply it to the bin stretching problem and how the different components are connected together.

1.3 Outline

In Sect. 2, we model the problem of finding lower bounds for bin stretching algorithms as a game. Then, in Sect. 3, we present the algorithm and cuts we use to solve this game and compute lower bounds. Further research directions are proposed in Sect. 4. Eventually, the proof of the lower bound with 3 bins is included in the “Appendix”.

2 The bin stretching game

We model the problem of finding lower bounds for the bin stretching problem as the following two-player, zero-sum infinite game:

figure a

Let \(w_j\) be the weight selected by Player 1 on iteration j. The weight \(w_j\) is feasible if and only if the bin packing problem with m bins of unit capacities and items with weights \(w_1,\ldots ,w_j\) is feasible, i.e. the items can be packed into m bins of unit capacities. The bin packing problem is strongly \(\mathcal {NP}\)-hard (Garey and Johnson 1979). However, we can consider that the adversary is an oracle and can easily compute this problem.

Additionally, this is a game with complete information which means that both players know all the decisions taken and recall the history of the game.

The payoff of Player 1 is c, the stretching factor, while the payoff of Player 2 is \(-c\). This game is a minimax game where Player 1 aims at maximizing c while Player 2 aims at minimizing c. An algorithm for the bin stretching problem defines a behavior for Player 2. The worst-case competitive ratio of an algorithm is equal to the supremum of c when Player 2 acts according to the algorithm. The supremum on the payoff of Player 1 in this game is equal to the value \(c^*\).

It is easy to see that this game is infinite since the adversary can provide the input \(w_j=1/2^j\), for \({j=1,\ldots ,\infty }\). Hence, we cannot explore all feasible choices of the adversary unless we restrain them. To cope with this issue, we actually consider that Player 1 has the following behavior: at the beginning of a game, Player 1 chooses a positive integer C. Then, all the weights chosen by Player 1 are in \(\{1/C,2/C,\ldots ,1\}\) (and he can choose Stop as well). Considering this subset of adversaries, the game is finite: Player 1 has at most mC choices before the game is over.

In order to prove that a value c is a lower bound on \(c^*\), it is “sufficient” to show that for any algorithm, there is an instance such that the stretching factor of the algorithm is greater than or equal to c. We cannot consider all algorithms but, on a given instance, there is a finite number of decisions for Player 2 and considering all decisions is actually the same as considering all algorithms. Hence, we only need to show that, for any decision of Player 2, there is a sequence of decisions from Player 1 leading to a solution with value at least c. Figure 1 illustrates this for the 4/3 lower bound. All decisions from Player 2 are considered while only one decision for each branch is provided for Player 1.

Fig. 1
figure 1

4/3 lower bound decision tree. Player 1 decisions are the “Next: \(w_i\)”. The pairs \((w_1,w_2)\) are corresponding to the space used in the bins

3 Implementation

In order to solve the game, that is, find a strategy for Player 1 maximizing c, we implement the minimax algorithm (depth-first search) for the game previously described. We apply the alpha-beta pruning with several additional cuts. Remark that considering unit capacities and weights in \(\{1/C,2/C,\ldots ,1\}\) is the same as considering the capacities of the bins to be C and weights in \(\{1,\ldots ,C\}\). Hence, we represent an item by an integer in \(\{1,\ldots ,C\}\) and a bin by a list of integers, corresponding to the items in the bin.

3.1 Decisions on item weights and assignments

In order to decide whether an item can be proposed by the adversary, we use lower and upper bounds on the corresponding bin packing problem, including the additional new item. Some of these bounds are described in the following paragraphs.

Let \(w_1,\ldots ,w_j\) be the weights of the items, sorted in non-increasing order. We verify that \(\sum _{i=1}^j w_i \le mC\) and \(w_m+w_{m+1} \le C\). Let \(k=\max \{i|w_i > C/2\}\) (\(k=0\) if there are no such items) and \(l=\max \{i|w_i = C/2\}\) (\(l=k\) if there are no such items), we also ensure that \(2k+l\le 2m\). If any of the previous inequalities is not verified, then the weight is infeasible. At this step, we can also compute refined lower bounds such as \(L_2\) and \(L_3\) from Martello and Toth (1990). However, we choose to not compute these bounds since, in our experiments, subproblems are small and it is computationally more efficient to immediately solve these problems with an exact solver. With larger number of bins, one should consider computing these bounds before computing the exact solution of the problem.

Then, if the problem was not proven infeasible, we compute the best fit decreasing heuristic on the input. If it is feasible, then the new item is accepted. Otherwise, we need an exact approach to determine whether current item is feasible.

In our case, we use constraint programming to solve the bin packing problem. This choice was motivated by the small sizes of the problems that have to be solved. We did not implement a dedicated approach since the time spent checking feasibility is dominated by the time spent in the rest of the algorithm.

In general, for a semi-online problem, one can use any approach, including integer programming, branch and bound or any exact dedicated approach to determine whether a move for the adversary is feasible. We can also use heuristic approaches with the risk of not being able to find a lower bound because of a missed feasible move. However, when a move is validated, it has to be really feasible in order to ensure the correctness of the results of the algorithm.

Eventually, it is not necessary to verify feasibility for all items: once an item is proven feasible, all smaller items are feasible as well. Hence, by considering adversary choices by decreasing order of the weights of the items, we only have to find the first feasible item; then all other choices are smaller items, hence they are feasible.

3.2 Cuts

The size of the minimax tree is exponential in m and C. Hence, we have to find a way to cut branches in order to be able to compute optimal solutions of the restricted game. The first step to reduce the minimax tree is to break symmetries on the game: permutations on the bins are actually corresponding to identical solutions. Moreover, from Player 2 point of view, the items in the bins do not matter. Only the bin sizes matter. So, the configuration \(((6,3),(4,5),\emptyset )\) is actually the same as \(((7,1,1),\emptyset ,(3,6))\). However, these two configuration are different from Player 1 point of view since he needs to ensure that the resulting bin packing problem is feasible. Yet, to both Player 1 and Player 2, the following configurations are equivalent: \(((6,5,1,2),(7,7),\emptyset )\), \(((6,1,7),(5,2,7),\emptyset )\). These two nodes can actually be described as: \((\{(0,1),(14,2)\},\{(1,1),(2,1),(5,1),(6,1),(7,2)\})\) which is the same node to both players. The first set of the pairs gives the weights of the bins and their multiplicities while the second set of pairs denotes the weights of the items and their multiplicities. All nodes having the same encoding are equivalent.

We use this encoding to represent a (partial) solution and we take advantage of this encoding in two ways: when Player 2 packs an item, the number of edges to explore is equal to the cardinality of the first set of the pairs, which is less than or equal to m. Moreover, we use memoization (Michie 1968) to store and recall the results of the nodes we have already computed and of bin packing problems which have already been non-trivially solved. Since we use an alpha-beta pruning, which is further described, we also have to store the values of \(\alpha \) and \(\beta \) on the node, in order to be able to determine whether the value of a node shall be recomputed when it is recalled.

We apply an alpha-beta pruning to the minimax algorithm. The idea is to maintain a lower bound \(\alpha \) and an upper bound \(\beta \) on the stretching factor. The pruning works as follows: on a maximizer node, once it is known that the solution of this node will be better than the solution of another node having the same parent (this parent is a minimizer), it is not necessary to explore any other choice. And similarly for minimizer nodes.

Since the adversary is computing a solution against all algorithms, we can consider several particular algorithms. Especially, we can consider the algorithm packing all remaining items into the currently smallest bin. We do not know the remaining items, but we know that the sum of their weights cannot exceed \(mC-\sum _{k=1}^j w_k\). Let \(B_i\) be the smallest bin, if \(w(B_i)+mC-\sum _{k=1}^j w_k \le \alpha \) then we can immediately proceed to a \(\beta \) cut-off.

Additionally, we are aiming at strictly improving known lower bounds and we know that some competitive ratio can be achieved by some deterministic algorithms. So, we start the exploration with a lower bound which is equal to the best known lower bound (\(\alpha =\lfloor C\tilde{c} \rfloor \), where \(\tilde{c}\) is the best known lower bound on \(c^*\)) and an upper bound which is equal to the competitive ratio of the best algorithm: \({\beta =26C/17}\) since 26 / 17 was the best upper bound available at the time of computation.

For most values, the lower bound will not be increased, so we improve the approach by dividing it into two steps: in the first step, we determine whether the lower bound can be improved. If so, in a second step, we determine the new best lower bound. Otherwise, we go on to the next value. Thus, we start with \(\alpha =\lfloor C\tilde{c} \rfloor \) and \(\beta =\lfloor C\tilde{c} \rfloor +1\); such close values allow very early cut-offs. When the algorithm is over, the value is either \(\alpha \) or \(\beta \). In the first case, the lower bound cannot be improved for current values of m and C. We then move on to the next set of parameters \(m,\ C\). In the other case, we know that \(\frac{\lfloor C\tilde{c} \rfloor +1}{C}\) is a new, strictly larger lower bound. We re-run the algorithm with \(\beta =26C/17\) to see if this new lower bound can be further improved.

Table 1 Numerical results on few inputs

3.3 Results

We implemented the algorithm in +Python+ and used Choco (Jussien et al. 2008) as a constraint programming solver to solve bin packing problems (we also implemented approaches using integer programming). The source code of our implementation is available online.Footnote 1

Running the program with parameters \(m=3\) and \(C=14\), we obtain the improved lower bound \({19/14\approx 1.357}\). We backtracked the results and verified them manually. The proof is provided in “Appendix”. With \(m=4\) and \(C=14\), the algorithm also finds the 19 / 14 lower bound and proves it. We suspect that 19 / 14 is a valid lower bound for any number of bins but could not go further with the algorithm because of the combinatorial explosion.

We used +PyPy+ interpreter on a computer running Linux and equipped with an Intel Core i7-2600K Processor (clock speed 3.40 GHz) and 8 GB of RAM to compute lower bounds with our algorithm. Some experimental results are presented in Table 1. Using our approach, we were able to compute the results for \(m=3\) and C up to 20, and \(m=4\) and C up to 14. With larger values of m, we are only able to compute results with small C and we do not get improved lower bounds. For larger values of C, the number of nodes is too large. We remark that the limiting factor is the combinatorial explosion (see column #nodes, Table 1) and not any algorithmic factor. Optimizing the code or running it on faster computers would barely allow to compute solutions for the next values of C.

The results presented in Table 1 (except the last column) concern the single step approach, with pruning parameters initialized to \(\alpha =\lfloor 4C/3 \rfloor \) and \(\beta =26C/17\). The last column gives the number of nodes in the first stage of the two-steps approach, with \(\alpha =\lfloor C\tilde{c} \rfloor \) and \(\beta =\lfloor C\tilde{c} \rfloor +1\).

The column #calls corresponds to the number of times an item feasibility was verified. The column #exact is the number of calls to the exact method (that is when the item was not proven to be feasible or infeasible by a heuristic or a lower bound). The combinatorial explosion is very well illustrated in column #nodes where we can see that we would need significantly stronger cuts to tackle much larger problems. Table 1 also shows that the time spent verifying items feasibility is negligible compared to the whole time spent. Time spent is approximately linear in the number of nodes.

Note that for the largest values of C (\(m=4\) and \(C=13,14\)), we limited the amount of memoized data (using an LRU cache) and ran computations with the single step approach only. So the number of nodes displayed in the table is actually larger than the number of nodes that would be obtained with unlimited memory. For \(m=5\), we used a server with 32GB of RAM and also limited the number of memoized nodes (to \(6\times 10^7\) nodes).

In order to improve this algorithm, one could use a breadth-first search and for each depth, use a heuristic to select a sample of least promising nodes. Exploring these nodes in depth, will allow some early cut-offs. Another approach is to set \(C=1\) and select random weights in ]0; 1]. Then, we can run the algorithm on many random samples of items, hopefully resulting in an improved lower bound. We ran several tests using random weights distributions but we did not obtain improved lower bounds with this approach.

4 Conclusion

By modeling the bin stretching problem as a game and solving this game with computer science techniques we provided a first improved lower bound and proved it is valid with both 3 and 4 bins. For the case with 3 bins, the new 19 / 14 lower bound reduces the gap between lower and upper bounds by more than a factor of two compared to the 4 / 3 lower bound.

Very recently, Böhm (2016) obtained new results by refining the algorithm presented in this paper. He improved the bound to 45/33 for \(m = 3\) and extended the bound of 19 / 14 to \(m = 5\).

Based on the tree, it is not obvious to find out whether this bound can be generalized to any number of bins \({m\ge 6}\). Yet, the bound is valid up to 5 bins so it is likely that it remains valid with more bins.

The approach can be generalized and applied to many other packing or scheduling, online or semi-online problems. Compared to layering techniques, for multiple bins problem, there is however a trade-off on the generality of the bound: the lower bound cannot easily be generalized to any number of bins.

Because of the initial knowledge that all items can be packed into m unit sized bins, there is little hope that layering techniques could work. Future research could focus on finding more general lower bounds. For instance, by trying to design a computational approach whose results could be generalized for all values of m. One could also consider reducing the search space by exploring the search tree for particular families of algorithms.

Another subject for further research is to find good distributions of randomized item weights. By imposing a structure on the distribution of the weights of the items and running the algorithm on many inputs it is maybe feasible to improve the lower bounds. A critical factor to improve lower bounds is that the chosen weights can sum up to 1 in many different ways. This is best achieved with fractions of the same integer but the whole range of numerators might not be needed.