Harmonic bin packing
Harmonic bin-packing is a family of online algorithms for bin packing. The input to such an algorithm is a list of items of different sizes. The output is a packing - a partition of the items into bins of fixed capacity, such that the sum of sizes of items in each bin is at most the capacity. Ideally, we would like to use as few bins as possible, but minimizing the number of bins is an NP-hard problem.
The harmonic bin-packing algorithms rely on partitioning the items into categories based on their sizes, following a Harmonic progression. There are several variants of this idea.
Harmonic-''k''
The Harmonic-k algorithm partitions the interval of sizes harmonically into pieces for and such that. An item is called an -item, if.The algorithm divides the set of empty bins into infinite classes for, one bin type for each item type. A bin of type is only used for bins to pack items of type. Each bin of type for can contain exactly -items. The algorithm now acts as follows:
- If the next item is an -item for, the item is placed in the first bin that contains fewer than pieces or opens a new one if no such bin exists.
- If the next item is an -item, the algorithm places it into the bins of type using Next-Fit.
Lee and Lee also studied the asymptotic approximation ratio. They defined a sequence, for and proved that for it holds that. For it holds that. Additionally, they presented a family of worst-case examples for that
Refined-Harmonic (RH)
The Refined-Harmonic combines ideas from the Harmonic-k algorithm with ideas from Refined-First-Fit. It places the items larger than similar as in Refined-First-Fit, while the smaller items are placed using Harmonic-k. The intuition for this strategy is to reduce the huge waste for bins containing pieces that are just larger than.The algorithm classifies the items with regard to the following intervals:, ,,,, for, and. The algorithm places the -items as in Harmonic-k, while it follows a different strategy for the items in and. There are four possibilities to pack -items and -items into bins.
- An -bin contains only one -item.
- An -bin contains only one -item.
- An -bin contains one -item and one -item.
- An -bin contains two -items.
Algorithm Refined-Harmonic-k for a list L = :
1. N_a = N_b = N_ab = N_bb = N_b' = N_c = 0
2. If i_j is an I_k-piece
then use algorithm Harmonic-k to pack it
3. else if i_j is an I_a-item
then if N_b != 1,
then pack i_j into any J_b-bin; N_b--; N_ab++;
else place i_j in a new bin; N_a++;
4. else if i_j is an I_b-item
then if N_b' = 1
then place i_j into the I_b'-bin; N_b' = 0; N_bb++;
5. else if N_bb <= 3N_c
then place i_j in a new bin and designate it as an I_b'-bin; N_b' = 1
else if N_a != 0
then place i_j into any I_a-bin; N_a--; N_ab++;N_c++
else place i_j in a new bin; N_b++;N_c++
This algorithm was first described by Lee and Lee. They proved that for it holds that.
Other variants
Modified Harmonic has asymptotic ratio '.'Modified Harmonic 2 has asymptotic ratio '.'
Harmonic + 1 has asymptotic ratio.
Harmonic ++ has asymptotic ratio and.