In the Colored Bin Packing problem a sequence of items of sizes up to 1 arrives to be packed into bins of unit capacity. Each item has one of at least two colors and an additional constraint is that we cannot pack two items of the same color next to each other in the same bin. The objective is to minimize the number of bins. In the important special case when all items have size zero, we characterize the optimal value to be equal to color discrepancy. As our main result, we give an (asymptotically) 1.5-competitive algorithm which is optimal. In fact, the algorithm always uses at most \(\lceil 1.5\cdot OPT \rceil \) bins and we can force any deterministic online algorithm to use at least \(\lceil 1.5\cdot OPT \rceil \) bins while the offline optimum is \( OPT \) for any value of \( OPT \ge 2\). In particular, the absolute competitive ratio of our algorithm is 5 / 3 and this is optimal. For items of arbitrary size we give a lower bound of 2.5 on the asymptotic competitive ratio of any online algorithm and an absolutely 3.5-competitive algorithm. When the items have sizes of at most 1 / d for a real \(d \ge 2\) the asymptotic competitive ratio of our algorithm is \(1.5+d/(d-1)\). We also show that classical algorithms First Fit, Best Fit and Worst Fit are not constant competitive, which holds already for three colors and small items. In the case of two colors—the Black and White Bin Packing problem—we give a lower bound of 2 on the asymptotic competitive ratio of any online algorithm when items have arbitrary size. We also prove that all Any Fit algorithms have the absolute competitive ratio 3. When the items have sizes of at most 1 / d for a real \(d \ge 2\) we show that the Worst Fit algorithm is absolutely \((1+d/(d-1))\)-competitive.
This is a preview of subscription content, access via your institution.
Buy single article
Instant access to the full article PDF.
Tax calculation will be finalised during checkout.
Subscribe to journal
Immediate online access to all issues from 2019. Subscription will auto renew annually.
Tax calculation will be finalised during checkout.
Babel, L., Chen, B., Kellerer, H., Kotov, V.: Algorithms for on-line bin-packing problems with cardinality constraints. Discrete Appl. Math. 143, 238–251 (2004)
Balogh, J., Békési, J., Dósa, G., Epstein, L., Kellerer, H., Tuza, Z.: Online results for black and white bin packing. Theory Comput. Syst. 56(1), 137–155 (2015)
Balogh, J., Békési, J., Dósa, G., Kellerer, H., Tuza, Z.: Black and white bin packing. In: Approximation and Online Algorithms. LNCS, vol. 7846, pp. 131–144. Springer, Berlin (2013)
Balogh, J., Békési, J., Galambos, G.: New lower bounds for certain classes of bin packing algorithms. Theor. Comput. Sci. 440–441, 1–13 (2012)
Balogh, J., Békési, J., Dósa, G., Sgall, J., van Stee, R.: The optimal absolute ratio for online bin packing. In: Proceedings of the 26th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pp 1425–1438. ACM-SIAM (2015)
Böhm, M., Sgall, J., Veselý, P.: Online colored bin packing. In: Approximation and Online Algorithms. LNCS, vol. 8952, pp. 35–46. Springer, Berlin (2015)
Chrobak, M., Sgall, J., Woeginger, G.J.: Two-bounded-space bin packing revisited. In: European Symposium on Algorithms (ESA). LNCS, vol. 6942, pp. 263–274. Springer, Berlin (2011)
Coffman Jr, E., Csirik, J., Galambos, G., Martello, S., Vigo, D.: Bin packing approximation algorithms: survey and classification. In: Pardalos, P.M., Du, D.-Z., Graham, R.L. (eds.) Handbook of Combinatorial Optimization, pp. 455–531. Springer, Berlin (2013)
Csirik, J., Johnson, D.S.: Bounded space on-line bin packing: best is better than first. Algorithmica 31(2), 115–138 (2001)
Dósa, G., Epstein, L.: Colorful bin packing. In: Algorithm Theory SWAT. LNCS, vol. 8503, pp. 170–181. Springer, Berlin (2014)
Dósa, G., Epstein, L.: Online bin packing with cardinality constraints revisited. arXiv:1404.1056
Dósa, G., Sgall, J.: First Fit bin packing: A tight analysis. 30th International Symposium on Theoretical Aspects of Computer Science (STACS), Volume 20 of Leibniz International Proceedings in Informatics (LIPIcs), pp. 538–549. Dagstuhl, Germany (2013)
Dósa, G., Sgall, J.: Optimal analysis of Best Fit bin packing. In: Automata, Languages, and Programming (ICALP). LNCS, vol. 8572, pp. 429–441. Springer, Berlin (2014)
Dósa, G., Tuza, Z., Ye, D.: Bin packing with “largest in bottom” constraint: tighter bounds and generalizations. J. Comb. Optim. 26(3), 416–436 (2013)
Epstein, L.: Online bin packing with cardinality constraints. SIAM J. Discrete Math. 20, 1015–1030 (2006)
Epstein, L.: On online bin packing with LIB constraints. Naval Res. Logist. 56(8), 780–786 (2009)
Finlay, L., Manyem, P.: Online LIB problems: heuristics for bin covering and lower bounds for bin packing. RAIRO Oper. Res. 39(3), 163–183 (2005)
Fujiwara, H., Kobayashi, K.: Improved lower bounds for the online bin packing problem with cardinality constraints. In: Computing and Combinatorics, LNCS, vol. 7936, pp. 518–530. Springer, Berlin (2013)
Johnson, D.: Near-Optimal Bin Packing Algorithms. Massachusetts Institute of Technology, Project MAC. Massachusetts Institute of Technology (1973)
Krause, K.L., Shen, V.Y., Schwetman, H.D.: Analysis of several task-scheduling algorithms for a model of multiprogramming computer systems. J. ACM 22, 522–550 (1975)
Lee, C.C., Lee, D.T.: A simple on-line bin-packing algorithm. J. ACM 32, 562–572 (1985)
Manyem, P.: Bin packing and covering with longest items at the bottom: online version. ANZIAM J. 43(E), E186–E232 (2002)
Manyem, P., Salt, R.L., Visser, M.S.: Approximation lower bounds in online LIB bin packing and covering. J. Automata Lang. Comb. 8(4), 663–674 (2003)
Seiden, S.S.: On the online bin packing problem. J. ACM 49, 640–671 (2002)
Ullman, J.: The Performance of a Memory Allocation Algorithm. Technical Report 100 (1971)
We would like to thank anonymous reviewers for careful reading and many useful suggestions.
About this article
Cite this article
Böhm, M., Dósa, G., Epstein, L. et al. Colored Bin Packing: Online Algorithms and Lower Bounds. Algorithmica 80, 155–184 (2018). https://doi.org/10.1007/s00453-016-0248-2
- Online algorithms
- Bin packing
- Worst-case analysis
- Colored bin packing
- Black and white bin packing