1 Introduction
The Bin Packing
problem is a classical combinatorial optimization problem that was first studied in the 1970’s by Garey, Graham and Ullman
[10] and Johnson[14], and can be stated as follows:Given a collection of unit capacity bins and a sequence of items with their respective sizes such that , determine a packing of the items in that uses a minimum number of bins from .
Bin Packing has a wide variety of applications[18]
including cutting stock applications, packing problems in supply chain management, resource allocation problems in distributed systems. Algorithms for bin packing can be broadly classified as
offline and online. Offline algorithms are algorithms that pack items with complete knowledge of the list of items prior to packing, whereas online algorithms need to pack items as they arrive without any knowledge of future. The bin packing problem even for the offline version is known to be NPHard[8]and hence has led researchers to the study of polynomial time approximation algorithms (i.e. provides near optimal solutions). Most of the initial research in Bin Packing has been in the design of simple deterministic algorithms and their combinatorial analysis leading to tighter upper bounds on the performance of these algorithms and tighter lower bounds on estimating the optimal offline and online solutions. Subsequently, there has been significant work on probabilistic analysis of these deterministic algorithms as well as on the design of randomized algorithms and approximation schemes for Bin Packing. For a comprehensive survey of classical algorithms for Bin Packing from the perspective of design and analysis of approximation algorithms, we refer the readers to Johnson’s Phd Thesis
[15], Coffman et al.[5] and Hochbaum[13] .In Bin Packing problem, we are required to pack the items in using minimum number of bins in . In this paper, we will refer to this classic version of Bin Packing as the regular bin packing problem. The offline version of regular bin packing problem is known to be NPHard [8] and hence most research efforts have focused on the the design of fast online and offline approximation algorithms with good performance. The performance of an approximation algorithm is defined in terms of its worst case behavior as follows: Let be an algorithm for bin packing and let denote the number of bins required by to pack items in , and OPT denote the optimal algorithm for packing items in . Let denote the set of all possible list sequences whose items are of sizes in . For every , . Then the asymptotic worst case ratio is given by . This ratio is the asymptotic approximation ratio and measures the quality of the algorithms packing in comparison to the optimal packing in the worst case scenario. The second way of measuring the performance of an approximation algorithm is and this ratio is the absolute approximation ratio of the algorithm. In the case of online algorithms this ratio is often referred to as competitive ratio.
Online Algorithms: NEXTFIT(NF), FIRSTFIT(FF) and BESTFIT(BF) are the three most natural online algorithms for regular bin packing that has been widely studied in the literature. These three algorithms are a part of a larger class of algorithms called Any Fit (AF) Algorithms that at any time packs an item into an empty bin only if it does not fit into any already open bin. Johnson et al.[15, 16, 18] showed that both and have an asymptotic competitive ratio of . Johnson showed that no algorithm can improve upon . Yao’s REVISEDFF(RFF)[23] was the first non online algorithm with an asymptotic competitive ratio of and was based on but essentially classifies items into types based on their sizes and uses separate bins for different item types. Later Lee and Lee[20] generalized this idea and designed with asymptotic competitive ratio . There are many other variants of and the best among them is the algorithm of Seiden[21] and has an asymptotic competitive ratio of . More recently, Balogh et al.[2] settled this online problem by presenting an optimal online bin packing with absolute worst case competitive ratio of .
Offline Algorithms: The most natural offline algorithms first reorder the items and then employing other classical online algorithms like , , or other online algorithms to pack the items. This has resulted in three simple but effective offline algorithms; they are denoted by , , and , with the “D” standing for “Decreasing”. The sorting needs time and so the total running time of each of these algorithms is . Baker and Coffman[3] established the asymptotic approximation ratio for to be , Johnson et al.[18] established and ’s aymptotic approximation ratio to be . Subsequently, Baker [1] and Yue[24]. and Csirik[4] and Xu[22] presented simplified proofs. The first improvement over was due to Yao’s RefinedFirstFit Decreasing (RFFD)[23] with an symptotic approximation ratio . This was an time algorithm. Garey and Johnson[9] then proposed Modified First Fit (MFFD) , which essentially packs the items with sizes in after packing all items , and then proved . Friesen and Langsten[7] also proposed two simple algorithms and that combines and with asymptotic approximation ratios and respectively.
Asymptotic Approximation Schemes: Fernandez de la Vega and Lueker [6] presented a PTAS that for any , designed an time algorithm with asymptotic worst case ratio , where and are constants that depend on . Johnson[17] observed that if is allowed to grow slowly when compared to then more efficient approximation schemes can be constructed. This was incorporated by Karmarkar and Karp[19] to obtain an approximation scheme where , for some positive constant . Using the idea of dual approximation algorithms, Hochbaum and Shmoys[11, 12] present approximation schemes for bin packing developed using polynomial approximation scheme for makespan.
1.1 Our Results
In this paper, we present fast polynomial time approximation schemes for bin packing based on the following two approaches: (i) Near
Identical Partitioning and (ii) Irregular Bin Packing.
Our approximation schemes in some nontrivial special cases yield asymptotically optimal solutions.
Near Identical Partitioning Approach: In this approach, we present an algorithm that (i) for some real number partitions the input sequence into identical subsequences (except for the last subsequence) of length (i.e. sum of sizes of items in these subsequences is ); (ii) determines the optimal packing for and the last subsequence using an existing polynomial time approximation scheme for regular bin packing; and (iii) constructs the packing for by concatenating the packing for the copies of and the packing of the last subsequence.
Irregular Bin Packing Approach: In this approach, we view the regular bin packing problem as a special case of irregular bin packing, a slight generalization, that can be defined as follows:
Irregular Bin Packing: Given a sequence of items with their respective sizes such that , and a collection of bins with respective capacities such that , , we need to design an algorithm to pack the items of among the bins in that minimizes the opening/use of regular bins, where a bin is regular if its capacity is and irregular otherwise.
Notice if all the bins in are of unit capacity (i.e. regular ) then the irregular bin packing reduces to the regular bin packing problem. In irregular bin packing, if an item is assigned to an irregular bin (a bin with capacity ) then we do not charge the assigned item since that bin was already open. However, if an item is assigned to a regular bin then we charge the assigned item unit since it opens that bin.
This formulation facilitates the design of simple and efficient approximation schemes that recursively solve a problem in terms of smaller but similar subproblems that exploit the unused space in bins used by an earlier solved subproblem by subsequently solved subproblems.
Paper Outline:
The rest of this
paper is organized as follows:
In Section we present a PTAS for bin packing through partitioning as described earlier, and in Section we present a PTAS for bin packing through a dynamic program for irregular bin packing.
2 Bin Packing Through Near Identical Partitioning
In this section, we present an algorithm that given a real valued parameter , partitions the input sequence into identical subsequences (except for the last subsequence) of length (i.e. sum of sizes of items in these subsequences is ) and then packs the items in these length subsequences onto unit capacity bins with wastage (unused space) of at most using an existing polynomial time approximation scheme for regular bin packing. Now, we introduce some necessary terms and definitions and examples illustrating our key idea before presenting our approximation scheme and its analysis.
Definitions 2.1
The sequence with distinct item sizes {} can be viewed as a
dimensional vector
, where for , is the number of items of type (size ); we refer to as the distribution vector corresponding to . For a given real number , let denote a length segment of (i.e. a vector that is parallel to and contains its initial segment such that its component sum equals ).Definitions 2.2
For a real number , the configuration of a unit capacity bin containing items whose sizes are and has a wastage of at most can be specified by a dimensional vector whose component, for , is the sum of sizes of items of type (size ) in that bin; and its length is in the interval , where the length of a vector is defined to be the sum of its components. We refer to such a vector as a vector (bin configuration) consistent with ; and we denote by the set of all ()vectors (bin configurations) consistent with .
Note: For certain sequences , the item sizes in may be such that for some there are no vectors consistent with (i.e. is empty).
Definitions 2.3
For a given sequence and a real number , if is nonempty then we define

a cover for to be a minimal collection of vectors from such that for , the sum of the th component of these collection of vectors is greater than or equal to the th component of ;

to be a cover for of the smallest size;

.
Remark :
If the number of distinct sizes in is not bounded by a constant , then we can still apply the above idea by partitioning the interval into distinct sizes and round the item sizes in to the nearest multiple of that is greater than or equal to the item size.
Key Idea: For an integer , we partition the distribution vector into many copies of , the length segment of
(except for the last segment), where is determined as follows:
For each , we determine
to be a real number for which has the smallest
cover (i.e. ). Then, we determine
to be an integer in that
minimizes the packing ratio (ie.
).
Example 1
Let us consider a sequence of items consisting of items of size , items of size , items of size and items of size . Let is the approximation ratio desired. For this instance the distribution vector is a dimensional vector of length . Our algorithm attempts to partition into a segment vector for some between . We can observe that we can partition into copies of the segment vector of length . For , the minimum sized cover for this segment vector of length can be determined using any of the existing PTAS or exact algorithms for regular bin packing.
Example 2
Let us consider a sequence of items consisting of items of size , items of size , and items of size . Let is the approximation ratio desired. For this instance the distribution vector is a dimensional vector of length . Our algorithm attempts to partition into a segment vector for some between . We can observe that we can partition into copies of the segment vector of length . The minimum sized cover for this segment vector of length can be determined using any of the existing PTAS or exact algorithms for regular bin packing. In this instance there are no covers for .
ALGORITHM B(, ) Input(s): (1) = be the sequence of items with their respective sizes in the interval ; (2) be a user specified parameter; Output(s): The assignment of the items in to the bins in ; Begin (1) Let be the distribution vector corresponding to ; (2) For (; ; ) (2a) Let be the length segment of ; (2b) For (; ; ) (2c) Let be a multiple of such that (3) Let be an integer in such that ; (4) Let and ; (5) Let ; (6) return End Determining : For determining the mincover of , we need to determine a smallest sized collection of vectors from , , such that for , the sum of the th components of these vectors is greater than or equal to the th component of . For this we make use of the PTAS result of Karmarkar and Karp[19] to determine a cover that is of size in polynomial time. We now introduce some definitions that will help us present the analysis of Algorithm .
Definitions 2.4
For notational convenience, let denote , the length initial segment of . Let be a real number and denote the number of configurations consistent with . Let denote the complete enumeration of the vectors (bins) consistent with , where denotes the th component of .
Let denote the number of bins packed according to configuration . Notice that the minimum cover for can be solved using the PTAS for regular bin packing originally due to Fernandez de la Vega and Leuker[6], and later improved by Karmarkar and Karp[19]. In this PTAS, the bin packing problem is formulated as an integer program as follows:
(1) 
subject to
(2) 
(3) 
Definitions 2.5
Let Algorithm partition into copies of (discarding the last segment), where is an integer in and is a length initial segment of . Let be the segment vector obtained by truncating for , the th components of to the nearest integer multiple of . Let be the cover determined by Algorithm for .
Theorem 1
.
The above theorem follows from Lemmas , and presented below.
Corollary 2
If (i) , where for the th component is an integer multiple of ; OR (ii) OR , then Algorithm constructs an asymptotically optimal cover for .
Lemma 3
Proof Notice that is obtained by truncating each component , to the nearest multiple of . Therefore, the maximum difference between the length of and is . Therefore the size of the optimal cover for cannot be more than the sum of the sizes of an optimal cover for and an optimal cover for . For , the item sizes . Therefore the size of an optimal cover for is at most . Hence the result.
Lemma 4
Proof Notice that was constructed by partitioning into identical segments of length with the minimum packing ratio. Suppose then this would imply that if we split into identical segment vectors then at least one of these segment vectors would have a packing ratio less than . A contradiction.
Lemma 5
.
Proof The Algorithm splits into copies of segment vectors and a last segment vector of length at most . Therefore, the size of the minimum cover of the last segment vector is at most . Now by concatenating the min covers of times along with the min cover of the last segment we get the result.
3 Bin Packing Through Irregular Bin Packing
In this section, we present a recursive algorithm that can be converted into a dynamic programming solution to the irregular bin packing problem. Our algorithm assumes (i) there exists a way of packing the items in using at most unit bins; and (ii) the sizes of all items in are integer multiples of a small positive rational number less than .
Let be a sequence of items with their respective sizes in the interval and = { } be a set of unit capacity bins. Let be a rational number such that every item size in can be expressed as an integer multiple of . Let . At any given instance, bins in are classified based on its level into one of types : a bin is of type if its level is , where is an integer in . Initially (at instance ), all bins are of type . Our algorithm assigns the items in one at a time onto bins in in the order of their occurrence in . The state / configuration of our algorithm at instance (i.e. after assigning the th item) is specified in terms of a tuple , where , , denotes the number of bins of type .
Note: We classify bins based on their level and not based on their content. This reduces the number of possible bin configurations and there by reducing the number of possible subproblems that our dynamic program needs to consider while computing an optimal solution.
Now, we introduce definitions that are necessary for presenting our dynamic
program.
Definitions 3.1
For , we define to be the type of item , and can be assigned to a bin of type only if . For a given bin configuration and an item , we define . That is, is the set of bin types to which can be assigned without violating its capacity constraint. For a given a bin configuration , we define to be if is assigned to an empty bin of type in and if it is assigned to a nonempty bin of type in . More formally,
(4) 
Basic Description of Our Algorithm: Our algorithm assigns the items in to bins in in order of their occurrence in . The state of our algorithm is defined in terms of the configuration of bins in ; the configuration of a bin is defined in terms of its level and not its composition ( the type of items it contains). That is, while assigning an item, our algorithm does not distinguish between bins that are filled to the same level but differ in their composition. Initially, (at instance ), all bins are of type (empty), so the inital state of our algorithm is specified by the tuple . Suppose at instance , our algorithm is in state , where , , denotes the number of bins of type . The next item can be assigned to any bin whose type is in . If our algorithm chooses a bin of type then it will end up in configuration and would cost plus the optimal number of regular bins required for assigning the items in starting in configuration . So, our algorithm assigns to a bin type whose cost is { } PROCEDURE (, ) Input(s): (1)  the initial configuration of the bins in ; (2)  the index of the next item in that needs to be assigned. Output(s): The minimum number of regular bins required for assigning items in to bins in in configuration . Begin return { }, where and . End
Lemma 6
For regular bin packing problem, given any request sequence whose item sizes are in the interval and are integer multiples of a small rational number and a collection of unit capacity bins, the procedure determines a approximate solution in approximately time, where is a tuple donoting the initial bin configuration.
Proof
Let . The runtime of is proportional to the number of subproblems, which in turn depends on the
number of bin configurations that our formulation
permits. This is the same as the number of ways we can partition
bins into categories based on its level. This can be
upper bounded by = .
Note: If we had defined the bin configuration in terms
of the bin composition (as usually done for PTAS for bin packing), then
the number of bin types would be bounded by =,
where is the number of distinct item sizes and the number of different bin configurations is bounded by =. So,
defining the state of the algorithm in terms of its level instead of
its composition results in a significant reduction in the number of
states without impacting its approximation guarantee.
Theorem 7
For a real and an integer , given a request sequence with item sizes in the interval and a collection of unit capacity bins, the dynamic program (, ) determines a approximate solution for regular bin packing problem in approximately time.
Proof Without loss of generality we assume that all items in are larger than . Let . First, we round the size of each item in to the smallest multiple of greater than or equal to . Let be the modified instance of . This will induce a rounding error of at most for each item. Since each item is at least in size. The rounding error is at most . Now, if we run the invoke the algorithm (, ) it will determine an optimal solution for . From Lemma , we know that determines a approximate solution for in approximately time. Since the rounding error for converting to is at most . The approximation guarantee of its solution for would be = and the runtime would be time
References
 [1] B. S. Baker. A new proof for the firstfit decreasing binpacking algorithm. Journal of Algorithms, Volume 6, Issue 1, 4970, 1985.
 [2] J. Balogh, J. Bekesi, G. Dosa, J. Sgall and R. Van Stee. The optimal absolute ratio for online bin packing. Proceedings of the 26th Annual ACMSIAM Symposium on Discrete Algorithms  SODA, 14251438, 2015.
 [3] B. S. Baker and E. G. Coffman Jr. A tight asymptotic bound for nextfit decreasing binpacking. SIAM Journal on Algebraic Discrete Methods, Volume 2, Issue 2, 147152, 1981.
 [4] J. Csiric. The parametric behaviour of the first fit decreasing binpacking algorithm. Journal of Algorithms, 15:128, 1993.
 [5] E. G. Coffman, J. Csirik, G. Galambos, S. Martello and D. Vigo. Bin Packing Approximation Algorithms: Survey and Classification. Handbook of Combinatorial Optimization edited by P. M. Paradalos et al., Springer Science Business Media, New York., 455531, 2013.
 [6] W. Fernandez de la Vega and G.S. Leuker. Bin packing can be solved within in linear time. Combinatorica, Volume 1, Issue 4, 349355, 1981.
 [7] D. K. Friesen, M. A. Langston. Analysis of a compound binpacking algorithm. SIAM Journal on Discrete Mathematics, Volume 4, Issue 1, 6179, 1991.
 [8] M. R. Garey and D. S. Johnson. Computers and Intractability: A Guide to the Theory of NPCompleteness. W. H. Freeman, New York, 1979.
 [9] M. R. Garey and D. S. Johnson. A 71/60 theorem for bin packing. Journal of Complexity, Volume 1, Issue 1, 65106, 1985.

[10]
M.R. Garey, R. L. Graham and J. D. Ullman.
Worstcase analysis of memory allocation algorithms.
Proceedings of the 4th Annual ACM Symposium Theory of Computing, Denver
, 143150, 1972.  [11] D. S. Hochbaum and D. B. Shmoys. A packing problem you can almost solve by sitting on your suitcase. SIAM Journal on Algebraic and Discrete Methods, Volume 7, Issue 2, 247257, 1986.
 [12] D. S. Hochbaum and D. B. Shmoys. Using dual approximation algorithms for scheduling problems: theoretical and practical results. Journal of the ACM., Volume 34, Issue 1, 144162, 1987.
 [13] D. S. Hochbaum. Approximation Algorithms for NPHard Problems. PWS Publishing Company, Boston, 1997.
 [14] D. S. Johnson. Fast allocation algorithms. Proceedings of the 13th IEEE Symposium on Switching and Automata Theory, New York., 144154. 1972.
 [15] D. S. Johnson. NearOptimal Bin Packing Algorithms. PhD thesis, MIT, Cambridge, MA, 1973.
 [16] D. S. Johnson. Fast Algorithms for bin packing. Journal of Computer and System Sciences, Volume 8, Issue 3, 272314, 1974.
 [17] D. S. Johnson. The NPcompleteness column: an ongoing guide. Journal of Algorithms, Volume 3, Issue 2, 288300, 1982.
 [18] D. S. Johnson, A. Demers, J. D. Ullman, M. R. Garey and R. L. Graham. Worstcase performance bounds for simple onedimensional packing algorithms. SIAM Journal on Computing, Volume 3, Issue 4, 256278, 1974.
 [19] N. Karmarkar and R. M. Karp. An efficient approximation scheme for the onedimensional binpacking problem. Proceedings of the 23rd Annual IEEE Symposium on Foundations of Computer Science, Chicago, IL, 312320, 1982.
 [20] C. C. Lee and D. T. Lee. A simple online binpacking algorithm. Journal of the ACM, Volume 32, Issue 3, 562572, 1985.
 [21] S. S. Seiden. On the online bin packing problem. Journal of the ACM, Volume 49, Issue 5, 640671, 2002.
 [22] K. Xu. The asymptotic worstcase behavior of the FFD heuristics for small items. Journal of Algorithms, Volume 37, Issue 2, 237246, 2000.
 [23] A. C. C. Yao. New algorithms for bin packing. Journal of the ACM, Volume 27, Issue 2, 207227, 1980.
 [24] M. Yue. A simple proof of the inequality for FFD bin packing algorithm. Acta Mathematicae Applicatae Sinica, Volume 7, Issue 4, 321331, 1991.