Hybridizing Beam Search with Tabu Search for the Irregular Packing Problem

The irregular packing problem involves arranging all the irregular pieces on a plate with the objective of maximizing the use of material. In this article, the layout is formed by the ordered sequence of the irregular pieces which is obtained by a hybrid search algorithm and where the order is decoded by a proposed placement principle. First, a novel no-ﬁt-polygon (NFP) generator is introduced. Then, a placement principle is presented with the new NFP generator. Finally, a search algorithm hybridized with beam search (BS) and tabu search (TS) is proposed to search over the sequence. The numerical experiments with many benchmark problems show that the hybrid algorithm is an applicative and eﬀective approach for solving the irregular packing problem. The hybrid algorithm can produce competitive solutions in less time than many other typical algorithms.


Introduction
e irregular packing problem arises in many manufacturing industries, such as metal cutting, textile, leather, and so on, with different industries having different objectives and constraints. In this article, the irregular packing problem is categorized as a 2D irregular open dimension problem (2DIP) by the typology of Wäscher et al. [1]. e problem is concerned with finding a good arrangement of all pieces, which may be arbitrary shape, on a plate. Usually, the objective is to maximize the material utilization or minimize the length of a plate with a fixed width. e problem of finding an arrangement of pieces to cut from or pack inside larger objects is known as the cutting and packing problem, which is NP-hard by Garey and Johnson [2].
e Irregular Packing problem belongs to the more general class of combinatorial optimisation problems-the Cutting and Packing problems. e 2DIP problem is NP-complete, and as a result, the time consumption of the algorithm is very expensive when the scale of the problem is large. To obtain approximate solutions in a reasonable time, numerous methods for the irregular packing problem have been developed [3,4]. ere are two key strategies summarized in the published literature for handling this problem. e first one, called the legal placement method, represents the problem as a sequence of pieces and applying a placement rule to construct the solution. e second one, named the relaxed placement method, considers the problem as building a layout on the plate and moves pieces within the layout. e legal placement method never allows the overlap to happen during the packing process. e two critical points of these methods are the placement sequence of pieces and the placement strategy. Art [5] implemented a placement strategy called BL (bottom-left) and using the multiple factors weighted to place the pieces. Dowsland and Dowsland [6] developed this strategy by permitting unpacked pieces to jump over the packed pieces to fill holes. Dowsland et al. [7] also proposed an algorithm where the edges of the plate width were alternated when searching for positions instead of packing pieces from the bottom to the top. Gomes and Oliveira [8] obtained the effective BL position by calculating intersections between the NFP of the already packed pieces and the next piece to be packed. Oliveira et al. [9] put forward a famous placement strategy in a sophisticated constructive heuristic called TOPOS. e solution is produced from a floating position, not the BL position. What's more, both the next piece to be packed and its placement point are determined by three criteria: (a) minimum area of the rectangular enclosure; (b) minimum length of the rectangular enclosure; (c) maximum overlaps between the rectangular enclosures of the two pieces. e other critical point of the legal placement method is the sequence of pieces. Dowsland et al. [10] proposed an algorithm that adopts a fixed sequence to place pieces. e sequence can be generated in a random way or simply by sorting the pieces by the area or length. Babu and Babu [11] implemented a genetic algorithm to search over the sequence of pieces. Oliveira et al. [9] selected the next piece dynamically by their TOPOS algorithm. Gomes and Oliveira [8] introduced a 2-swap heuristic for handling the sequence of pieces. Burke et al. [12] combined their new BLF(bottom-left-fill) heuristic algorithm with both hill climbing and tabu search, where the sequence was searched by randomly selecting one operator from four operators (an insert move, a pairwise swap, a three-way swap, and an n-way swap). e beam search algorithm was presented by Bennell and Song [13]; computational results showed that some best results published in the literature could be improved by their beam search algorithm. Sato et al. [14] proposed simulated annealing that searched for feasible layouts to be packed in a container with fixed dimensions. Burke et al. [15] extended the orbital sliding method of calculating no-fit-polygons to enable it to handle arcs and used hill climbing and tabu local search algorithm to search the sequence. Leung et al. [16] presented an extended local search algorithm swapping two given polygons in one placement and placing one polygon into a new position and used the tabu search algorithm to avoid local minima. Pinheiro et al. [17] proposed a random-key genetic algorithm, which prescribed the integration of the aforementioned metaheuristic and well-known placement rules. Mundim et al. [18] derived new concepts as the no-fit raster, which could be used to check overlapping between any two-dimensional generic-shaped pieces, and used a biased random-key genetic algorithm to determine the sequence in which pieces were packed. Martinez-Sykora et al. [19] proposed a constructive approach allowing both free orientation for the pieces, as in the case of the ceramic industry, or a finite set of orientations as in the case of the garment industry. e legal placement methods have the advantage of generating feasible solutions and reducing an infinite solution space to a discrete set of solutions. However, reducing the number of solutions may generate the possibility of omitting the global optimum at the same time.
e obvious characteristic of the relaxed placement method is to allow overlaps during the packing process. It is very easy to construct an initial layout. e layout can be built randomly, and better results might be obtained by applying a good placement strategy. To minimize the amount of overlap, the way of imposing penalties in objective functions was used widely.
Oliveira and Ferreira [20] applied a polygon-based representation where identifying and resolving overlap was handled by using D-functions. Jakobs [21] used minimum rectangular enclosures to represent the irregular pieces and then placed the pieces by the orthogonal method. Besides, the compaction algorithm was applied to move the piece towards the BL position in the orthogonal method, later, hybridizing linear programming compaction with a search algorithm to handle the process of moving pieces within the layout in Bennell and Dowsland [22]. Gomes and Oliveira [23] improved this approach by using a Simulated Annealing (SA) algorithm to search the solution space, where linear programming compaction was used to build the neighborhood structure. To avoid local optimum, meta-heuristics for resolving overlap have become quite popular in the relaxed placement methods [24][25][26].
e difference between the relaxed placement method and the legal placement method is that the former usually build the layout in a continuous region. is means that solution space can be infinite. e relaxed placement method has the advantage that no solutions are lost in the unchanged solution space. However, the time consumption of these methods may be unreasonable. In addition, such approaches even do not guarantee to produce a feasible solution. By contrast, the legal placement method produces a limited number of solutions, but the solution is effective and the run time of the algorithm is acceptable. ese approaches mentioned above can effectively solve the irregular packing problem, but the time consumption of the algorithm still can be reduced. More specifically, under the orbiting method of NFP, creating potential translation vectors and finding a feasible translation vector can be faster, and this accounts for a large portion of time consumption. Besides, the local evaluation of the placement position is extensively used, which may lead to the local optimal solution to some degree. Also, the search algorithms in the former literature have a random character. e algorithm needs to be run several times to obtain a better solution, even though it cannot always obtain a feasible solution. In this article, a hybrid search algorithm is proposed to search the sequence of pieces to be packed, which combines the local evaluation and global evaluation, and, an improved orbiting method of NFP, which reduces the steps of creating NFP in Burke et al. [27]. e proposed hybrid algorithm BSTS is somehow deterministic and can produce some good results with less time-consuming. e rest of the article is as follows: Section 2 describes using the no-fit-polygon and the novel placement principle to construct the solution under the situation of representing the problem as a sequence of pieces. Section 3 depicts the hybrid search algorithm used to search over the sequence of pieces. When a new sequence is produced by the hybrid search algorithm, the algorithm described in Section 2 will be called to construct the layout. e computational results on many benchmark problems and conclusions are, respectively, presented in Sections 4 and 5.

Novel Placement Principle Based on
Improved NFP e main contribution of this article is to find out an applicative and effective algorithm for the irregular shape packing problem. e problem is presented as a sequence of pieces that be packed with a novel placement principle. To describe the hybrid algorithm clearly, some related concepts are defined and explained first. e NFP can efficiently avoid overlaps during the packing process. e placement principle is applied to rapidly find the placement positions on NFPs and place the pieces. It is also necessary to imply a search algorithm to search over the sequence of pieces.

e Improved NFP.
e no-fit-polygon concept was first introduced by Art [5] and used to avoid overlaps when placing the pieces on the plate. Later it was developed and improved by several researchers. Although different approaches were proposed to generate NFP, they could be categorized into three general methods: (a) the orbiting algorithm [27,28]; (b) Minkowski sums [29,30]; (c) decomposition algorithm [31][32][33].
When polygon B slides around the external edge of polygon A (fixed), the locus of the reference point (on polygon B) form the NFP AB . During the orbital process, the relative orientations of the two polygons remained unchanged (see Figure 1). ere are three conditions about the position of the reference point.
If the reference point of B is positioned inside NFP AB , A and B will overlap; if the reference point of B is positioned on the boundary of NFP AB , B will touch A; if the reference point of B is positioned outside NFP AB , A and B will neither overlap nor touch.
Hence, the problem of relative positions of two polygons can be simplified as finding the relative positions between one point and one polygon (see Figure 2).
In this article, the calculation of NFP is handled by the orbital algorithm. e improved approach is logically similar to the algorithm of Burke et al. [27], while a modified implementation is proposed.
In this section, the forming process of NFP is described. When polygon B slides around A, each step creates an edge of the NFP. Unlike the algorithm of Burke, the process of producing NFP is broken down into the following three subparts: finding potential vectors, eliminating infeasible vectors, and calculating minimum distance. is method can reduce the time of creating potential translation vectors and finding a feasible translation vector.
2.1.1. Subheadings Finding Potential Vectors. As previously described, the NFP is a polygon with each edge either derived from an edge of A or B, depending on the situation (see Figure 3). e set of potential translation vectors is obtained by the touching edge pairs. ere are three possible relative positions of two oriented edges (see Figure 4): (1) A vertex of the orbiting edge b touches the middle of the fixed edge a; the potential vector is P t P e ��� �→ . (2) A vertex of the fixed edge a touches the middle of the orbiting edge b; the potential vector is P e P t ��� �→ . (3) Both edges touch at a vertex. In this case, the potential vector can be detected by the following rules: Figure 5).

Eliminating Infeasible Vectors.
e potential translation vector produced by the method mentioned above might be infeasible.
is section is to eliminate those potential vectors which result in immediate intersections. For example, in Figure 6(a), two potential translation vectors, a4 and −b1, can be created according to the rules mentioned in case 3. Figure 6 demonstrates how to identify an infeasible translation vector (a4). e edge-pairs involving edge a4 have been omitted for brevity. Only the edge pairs of the other touch point need to be tested. If translating polygon B along vector a4, this would result in an immediate intersection between edges a1 and b1 (and also a2 and b1). Once one translation is infeasible, the vector should be eliminated, so a4 is not a feasible translation vector.

Calculating Minimum Distance.
Before polygon B translates along the translation vector, the feasible translation vector must be trimmed, which means calculating the minimum distance of the vector. is is necessary because other edges may intersect during the translation of polygon B. For example, in Figure 7(a), polygon A and polygon B intersect because of applying the entire vector without trimming. In this case, the minimum distance from the original point to the intersection point defines the final feasible vector (see Figure 7(b)).

e Novel Placement Principle.
e solution space of the irregular packing problem is infinite without limiting the placement positions and rotations. To reduce the solution space, some placement principles have been presented, such as BL and TOPOS. BL principle, in which a piece is placed to the bottom-left position, usually works for the orthogonal packing problem, not for the irregular packing problem. TOPOS algorithm is to place the piece by evaluating the placement positions with the evaluation criteria.
In this section, to determine placement position and rotation angle for each piece, a new placement principle based on BL principle and lowest-gravity-center principle [34] is applied. e modified and concise criteria are proposed to evaluate the best placement position. Two attributes (length L and area A of the rectangle enclosure) are selected to create the criteria Z as follows (equations (1)-(3)).
Now, given a piece, its gravity center is first calculated and then can generate two NFPs (gravity-center NFP and bottom-left NFP) by viewing the gravity center and the bottom-left vertex as the reference point, respectively. Note that both gravity-center NFP and bottom-left NFP will be different when different rotations of the piece are performed. e lowest gravity center and bottommost-leftmost vertex are chosen to be evaluated by the criteria presented above. e position with the best evaluation is determined to be the placement position. Figure 9 shows an example of the presented placement principle. e two solid polygons (noted 1, 2) are the gravity-center NFPs with two different

The Hybrid Algorithm for Searching Sequence
Usually, some sorting criteria, such as the area or the length, are applied to determine the packing sequence of pieces.
Better solutions can be produced if a search algorithm is applied to searching over the sequence. BS and TS algorithms can successfully solve the 2DIP problem, but there are still some imperfections. e beam search is a heuristic with a strong global search and deterministic. However, this may also generate the possibility of removing other good solutions. To deal with the problem, tabu search is hybridized with a strong local search with beam search to implement an applicative and effective hybrid search algorithm BSTS. e focus of this section is on the hybridization of tabu search with beam search in the resolution of the packing sequence.

Tabu Search.
Different from some greedy algorithms, tabu search is a search algorithm with a neighborhood set that accept worse solutions, not always better solutions. e advantage of this characteristic is that the tabu search can escape from local minima. Tabu list is a dynamic and flexible memory structure that prevents the algorithm from performing the recently executed moves in the next few iterations. e tabu search mechanism in this article is similar to the algorithm of Glover and Taillard [35]. e neighborhood size in the tabu search is set to 5 and the tabu list is 100, which contains the recently searched solutions, not the moves. In this article, to extensively search over the packing sequence, tabu search is applied to hybridize with beam search. e focus of the tabu search is on escaping from local minima. So the neighbour structure is defined as a 4-way swap where four randomly selected pieces are swapped. e process can be represented in the following way (see Figure 10).

Beam Search.
Beam search is an established heuristic derivative branch-and-bound. A common application is the algorithm that uses a tree search mechanism in which only the most promising nodes are performed to branch at each level according to the evaluations. Usually, a two-stage beam search is applied with two evaluations: local evaluation and global evaluation. A local evaluation (also called rough evaluation) can be faster but may result in discarding some good solutions, whereas a global evaluation (also called accurate evaluation) usually may be more time-consuming. So, the combination of the two evaluations is significant in most beam search algorithms.
First, a local evaluation is applied to evaluate all child nodes (branching from each beam node) and select the best c nodes (filter width) at each level. en, the global evaluation is used to accurately evaluate the c nodes and retain the best w nodes (beam width) to branch (see Figure 11).
In this article, the search tree, from the root to the last level, represents the packing sequence of all pieces. At each level, each node with its parent nodes in the upper levels  Mathematical Problems in Engineering represents a partial solution. Each branch from each beam node means adding an unpacked piece to the partial solution until the lowest level, which means the complete solution.
Obviously, from the root to the lowest level, the number of levels is the number of all pieces. And at each level, the number of nodes branching from its parent node is the number of the remaining piece types. Figure 12 shows how beam search works for the problem.

Hybrid Algorithm.
As mentioned above, the beam search is a heuristic with a strong global search and deterministic. However, this may also generate the possibility of removing other good solutions. To deal with the problem, hybridize tabu search with a strong local search with beam search to implement an applicative and effective hybrid search algorithm BSTS. e hybrid search algorithm uses the same process of the beam search except that using global evaluation to evaluate the complete solution. In the hybrid search algorithm, the sequence of the already packed pieces has been determined by the BS mechanism and only the unpacked pieces need to be searched by tabu search, not simply ordered randomly or by decreasing area. e hybrid search algorithm is a twostage strategy, where the local evaluation is the same criteria was presented in the placement principle, but the global evaluation is the length of the complete solution. e process of the algorithm can be represented as in Figure 13

Results
In this section, the hybrid algorithm is tested by the benchmark problems previously published in the literature. To provide good solutions, NFP and the novel placement principle are discussed in Section 3 to place each piece by the sequence, which is given by the BSTS. Implementation and parameters are set by preliminary computational experiments, which are not discussed in this article.

Problem Instances.
Hybrid algorithm (BSTS) is tested by the packing problem instances, also used as benchmark problems in other literature. e data files can be downloaded from the ESICUP website (http:// www.fe.up.pt/esicup). e details can be summarized in Table 1.

Results.
e computational tests were conducted on a Core 2 D 2.0 GHz processor with 1024 Mb of RAM. e program was coded in Visual Studio C++.
As presented above, the times of applying global evaluation are rising with the increase of the filter width c of the hybrid algorithm, which means more time-consuming. Furthermore, if the tabu search used to determine the sequence of the unpacked pieces is complicated, the hybrid algorithm may not be acceptable. According to the preliminary computational experiments, the parameters were set by the following rules: filter width � min {M, O * 5}, Beam widths � {10, 100} with tabu iterations � (N − n − 1) * 5, where N was the total number of all pieces, n was the number of packed pieces, M was the total number of the piece types, and O was the number of the allowed orientations. e neighborhood size in the tabu search is set to 5 and the tabu list is 100. e computational tests consisted of 20 runs for each instance, both for the simulated annealing hybrid algorithm (SAHA) and the Random-Key Genetic Algorithm (μ-BRKGA).
e SAHA and μ-BRKGA algorithms can obtain a good solution to the problem.
ere are some differences between these algorithms in the computational environment. e details about the hardware environment are shown in Table 2.
e detailed parameters of the algorithms are represented in their published literature. us results are compared with the results of SAHA [23] in Table 3, and compared with the results of μ-BRKGA [36] in Table 4. e results of these algorithms are taken from their original articles. e better results obtained by the hybrid algorithm BSTS have been highlighted. Less than 1% worse results are underlined. In comparison to the average results obtained by SAHA, the proposed BSTS algorithm produces three better   Figure 13: e hybrid search algorithm.     results (Jakobs1, Jakobs2, Mao) and four comparable results (Dighe2, Fu, Albano, Marques) which are within 1% of the average results. In comparison to the average results obtained by μ-BRKGA, the proposed BSTS algorithm produces two better average results (highlighted in Table 4). Although the best results of μ-BRKGA surpass the BSTS, the time of μ-BRKGA much overtakes the BSTS. In ten benchmark problems, there are all solutions (highlighted in Table 4) to be produced much faster than μ-BRKGA. e layouts for the best results of the seven cases can be found in Figure 14 in Appendix. e details of 20 runs for the 14 benchmark problems are also shown in Table 5 in Appendix.

Conclusions
e article describes a hybrid search algorithm for the irregular packing problem. e packing problem is presented as a sequence of pieces. e sequence is searched by the proposed hybrid search algorithm BSTS and decoded by an improved placement principle. e improved orbiting method of NFP is presented. It can create potential translation vectors and find a feasible translation vector in a significantly faster time.
e placement position of each piece is determined by an evaluation, which is also the local evaluation of the hybrid search algorithm. To generate  complete solutions, tabu search is applied to search over the unpacked pieces and decide Beam nodes by using global evaluation. e hybrid algorithm BSTS is somehow deterministic and can produce some good results with less time consumed. Furthermore, hybridizing BS with TS can decrease the possibility of removing other good solutions caused by the determinacy of the single BS approach. e experiments show that the hybrid algorithm is an applicative and effective algorithm for the irregular packing problem. To demonstrate its efficiency and determinacy, the proposed algorithm can produce three better results and four comparable results that are within 1% of the average results of SAHA in the 14 benchmark problems. Also, the algorithm can produce available solutions much faster than μ-BRKGA approaches.
In future work, the performance of the BSTS will be examined in more instances available on the ESICUP website, extending the ideas developed here to other bin packing problems with irregular pieces, such as the problems arising from cutting leather, in which bins are neither identical nor rectangular, and can even have some defects, defining nonusable zones.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that there are no conflicts of interest.