DeepAI

# An Optimal Algorithm for 1-D Cutting Stock Problem

We present an nΔ^O(k^2) time algorithm to obtain an optimal solution for 1-dimensional cutting stock problem: the bin packing problem of packing n items onto unit capacity bins under the restriction that the number of item sizes k is fixed, where Δ is the reciprocal of the size of the smallest item. We employ elementary ideas in both the design and analysis our algorithm.

06/04/2016

### One-dimensional Cutting Stock Problem with Divisible Items

This paper considers the one-dimensional cutting stock problem with divi...
09/05/2012

### On Solving the Oriented Two-Dimensional Bin Packing Problem under Free Guillotine Cutting: Exploiting the Power of Probabilistic Solution Construction

Two-dimensional bin packing problems are highly relevant combinatorial o...
07/27/2017

### An Evolutionary Stochastic-Local-Search Framework for One-Dimensional Cutting-Stock Problems

We introduce an evolutionary stochastic-local-search (SLS) algorithm for...
02/20/2018

### Selection from heaps, row-sorted matrices and X+Y using soft heaps

We use soft heaps to obtain simpler optimal algorithms for selecting the...
07/22/2020

### Online Adaptive Bin Packing with Overflow

Motivated by bursty bandwidth allocation and by the allocation of virtua...
04/02/2020

### An anytime tree search algorithm for two-dimensional two- and three-staged guillotine packing problems

[libralesso_anytime_2020] proposed an anytime tree search algorithm for ...
04/02/2020

## 1 Introduction

Let be an input sequence of items such that their sizes are in the interval and the number of distinct item sizes is at most . Our goal is to pack the items in that uses a minimum number of unit capacity bins. This problem is a special case of bin packing where the number of distinct item sizes is restricted to and is often referred to as the 1-dimensional cutting stock problem. The study of this problem was initiated by Gilmore and Gomory [4] and has a wide variety of applications [8] including cutting stock applications, packing problems in supply chain management, and resource allocation problems in distributed systems. The bin packing problem for arbitrary number of item types is known to be strongly NP-Hard [7] and hence the interest in the design of efficient algorithms and approximation schemes for bin packing under the restriction that the number of item types is fixed. For , McCormick et al. [10] presented a polynomial time algorithm for determining an optimal solution. For , Filippi et al. [3] generalized the argument in [10] to find a polynomial time solution that uses at most bins more than an optimal solution. For , Jansen and Solis-Oba [6] presented an algorithm that uses bins and runs in , where is the reciprocal of the size of the smallest item. More recently, polynomial time solvability of this problem was settled by the time optimal algorithm of Goemans et al. [5]. For arbitrary , the first PTAS was presented by Fernandez de la vega et al [2] , subsequently Karmarkar and Karp [9] presented an asymptotic FPTAS that uses bins and Rothvob [11] presented an algorithm that uses bins. Both these algorithms run in pseudo polynomial time (polynomial on , where is the number of items of the th size).

Our Results: In this paper we present an time algorithm to obtain an optimal solution for the bin packing problem under the restriction that the number of item sizes is fixed. Our main contribution is in the use of elementary ideas in both the design and analysis our algorithm. The recent result of Goemans and Rothvob [5] is theoretically a stronger result than ours, but for moderate to large our algorithm is computationally better.

## 2 An Optimal Algorithm for 1-dimensional Cutting Stock Problem

In this section, we first present some necessary terms and definitions before presenting an algorithm that given an input sequence consisting of items from at most distinct item sizes determines an optimal bin packing in , where be the reciprocal of the smallest item size in .

### 2.1 Preliminaries

###### 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 . Given the distribution vector , we define , the unit neighborhood of with respect to , to be the collection of points in such that each point in this collection is within unit distance ( norm) from some point on , and for , its th component is an integer multiple of .

###### Definitions 2.2

A unit capacity bin with a collection of items from and a free space of at most , for some , can be characterized by a -dimensional vector whose th component, , equals sum of items of size in . We refer to such a vector as vector consistent with . An vector that is consistent with is maximal if addition of any item from to the corresponding bin results in the bin exceeding its capacity.

Note: We use the norm to measure distances and sometimes use vectors and points interchangeably.

###### Definitions 2.3

Let denote the set of all maximal vectors consistent with , for . For a given multi-set of vectors from not necessarily distinct and a point , let denote the resulting vector obtained by starting at and then placing the vectors in . Given a point ,

• We say that starting at the multi-set crosses at point if and dominates (i.e. each of the components of is less than or equal to the corresponding component of ;

• We define , the set of points reachable from with respect to , as the collection of points such that each point is in and can be expressed as for some , where ;

• For , we define to be a smallest sized multi-set for which .

###### Lemma 1

Let be a sequence with distinct item sizes { }. Let be the multi-set consisting of -vectors from (i.e. bin configurations) corresponding to an optimal allocation of items in onto unit capacity bins. For some there exists a -sized minimal sub-set such that starting at or any point that dominates and is within a unit distance of , crosses a point on at a distance less than or equal to from the starting point.

Proof  We prove this lemma by contradiction. Let us assume that for any there does not exist a multi-set of vectors that crosses at any point whose distance from the starting point is in the interval . Then if we partition the vectors in into multi-sets of vectors, then since none of the sized multi-set crosses in the interval the vector sum of all the sized multi-set will not dominate and hence will not cross the tip of implying that is missing some item in and hence is not a feasible solution. Hence the result.

### 2.2 Our Algorithm

Let be a collection of -vectors from (configuration of unit capacity bins) used for optimally packing items in . From Lemma 1, we can observe that there is a -sized minimal multi-set , where , such that starting at the origin (or any point that dominates and is within unit distance from ) the vector crosses at a point which is at a distance from and ends up at a point within an unit distance of . This implies, we can obtain an optimal solution by (i) determining the minimum sized multi-set from that starts at the origin, crosses at whose distance from the origin is less than or equal to and ends up at some point that is within an unit distance of ; and (ii) determine the minimum sized multi-set from that starts at the point where the first sub-problem ends, crosses the tip of , and ends up at a point within a unit distance of the tip of . Solving these two sub-problems essentially involves solving the following problem:

Given the start and end points and respectively both in , determine a minimum sized collection of vectors from such that .

We now present a recursive algorithm for solving the above problem that can be easily converted into a dynamic program. ALGORITHM A(, , ) Input(s): (1) =  be the  sequence  of   items with distinct item     sizes { }; (2) = be the coordinate of the beginning point (3) = be the the coordinate of end point Output(s): The collection of  vectors  consistent  with    for some    (i.e. (configuration of unit capacity bins)  of  an optimal bin packing of items in ; Pre -processing: (1) Construct the unit neighborhood of with respect to ; (2) For an integer Begin (2a) Construct the collection containing all possible -sized multi-sets of vectors consistent with ; (2b) For each point and for each Begin If then ; If then ; End End Recursion: Beg in If then return ; else return ; End Observation : The size of the unit neighborhood of the distribution vector consistent with is and can be computed in time;
Observation : The size of the number of -vectors consistent with , for , is upper bounded by , and the size of , for is upper bounded by = ;
Observation : The number of distinct sub-problems solved by ALGORITHM A(, , ) is upper bounded by .

###### Theorem 2

Let be a sequence with distinct item sizes { } and be the collection of points in the -neighborhood of consistent with , where is the distribution vector of , then the minimum number of bins used to pack the items in using unit capacity bins is and can be determined in time.

Proof  Let be a collection of -vectors from used for optimally packing items in . From Lemma 1, we can observe that there is a -sized minimal multi-set , where , such that starting at the origin, the vector crosses at a point whose distance from the origin and ends up at a point within an unit distance from that crossing point. Hence, we can obtain an optimal solution by (i) determining the minimum sized multi-set from that starts at the origin, crosses at whose distance from the origin is less than or equal to and ends up at some point that is within an unit distance of ; and (ii) determine the minimum sized multi-set from that starts at the point where the first sub-problem ends, crosses the tip of , and ends up at a point within a unit distance of the tip of . This essentially reduces to solving the following problem recursively: Given the start and end points and respectively both in , determine a minimum sized collection of vectors from such that . For this recursive formulation, using a cut and paste argument we can easily see that the sub-structure property is true.

Now, we establish the computational complexity of our algorithm. From Observations and , we can notice that the run-time for the pre-processing steps and is dominated by Step and is . From Observation , we can observe the number of distinct sub-problems is and each sub-problem depends on at most sub-problems, hence the run-time for the recursion is . Combining the pre-processing time and the time for recursion, we get the run-time of our algorithm is .

## 3 Conclusions

We have designed a psudo-polynomial time algorithm for the Bin Packing problem under the restriction that the number of item types is at most . For large

, our result is stronger than the currently best known theoeretical result of Goemans et al [GR14]. We are in the process of analyzing heuristics that are relaxed version of this algorithm that consider only a small fraction of the bin configurations (please see Divakaran

[1]) that in practice provide good approximations and scale well computationally.

## References

• [1] S. Divakaran. A Fast Scalable Heuristic for Bin Packing. CORR 1904.12467, 2019.
• [2] W. Fernandez de la Vega and G.S. Leuker. Bin packing can be solved within in linear time. Combinatorica, Volume 1, Issue 4, 349-355, 1981.
• [3] C. Filippi and A. Agnetis. An asymptotically exact algorithm for the high-multiplicity bin packing problem. Math. Program., 104(1):21–37, 2005.
• [4] P. C. Gilmore and R. E. Gomory.

A linear programming approach to the cutting-stock problem

.
Operations Research, 9:849–859, 1961.
• [5] M. Goemans and T. Rothvoß. Polynomiality for Bin Packing with a Constant Number of Item Types. Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, 830-839, 2013.
• [6] K. Jansen and R. Solis-Oba. An OPT + 1 algorithm for the cutting stock problem with constant number of object lengths.

In Friedrich Eisenbrand and F. Bruce Shepherd, editors, Proceedings of the 14th International Conference on Integer Programming and Combinatorial Optimization

, IPCO 2010, pages 438– 449, 2010.
• [7] D. S. Johnson. The NP-completeness column: An ongoing guide: The tale of the second prover. Journal of Algorithms, Volume 13, Issue 3, 502-524, 1992.
• [8] D. S. Johnson, A. Demers, J. D. Ullman, M. R. Garey and R. L. Graham. Worst-case performance bounds for simple one-dimensional packing algorithms. SIAM Journal on Computing, Volume 3, Issue 4, 256-278, 1974.
• [9] N. Karmarkar and R. M. Karp. An efficient approximation scheme for the one-dimensional bin-packing problem. Proceedings of the 23rd Annual IEEE Symposium on Foundations of Computer Science, Chicago, IL, 312-320, 1982.
• [10] S. T. McCormick, S. R. Smallwood, and F. C. R. Spieksma. Polynomial algorithms for multiprocessor scheduling with a small number of job lengths. SODA, pages 509–517, 1997.
• [11] T. Rothvob. Approximating Bin Packing within O(log OPT * log log OPT) bins. 2013 IEEE 54th Annual Symposium on Foundations of Computer Science, 20-29, 2013.