Английская Википедия:Harmonic bin packing

Материал из Онлайн справочника
Версия от 11:01, 19 марта 2024; EducationBot (обсуждение | вклад) (Новая страница: «{{Английская Википедия/Панель перехода}} '''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 nu...»)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)
Перейти к навигацииПерейти к поиску

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 <math>(0,1]</math> harmonically into <math>k-1</math> pieces <math>I_j := (1/(j+1),1/j] </math> for <math>1\leq j < k</math> and <math>I_k := (0,1/k]</math> such that <math>\bigcup_{j=1}^k I_j = (0,1]</math>. An item <math>i \in L</math> is called an <math>I_j</math>-item, if <math>s(i) \in I_j</math>.

The algorithm divides the set of empty bins into <math>k</math> infinite classes <math>B_j</math> for <math>1\leq j \leq k</math>, one bin type for each item type. A bin of type <math>B_j</math> is only used for bins to pack items of type <math>j</math>. Each bin of type <math>B_j</math> for <math>1\leq j < k</math> can contain exactly <math>j</math> <math>I_j</math>-items. The algorithm now acts as follows:

  • If the next item <math>i \in L</math> is an <math>I_j</math>-item for <math>1\leq j < k</math>, the item is placed in the first (only open) <math>B_j</math> bin that contains fewer than <math>j</math> pieces or opens a new one if no such bin exists.
  • If the next item <math>i \in L</math> is an <math>I_k</math>-item, the algorithm places it into the bins of type <math>B_k</math> using Next-Fit.

This algorithm was first described by Lee and Lee.[1] It has a time complexity of <math>\mathcal{O}(n\log(n))</math> where n is the number of input items. At each step, there are at most <math>k</math> open bins that can be potentially used to place items, i.e., it is a k-bounded space algorithm.

Lee and Lee also studied the asymptotic approximation ratio. They defined a sequence <math>\sigma_1 := 1</math>, <math>\sigma_{i+1} := \sigma_{i}(\sigma_{i}+1)</math> for <math>i \geq 1</math> and proved that for <math>\sigma_{l} < k <\sigma_{l+1} </math> it holds that <math>R_{Hk}^{\infty} \leq \sum_{i = 1}^{l} 1/\sigma_i + k/(\sigma_{l+1}(k-1))</math>. For <math>k \rightarrow \infty</math> it holds that <math>R_{Hk}^{\infty} \approx 1.6910</math>. Additionally, they presented a family of worst-case examples for that <math>R_{Hk}^{\infty} = \sum_{i = 1}^{l} 1/\sigma_i + k/(\sigma_{l+1}(k-1))</math>

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 <math>1/3</math> 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 <math>1/2</math>.

The algorithm classifies the items with regard to the following intervals: <math>I_1 := (59/96,1]</math>, <math>I_a := (1/2,59/96]</math>, <math>I_2 := (37/96,1/2]</math>, <math>I_b := (1/3,37/96]</math>, <math>I_j := (1/(j+1),1/j]</math>, for <math>j \in \{3, \dots, k-1\}</math>, and <math>I_k := (0,1/k]</math>. The algorithm places the <math>I_j</math>-items as in Harmonic-k, while it follows a different strategy for the items in <math>I_a</math> and <math>I_b</math>. There are four possibilities to pack <math>I_a</math>-items and <math>I_b</math>-items into bins.

  • An <math>I_a</math>-bin contains only one <math>I_a</math>-item.
  • An <math>I_b</math>-bin contains only one <math>I_b</math>-item.
  • An <math>I_ab</math>-bin contains one <math>I_a</math>-item and one <math>I_b</math>-item.
  • An <math>I_bb</math>-bin contains two <math>I_b</math>-items.

An <math>I_b'</math>-bin denotes a bin that is designated to contain a second <math>I_b</math>-item. The algorithm uses the numbers N_a, N_b, N_ab, N_bb, and N_b' to count the numbers of corresponding bins in the solution. Furthermore, N_c= N_b+N_ab

Algorithm Refined-Harmonic-k for a list L = (i_1, \dots i_n):
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 (empty) 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.[1] They proved that for <math>k = 20</math> it holds that <math>R^\infty_{RH} \leq 373/228</math>.

Other variants

Modified Harmonic (MH) has asymptotic ratio <math>R_{MH}^{\infty} \leq 538/33 \approx 1.61562</math>.[2]

Modified Harmonic 2 (MH2) has asymptotic ratio <math>R_{MH2}^{\infty} \leq 239091/148304 \approx 1.61217</math>.[2]

Harmonic + 1 (H+1) has asymptotic ratio <math>R_{H+1}^\infty \geq 1.59217</math>.[3]

Harmonic ++ (H++) has asymptotic ratio <math>R_{H++}^\infty \leq 1.58889</math>[3] and <math>R_{H++}^{\infty} \geq 1.58333</math>.[3]

References