Bin-Packing Algorithms
In this section, a detailed definition of the online bin-packing problem would be summarized as a foundation, and competitive ratio, a widely used measurement for algorithm performance, would be introduced. Reviews of several classical algorithms would also be given.
The classical bin packing problem is defined by an infinite supply of bins with capacity B and a list L of k items (or elements). Recall that the aim is to pack the items into a minimum number of bins under the constraint that the sum of the sizes of the items in each bin is no greater than B. A bin-packing problem is called “online” when each element needs to be packed as soon as it is inspected, without the knowledge of other future items.
The performance of an approximation algorithm is majorly measured by its worst case behavior, which could be quantified by an asymptotic worst-case ratio (asymptotic performance ratio). For online problems such as the online bin-packing problem, it is also called a competitive ratio, which would be used in this paper. Let
denotes the number of bins used by Algorithm
A to pack the items of
L;
denotes an optimal algorithm, which always uses a minimal number of bins. Let
be the set of all lists
L for which the maximum size of the items is bounded from above by
. For every
,
Based on Equation (
4), the competitive ratio (or asymptotic performance ratio) could be formulated as a function of
:
As shown by Equation (
5),
measures the quality of the packing decisions made by algorithm A in the worst case, compared with the optimal result. Additionally, plainly,
. Based on Equations (
4) and (
5), a more universal form could be derived, which is
for every list
. Conventionally, if
is not specified, the competitive ratio of algorithm A could be denoted as
. In this paper, uncommon cases where
are not studied, so no specification would be made.
Based on the measure above, many simple but effective online algorithms were proposed. In describing an online bin-packing algorithm, we use the current item to indicate the next item to be packed before a decision point. So right after a packing decision, the item current item changes from to . One of the simplest approaches is to pack items in sequence according to
Next-Fit (NF): After packing the first item, NF packs each successive item in the last opened bin, if the bin could contain that item. Otherwise, the last opened bin would be closed and the current item would be placed in a new empty bin.
The advantage of Next-Fit is that it is quite an efficient algorithm, with the time complexity of O(n). The disadvantage of this algorithm is a relatively poor competitive ratio:
[
1].
A conspicuous aspect of its performance is that it closes bins that could be used for packing future items. A direct modification to this algorithm is to keep all the bins open throughout the packing process. A greedy way is to locate a bin with largest remaining capacity, which is
Worst-Fit (WF): If there is no open bin that can contain the current item, then WF packs the item into a new empty bin. Otherwise, WF packs the current item into a bin with the largest remaining capacity. If there is more than one such bin, WF chooses the one with the lowest index.
Although it could be expected that WF performs better than NF, it does not. It is proved that
[
2].
Another simple rule is to scan through all the opened bins one by one and put the item into the first bin that fits the item.
First-Fit (FF): If there is no open bin that could contain current item, then FF packs the item into a new empty bin. Otherwise, FF packs the current item into the lowest-indexed bin that fits.
To achieve a better performance, a natural complement to WF has also been studied. Instead of choosing the bin with highest remaining capacity, it aims to pack the item into a bin such that the waste is minimized.
Best-Fit (BF): If there is no open bin that could contain current item, then WF packs the item into a new empty bin. Otherwise, BF packs the current item into a bin with the lowest remaining capacity. If there is more than one such bin, BF chooses the one with the lowest index.
By adopting proper data structure, the time complexity of FF, BF and WF is O(n log n). It has been proved that
[
1].
FF, BF, and WF share many common characteristics. One of them is the satisfaction of Any-Fit constraint, proposed by [ref]. Any-Fit constraint is that, in a packing decision, if bin j is empty, it cannot be chosen unless the current item will not fit in any bin to the left of bin j. By fulfilling the constraints, FF, BF, and WF are also called Any-Fit algorithms. They are straightforward, incremental, and do not classify open bins into different categories. The upper and lower bound of competitive ratio of these algorithms have been proved, which are
[
2].
Other than incremental Any-Fit algorithms, many bounded-space algorithms have also been explored. An algorithm is bounded-space if the number of open bins at any time in the packing process is bounded by a constant. For example, First-Fit utilizes one bounded-space. The motivation and practicality of developing this type of algorithm are clear. For example, to load trucks at a depot, one cannot have an infinite number of trucks at the loading dock. One of the most trivial algorithms is a modified version of Next-Fit called Next-k-Fit (NF
k) [
3]. It packs items following the First-Fit rule, but only considers k most recently opened bins; when a new bin has to be opened, the opened bin with lowest index would be closed. As expected, the competitive ratio of NF
k tends to
with k increasing. Based on the idea of bounded-space, a potential improvement direction, as pointed out by [
4] and summarized by [
5], is to consider adopting the reservation technique, to proactively retain empty space for future items. This idea had already appeared in some research.
Ref. [
6] proposed a bounded-space algorithm Harmonic
k(
Hk). This algorithm is based on a special, non-uniform partitioning of item size interval
. The “harmonic partitioning” is used to classify items into
k groups:
and
.
-element is defined as an element of which the size belongs to interval
. Similarly, bins are also classified into k categories and an
-bin is defined to contain
-element only.
-elements could only be packed into an
-bin following the rule of Next-Fit, and thus, at most k bins could be open at the same time. It has been proved that
, lower than all Any-Fit algorithms. The bottleneck of the algorithm is the waste of space of
-element, of which the range of size is
. For an item with size just over
, almost half of the capacity of the packed bin would be wasted. However, it has been proved that bounded-space algorithm cannot do better than Harmonic
k.
Yao [
4] firstly broke through this barrier with the Refined First-Fit (RFF) algorithm, which has unbounded space. Unlike Harmonic
k, this algorithm does not parameterize the partitioning but divides the
statically into
,
,
, and
. Other than packing type
item into type
bin, every sixth type-2 item would be packed by First-Fit into type-4 bins. It has been proved that
. Compared with Harmonic
3, RFF separates the
with
, and assigns
to complement the bin space wasted by
items.
With the idea from RFF, many algorithms based on Harmonic
k managed to better use the wasted space of
-bins, including Refined Harmonic [
6], Modified Harmonic [
7] Harmonic+1 [
8], Harmonic++ [
9], etc. The latest lower bound of this problem is 1.54037 [
10].
Like
Hk and RFF, every algorithm with the idea of a reservation technique tends to combine two or more types of items with some rules to avoid being short sighted.
Hk combines every
-element into
-bins so that all the closed bins must have a remaining capacity less than
. For example, a closed
-bins with item size range
always have five items inside, which means that the utilized capacity would be higher than
, which means that the wasted space would always be less than
. It is clear that as
j increasing, the utilisation of bins would increase. The calculation of competitive ratio of this algorithm [
6] shows this trend: as
k rises, the competitive ratio never worsens.
Recall that based on the limitation of the wasted space caused by large items, especially ones larger than
, one improvement is to fill the wasted space with other items. Very recently, after many Harmonic-based algorithms, Ref. [
11] summarized a general framework SuperHarmonic: it classifies incoming items of one type into red items and blue items. Then, intuitively, it packs the blues bottom up and packs the reds top down to reduce waste. Other than harmonic partitioning, it also integrates manual partitioning. Based on this framework, algorithm SonOfHarmonic reaches the competitive ratio of 1.5813.
Other than harmonic-based approaches, many methods with various performance measures have been developed for BPP. Attempting to combine strength of different heuristics, hyper-heuristics that chose one suitable heuristic from a set of heuristics were proposed to solve a particular portion of a problem instance [
12]. The performance of different heuristics on a historical basis was measured and a decision was made on heuristics selection for the next segment of instance. The success rate, compared to BF and FF, was adopted as a performance measure.
An adaptive rule-based algorithm was developed in [
13]. Instead of using a value to choose different heuristics, it automatically configured the behavior of an algorithm by computing a threshold value based on available data elements. This could be seen as a generic meta-heuristic framework and could be applied to multiple online problems, including bin packing, lot sizing and scheduling. The algorithm was assessed using an experimental competitive ratio.
Inspired by approximate interior-point algorithms for convex optimization, Ref. [
14] proposed a interior-point-based algorithm. It is fully distribution-oblivious, meaning that it does not make decisions based on distribution information, i.e., it is learning based. Under its average case analysis, the algorithm was proven to exhibit
additive suboptimality compared to offline solutions, which is lower than all existing distribution-oblivious algorithms, which have
.
In [
15] attempts were made to directly apply human intuition to solve 2D BPP. They recorded human behaviors from game-play and created multiple Human-Derived Heuristics (HDH) in the form of decision trees.
A Deep Reinforcement Learning (DRL) method was adopted learn the policies to solve a 3D online BPP [
16]. Since the target scenario is the factory assembly line, the next few coming items could be determined in advance with this problem formulation. Space utilization and stacking stability were used as performance measures.
Little research has been conducted to establish a full understanding of combining a parameterized partition set of items to form patterns. This will be investigated in the following sections.