New Pretreatment and Resolution using the Bee Colony Optimization for the Two-Dimensional Bin Packing Problem

The two-dimensional bin packing problem involves packing a given set of rectangles into a minimum number of larger identical rectangles called bins. In this paper, we propose and develop mathematically a new pretreatment for the oriented version of the problem in order to reduce its size, identify and value the lost spaces by increasing the size of some objects. A heuristic method based on the first-fit strategy adapted to this problem is proposed. We present an approach of resolution using the bee colony optimization. The computational results show the effectiveness of the pretreatment in reducing the number of bins.


Introduction
The two-dimensional bin packing problem (BPP-2D) is defined as follows: given a set of m rectangular objects A = {a 1, …,a m } and a number of larger identical rectangles called bins, the problem is to find the minimum number of bins that must be used to pack this set of objects without overlapping.This problem has many industrial applications, including the cutting of standardized stock units in the wood, steel and glass industries, packing on shelves or truck beds in transportation and warehousing, and the paging of articles in newspapers.Many real problems can be modeled as bin packing problems.However, each real problem has its own specificities.The one-dimensional bin packing problem is strongly NP-hard.This also applies in BPP-2D, since it is a generalization of the one-dimensional version [1].Many papers deal with BPP-2D where the objects have a fixed orientation.Lodi et al. [3] have proposed an extensive survey.We quote Berkey and Wang [4], who have presented a heuristic version for the problem.Meta-heuristic procedures have been presented in Lodi et al. [2] and Faroe et al. [5].
Lower bounds have been presented in Carlier et al. [6].They dominate the bounds introduced by Boschetti and Mingozzi [7], Martello and Vigo [8] and Fekete and Schepers [9].Few papers deal with the version of BPP-2D where objects may be rotated by 90•.A heuristic method and new lower bounds have been introduced by Boschetti and Mingozzi [10].Lodi et al. [2] have presented a metaheuristic algorithm based on a Tabu search method.Another tabu search method has been proposed in Harwig and Barnes [11] where objects are packed in bottom left stable positions using the method presented in Chazelle [12].
We are interested in the case where the objects have a fixed orientation.This version is known as 2BP|O|F according to the classification proposed by Lodi et al. [2], where the field denoted O means that the objects are not rotated by 90• and the field denoted F means that guillotine packing are not imposed.
Throughout this paper, we consider that each object a i = (L i , l i ) in the set of the objects A has a width L i and a height l i .We denote as L and l the width and the height of the bin B= (L, l).An instance I of a BPP-2D|O|F is then defined by the pair (A, B).L i is the greatest dimension of the object a i , and l i the other dimension.The largest and smallest dimensions of the bin are, respectively, L and l.
This paper is organized as follows: In section 2, we propose a new pretreatment for the twodimensional bin packing problem with fixed orientation.The strategy used to represent a solution based on a first-fit algorithm adapted to this problem is described in section 3.In section 4, we are interested in modeling the problem using the bee colony optimization.The implementation is to test the effectiveness of pretreatment; indeed it is to compare the number of bins used on the same instance, with and without pretreatment.The principle of creating the sets of tests is given in Section 5.The simulation results of the bee colony optimization algorithm are shown in section 6.A conclusion follows in section 7.

Pretreatment
The pretreatment when applied to an instance I, increase the size of some objects within the instance.If an object takes the size of a bin, its optimal packing is then known and it can be treated separately.This allows the cardinality of the set of the objects to be reduced without modifying the optimal value of the problem.This way, the pretreatment help to increase the total area of the objects and also simplify the instance, therefore the application of the pretreatment is interesting before a resolution procedure.The proposed pretreatment is based on the concept of identically feasible function (IFF) defined in Carlier and al. [6] as follows: I = (A, B) is an instance of the BPP-2D the function f is an IFF associated with the instance I if and only if the instance f (I) = (A', B) obtained by applying f to all objects of A is such that OPT (I) = OPT (f (I)).
The pretreatment consists in reclaiming lost areas in the bins.Applying pretreatment to the initial instance allows some objects to be enlarged.If the size of an object is updated to the size of a bin, its optimal packing is then known and it can be treated separately.
We classify the objects into three categories: large, small and intermediate objects.For the latter, we introduce a new concept called equivalence class.It involves creating subsets of objects.Each subset is characterized by objects of the same height and classified in order of decreasing width.
The symbols and abbreviations used to define the pretreatment are: m: number of objects (m ∈ N + * ) n: number of bins (n ∈ N + * ) A = {a i = (L i , l i ), ∀ i=1… m} B: all the bins of the same size as B = (L, l) L: width of each bin l: height of each bin L i : width of the object a i l i : height of the object a i For a i ∈ A: L i ≥ l i (∀ i=1, 2…, m)

Definition 1
The dimensions of the objects and bins are integers.An instance I of BPP-2D oriented is then defined by the pair (A, B).The optimal value of the number of bins needed to store all the objects of an instance I is denoted OPT (I).Each object is stored in a bin and positioned such that the edge of L i dimension is parallel to the width of the bin (L) and that the edge of l i dimension is parallel to the height of the bin (l).(Fig. 1 Each object a i = (L i , l i ) in A has : L i ≤ L and l i ≤ l otherwise the feasibility is not possible.L i ≥ l i (i = 1, 2… m), this constraint allows the storage of the objects depending on the width.The set A is composed of the subsets of objects following A G , A I , A P , such as: A = A G ∪ A I ∪ A P A G : all large objects A I : all objects defined by identical properties (depending on height) A P : all sufficiently small objects Definition 3  i is the equivalence class containing objects that have their height equal to l i  i = {ai ∈ AI : having the small dimension equal to l i } height of the objects of the equivalence class i with :

Mathematical formulation
The following model minimizes the number of bins used by a solution: z : integer variable that takes the value 1 if the bin z is used and 0 otherwise. iz : integer variable that takes the value 1 if the object a i is placed in the bin z, and 0 otherwise.ℱ izt : integer variable that takes the value 1 if the object a i is placed in the level t of the bin z, and 0 otherwise.
The Constraint (2) controls whether each object is placed in a single bin.The constraints (3.1) and (3.2) satisfy respectively that the sum of the widths (heights) of the objects placed in a bin does not exceed the width (height) of the bin.The Constraint (4) controls whether each object is placed in one and only one level within a single bin.

Feasibility constraints
This pretreatment is designed to store objects oriented in their large size.The objects, sorted in descending order of their width, are classified into three categories: -The large objects: noted A G , are the objects that occupy more than the half of the bin in the width and height.
-The objects defined by identical properties (depending on height), noted A I and are represented by the equivalence classes.
-The sufficiently small objects: noted A P are the objects that have the large dimension less than a threshold established.They are placed with large and with objects defined by identical properties in order to reduce their size and get an optimal storage.The objects of A I are in conflict with those of A G hence the expression: A conflict between two objects is a restriction prohibiting storing these objects in the same bin.[13] A conflict also exists between the objects belonging to different equivalence classes in the same level, such as: The objects a i' and a j cannot be stored in the same level of a particular bin.
In the following, we will clarify the magnitudes concepts of the large objects, objects defined by identical properties (according to height) and the sufficiently small objects by dimensional constraints into three categories: Category 1 A G is the set of large objects, such as: Two objects of the subset A G cannot be placed in the same bin.Indeed for any pair of objects (a i , a j )∈ A G we have: ∀ a i , a j ∈ A G : L i +L j > L and l i + l j > l If a large object takes the size of a bin, its optimal storage becomes trivial and it can be separated from the instance to solve.Otherwise, objects belonging to A P are stored with the large object in the bin.
The number of bins required to store all the objects of A G is equal to the cardinality of the subset A G (| A G |). Thus, the total number of bins n is such that n > | A G |. Category 2 the subset A I is defined as follows: In the subset A I the relation R is defined by: ∀ a i , a j ∈ A I , a i R a j  l i = l j Two Objects a i , a j ∈ A I are bound by the relation R if and only if a i and a j have the same height.

Volume 14
Category 3 the subset A P represents all sufficiently small objects, such as: These are the objects that have a sufficiently small size so they can be stored with the objects of A G and / or A I .

Storage of objects
The storage of the objects must respect the following strategy: The large objects are sorted according to their decreasing width, followed by the intermediate objects (the majority) who themselves are divided into equivalence classes and sorted according to their decreasing height (recall that in each equivalence class the objects are sorted in descending order of width).And finally, the sufficiently small objects, such as large objects, are sorted in descending order of width.B= (12,10).
For this instance, we have:

Storage of large objects
For each object a i ∈ A G placed in a bin, two new bins B i 1 and B i 2 are considered: B i 1 = (L-L i , l i ) and B i 2 = (L, l -l i ).
li Li

Fig.2. Storage of a large object in a bin
The two bins B i 1 and B i 2 are filled with the subset A P' ⊂ A P .The instance is then reduced to the optimality and the dimensions of the large object in the bin can be updated as follows: Pr 1 : a i → a i ' The function Pr 1 is a valid pretreatment procedure if and only if | A G | bins are sufficient to store A G ∪ A P' (A P' ⊂ A P ).

Storage of objects defined by identical properties (depending on height)
We consider the different equivalence classes in descending order of height.Conflict procedure detection is applied.It involves separating the equivalence classes in the same level of a given bin.The aim is to store objects belonging to the same equivalence class to form a first layer in the bin.If the lost width obtained after placement a set of objects belonging to  i (i=1… k) is less than L i , ∀ L i ∈ , objects of the subset A p \ A p' are added.For each equivalence class  i we seek to build the subset A i r,q , such that: A i r,q = { a i ∈  i : ∑ L i = p and l i = q : p ≤ L and q ≤ l}

Construction of the subsets A i r,q
Initially, the equivalence classes are organized in descending order of height.The first subject of the first equivalence class is deposited on the bottom left position in an empty bin and the remaining objects are placed at the right until no space can contain the current object.
A first level is formed with the height of the equivalence class considered.The sum of the widths of all objects stored in this level is calculated by the function S: Other subset belonging to the same equivalence class or to the equivalence class with lower height can be layered while: l-q ≥ l( i ) ∀ i∈{1,…,k}.This procedure is repeated until an optimal packing in the bin is obtained.

Note:
To ensure optimality, it is necessary to put a maximum number of objects of the same equivalence classes in a level (if the cardinality of the equivalence class permitting).Otherwise we choose the next class.
For each subset A i r,q created, two new bins B i 3 and B i 4 are considered: B i 3 = (L -r , q) such as: Lr < L i (∀ ai ∈  i : i=1,…,k ) and B i 4 = (L, l -q) 18 Volume 14 q r Fig. 3. Objects of the same equivalence class in a bin Two decision problems to solve: 1° is it possible to store objects of A P \A P' in the bin B i 3 ?2° is it possible to consider the bin B i 4 with the principle of the storage of objects defined by identical properties?For the second decision problems, there are two cases: Case 1: l -q ≥ l ( i ) i=1… k, build a new level above the previous.Case 2: l -q < l ( i ) i=1… k, sufficiently small objects of A P \A P' are stored in the bin B i 4 .
If the answers are yes then the following function is an IFF associated with the instance I considered: A i r,q ⊂ A I → A ' i r,q ⊂ A' I r'= L and q ' = q if (a i ∈ A I and L -r < L i and (l -q ≥ l ( i ) , i=1,…,k) ) r'= L and q ' = l if (a i ∈ A I and L -r < L i and (l -q < l ( i ),

Proposition of a First-Fit Decreasing Width (FFDW) adapted to the BPP-2D
The objects are sorted according to their decreasing width and oriented as follows: Each object stored in a bin is positioned such that the edge of L i dimension is parallel to the width of the bin (L) and that the edge of l i dimension is parallel to the height of the bin (l).The objects are placed according to their widths, successively in the bins for forming different levels.Initially, only one bin is considered and the objects are sorted in descending order of width.The first object (the largest) is placed at the bottom left position in the bin and other objects are placed (depending on the sort order) to the right of the first object until no space can contain the current object.
A first level is thus formed and its height is determined by the highest object belonging to this level.If the remaining height in the bin (after creating the first floor), is greater than or equal to the height of the candidate object, a new level is created over the previous.Otherwise, a new bin is considered without closing the first one.
In an intermediate stage where we have opened k bins numbered 1 to k in the order of their first use, a current object is stored in the level of the bin of lower numbers having enough space to contain it.If no bin can contain the object a i , a new bin (k + 1) is opened without closing the others.The general procedure is repeated until all the objects of the instance considered will be stored.

Optimization by bee colony algorithm
The algorithm is based on the natural bee behavior: a.The bee colony can spread over long distances in multiple directions (over 10 km).The copious amounts of nectar or pollen should be visited by more bees.b.The bees scouts looking at random from one plot to another food source.c.The bees returning to the hive evaluate different food sources in function of a certain quality threshold (measured by a combination of some elements, such as the sugar content) Bulletin of Mathematical Sciences and Applications Vol. 14 d.The bees deposit the nectar or pollen and go to the dance floor to perform a waggle dance.e.The bees communicate through the waggle dance for giving the following information: the direction of the source (angle between the sun and the source), the distance from the hive (duration of the dance) and the quality assessment (fitness: Frequency dance) f.Thus the bees can collect food effectively and quickly g.This source will be announced in a new waggle dance to determine the current food level.If this level is suitable more bees will be recruited for this source.h.Depending on the physical condition, sources with copious amounts of nectar or pollen can be visited by more bees or may be abandoned.

Basic algorithm of bee's method
The pseudo code of the basic bee's algorithm is presented in the simplified form: a. Initialize the population randomly b.Evaluate the fitness of the population c.While the stop criterion is not met d.Select m solutions amongst n to perform local search e. Recruit bees for selected solutions and evaluate their fitness f.Select the best bee in each neighborhood g.Assign the remaining bees randomly and evaluate their fitness h.End while To select and set the parameters of the bee algorithm, various tests were performed.The best combination providing an optimal solution was maintained.Indeed, we varied the number of:  Active bees (between 30% and 60%)  Scout bees (between 20% and 40%)  Inactive bees (between 10% and 30%)  Iterations from 5 to 50

The coding parameters
 The nectar (or pollen) represents the object to be placed in the bin  The hive represents the bin to fill with objects  The Quality, proximity and ease of extraction of the food source is the fitness of the solution 20 Volume 14

Implementation tests
We varied the number of objects in the instances (I 1 , I 2 and I 3 ): 60, 100, and 240.Each instance is characterized by three categories of objects with a probability of existence.The size of the bins in each instance is equal to (12,10).

Computational results
The algorithm is implemented in JAVA programming language on processor intel (R) Core (TM) i3-3120M with a speed of 2.5 GHz and 4GB memory capacity of RAM in Windows 8.The choice of integrated development environment NetBeans 7.4 was guided by the benefits of object oriented programming.
The objective is to demonstrate the impact of the introduction of the concept of equivalence classes and conflicts between objects and subsets of objects in minimizing the number of bins used.The implementation is to test the effectiveness of the pretreatment; indeed it is to compare the number of bins used on the same instance, with and without pretreatment.We begin with a resolution using an adaptation of the first-fit heuristic to our problem (FFDW).Then we proceed to the application of our pretreatment and compare the results obtained in terms of number of bins used.
The results of the simulation of the three instances I 1 , I 2 and I 3 with the pretreatment are shown in the following table: In each instance I 1 , I 2 and I 3 listed the optimal solution is given by our pretreatment.This is specially the case when the number of objects increases.These good results are mainly due to the introduction of the concept of equivalence classes.

Conclusion
In this paper, we have proposed new pretreatment for the two-dimensional bin packing problem, the oriented case .We have described an adaptation of the First Fit heuristic for the resolution of the problem.We have also compared the numbers of bins used to pack all objects of the instances with and without pretreatment and the optimal solution is giving by our pretreatment.
Bulletin of Mathematical Sciences and Applications Vol. 14

4. 2
The parameters of the simulation Objects parameters:  Number of objects to be stored  Maximum dimensions (L i and l i ) of each objects a i ∈ A Bins parameters:  Number of bins  Size of each bin (L, l) Bee algorithm parameters:  Number of bees  Percentage of each type of bees (Scouts, active and inactive)  Number of visits  Number of iterations the simulation of I 1 , I 2 and I 3 , with the pretreatment are satisfactory because the various constraints imposed have been met.It is therefore necessary to validate this pretreatment, to make a comparison with FFDW:Table3.Comparison of results between the pretreatment and FFDW

Table 1 .
Categories and probabilities of the objects in each instance