MGPM Methods for Rectangular Single-Size Printed Circuit Board Orthogonal Packing Problems

Printed circuit board (PCB) orthogonal packing problems derive from the massive circuit board production process in the electronic industry. In the early stage, it mainly relied on human experiences to make decisions on how to make the most of each sheet while meeting customers’ orders. Up till now, researchers in enterprises and academic circles are still trying to explore effective mathematical models and feasible optimization methods. In most cases, what PCB companies generally face is the orthogonal layout decision, which considers positioning each rectangle PCB piece (PCB-P) on a rectangle sheet board (panel) in an ideal way so that each panel has the minimal remains with the most PCB-Ps. In this paper, multi-round gradual packing methods (MGPMs) are proposed based on the idea of combinatorial optimization and dynamic programming. MGPMs include the depth priority-based method (MGPM-DP) and breadth priority-based branch-and-prune method (MGPM-BC). The former has the advantage of finding better solutions, while the latter has the advantage of consuming short computational time. Through extensive computational tests on real data from a PCB production enterprise in China, both MGPM-DP and MGPM-BC have achieved noticeable and satisfactory results compared with the simplex method, dynamic programming method, and a widely used industrial software (Yuanbo) in China.


Introduction
PCB is the core component of various types of electronic products and electrical equipment. From mobile phones to large aerospace equipment, almost all electronic products contain PCB. With the arrival of an informational society and the fast development of high-techs such as Industry 4.0, big data, cloud computing, and the Internet of things, PCB plays an even more crucial role as a solid foundation in the whole industrial chain. Since the industrial revolution, manufacturing enterprises have always been valuing the utilization rate and cost saving of raw materials.
In the PCB production industry, rectangular PCB piece (having a length (L or l) and a width (W or w)) packing problem (RP-PPP) has always been a tricky thing bothering enterprises. RP-PPP considers how to arrange a number of PCB-Ps on a whole sheet board (SB) in an ideal way to meet the production plans while improving the utilization rate of the SB, reducing production costs, and boosting PCB production e ciency [1]. Sometimes, a PCB-P is not rectangular. Enterprises normally capsule an irregular piece into a rectangle if this situation happens.
ere are two types of rectangular PCB packing decisions here. One is single-size RP-PPP, and the other is multisize RP-PPP. Single-size RP-PPP revolves around positioning PCB-Ps of the same size on a sheet board. Multisize RP-PPP can be transferred into multiple single-size RP-PPPs. erefore, researches on models and algorithms of single-size RP-PPP are fundamental and especially essential [2]. PCB packing problem is highly similar to the 2D graphics layout (cutting-stock) problem. erefore, the models and algorithms for 2D graphics layout problems could apply as references to a great extent. As is known to all, cutting or packing problems are NP-complete ones. erefore, it is impossible to depict each detailed constraint exactly. Normally approximate models are employed for this kind of problem for constraints such as a PCB piece should not overlap with others. Exact models are suitable for problems with explicit objectives and specific constraints. And both exact methods and approximate ones can be applied to solve problems with exact or approximate models. Only that, when an exact method is used for an approximate model, the solutions may not be optimal. Currently, exact methods such as linear programming method (simplex method), dynamic programming method, and branch-andbound method are mainly and extensively adopted means for solving single-size cutting-stock problems (SCPs) [3]. e nesting idea runs through the cutting problem of one-dimensional tubular objects, the cutting problem of two-dimensional graphics, the packing problem of threedimensional space, and even the packing problem under four-dimensional time constraints [4]. 2D cutting-stock problem is a special case of a 2D bin packing problem.
Agrawal [5] proposed a branch-and-bound algorithm (BBA) for single-size RP-PPP. e algorithm first constituted 2 strips based on the guillotine cut idea. en 2section, 3-section, 4-section, . . ., and n-section schemes were constructed, with each scheme being composed of 2 plans. 3-section schemes were derived from 2 2-section plans, and 4-section schemes came out from 2 3-section plans. And in a similar fashion, n-section schemes were produced by gradually splitting the bottom-right rectangular remains on the sheet board. is algorithm reduced search space and computing time to some extent. However, the optimality was not completely assured. Arslanov [6] proposed a continued fractions method, which could reduce the complexity of obtaining the total number of PCB pieces on the sheet board. is algorithm, which was based on mathematical theorems and lemmas, could greatly simplify the whole computational process. However, this algorithm could only explicitly point out the layout of PCB pieces on the bottom-left and up-right corners of the sheet board. And it did not guarantee optimality as well. Cui et al. [7] proposed a continuous fractions-based BBA. is algorithm adopted the continuous fractions method to obtain the upper bound. en a branch and bound procedure were performed to produce the layout scheme gradually. As we have mentioned before, the continuous fractions method was based on the guillotine cut idea.
us, the upper bound may not be an ideal one. He and Cui [8] designed a dynamic programming algorithm, which was based on two types of strips, as shown in Figures1(b), and 1(d). Yang and Cui [9] performed research, which is based on literature [8], and considered cutting numbers for each scheme. However, the effect of cutting numbers was set too small to be a leading factor.
Li [10] developed a two-stage method based on the dynamic programming algorithm and a -D knapsack algorithm. Firstly, several workplates were constructed. en, a dynamic programming algorithm was applied to determine the layouts of PCB pieces on each workplate. Afterwards, several segments, which were stacks composed of workplates with the same width as shown in Figure 1(d), were obtained by solving a 1D knapsack problem. Finally, segments were selected by solving another 1D knapsack problem and packed horizontally on the sheet board. Wang et al. [11] and Cui et al. [12,13] solved multi-workplate and single-workplate PCB packing problems with dynamic programming algorithms and segment-based methods. References [7][8][9][10][11][12][13] are all features of the dynamic programming algorithm as described in the literature [9]. e possible common crises are when only two strips (actually, there are four types of strips, as shown in Figure 1) are considered and when the remaining sheet is satisfying w≤ L ≤ l or w≤ W ≤ l. For one thing, their algorithms may lead to unwanted waste. For the other, errors will occur if no further control measures are performed. References [14][15][16] are strip and stagebased methods. First, in stages, segments should be decided. en, in each segment, homogenous strips with the same orientation will be generated to fill the whole segment. In these methods, efforts should be cast on how many segments there will be. And strip-based ideas may lead to more wasted materials.
Beasley [17] proposed a tree-based exact algorithm for a single-size rectangle packing problem in 1985.
is algorithm adopted a relaxation technique that captures satisfactory approximate optimal solutions. Litvinchev et al. [18] designed an approximate integer programming algorithm that could guarantee feasible satisfactory solutions as well. Reference [19] introduced strip-based algorithms or the simplex method for 2-dimensional packing problems. ose methods are mostly feasible solutions generating tools too. Only in the pallet packing section the book presented 3-,5-,7-, and 9-block methods for nesting packing problems, and the 9-block method exhibited some optimal solutions with diagonal patterns for several cases. However, for one thing, if the scale of a problem is large, the 9-block method would not always be the best one (11-,13-,15-or 17-block methods may be needed). For the other, when and how a diagonal pattern stands is still up in the air. In addition, there are many possible block types in each block-based method. erefore, making sure which method and block types should be employed and what the placement sequence of all the blocks will be really time-consuming. For a manufacturing factory, satisfactory solutions with simpler packing patterns and acceptable time would be more plausible than optimal solutions with intricate separation lines and unbearable computational time.
In this paper, a step-by-step gradual nesting method based on the dynamic programming idea and a branch-andprune strategy-based method is proposed from the perspective of making full use of the length and width of the sheet board. According to the experimental results, satisfactory and feasible results are obtained within acceptable computational time.

Mathematical Models for Constructing Feasible Solutions
Currently, there are not many mathematical models for RP-PPP since RP-PPP itself is difficult to depict explicitly. Normally, two models appear in most references. One is the 2 Mathematical Problems in Engineering simplex method-based model, and the other is the dynamic programming algorithm-based model. Both algorithms are based on strips [9].

Simplex Method Based
Model. Suppose the rectangle sheet board is in a coordination system. e coordinate of the bottom-left corner point is (0, 0). e X-axis overlaps with the length side of the sheet board and the Y-axis overlaps with the width side of the sheet board. e small PCB piece is has a length (l) and a width (w) as well. X-axis: (1) X-axis algorithm procedure: Step 1: Establish the objective function C_X maximizing the number of PCB-Ps Step 2: Set constraints Step 3: Call the Linear Program Optimizer in Matlab2016 Step 4: According to x and y, call the rectangle() function to depict the layout of strips on sheet board Y-axis: Y-axis algorithm procedure: Step 1: Establish the objective function C_Y maximizing the number of PCB-Ps Step 2: Set constraints Step 3: Call the Linear Program Optimizer in Matlab2016 Step 4: According to x and y, call the rectangle() function to draw the layout of strips on sheet board At present, most commercial PCB packing software has embedded a simplex method. Since the simplex method only considers the best combination of strips packing horizontally or vertically, some potential optimal layouts may be missed out [8].

Dynamic Programming Method Based Model.
e dynamic programming model, which is based on two types of strips, is listed below: Dynamic programming algorithm performs in a divideand-conquer way. First, suppose the sheet board is divided into two layouts, with each one having two parts. e first part is a strip, and the other part is the remaining board (remains). As long as the remains are not satisfying formula (4), the remains of each layout will be further divided into two layouts, with each one having two parts. As the dividing process goes on, the layout acquiring procedure extends like an upside-down tree. rough comparing each tree leave, the layout with the most PCB-Ps emerges as the best scheme.
However, it is taken as the terminating condition the dynamic programming algorithm will go wrong when w≤ L ≤ l or w≤ W ≤ l. erefore, we rectify formula (4) as formula (5): e advantage of the dynamic recursive procedure is its simple dividing steps. But when the scale of problems increases, the amount of computation, memory usage, and time costs rise sharply as well.

Multi-Round Gradual Packing Methods
e strip-base simplex method and the recursive-based dynamic programming algorithm are 2 commonly applied heuristic algorithms for single-size PCB packing decisions. While in some cases, they are not guaranteeing optimal results. Assuming the sheet board is 3000 (mm) in length Mathematical Problems in Engineering and 1500 (mm) in width and the piece board is 406 (mm) in length and 229 (mm) in width, the best packing result is shown in Figure 2. While the best scheme given by using commercial software (Yuanbo), which heavily relies on the strip-based simplex method or the dynamic programming algorithm, is shown in Figure 3. In Figure 2, the nesting packing layout contains 48 pieces, which is better than the 47-piece scheme in Figure 3. Inspired by the simplex method, a two-dimensional packing problem is reduced to two one-dimensional packing problems based on L and W, respectively. All enumerated constraint-satisfying combinations (a i ,b i ) on L are denoted by CL. And all enumerated combinations (c j ,d j ) satisfying the constraints on W are denoted by CW. And is gained by doing the Cartesian product of CL and CW. en Msize and RECT are obtained afterwards.

Nesting Packing Layout.
In the nesting scheme shown in Figure 2, if the piece boards 1-12 and 13-24 are regarded as two new rectangular boards A and B, respectively, the nesting scheme will be of 4 rectangular, among which the lower-left corner and the upper-right corner are two identical rectangles, and the upper-left corner and the lowerright corner are two identical rectangles.
By observing Figure 2, it can be found that the length L and width W of the sheet board in the nesting scheme is almost fully utilized. And the best combinations of Strips on L and W are captured by an enumeration way. e best combination option on length L is 4 * l + 6 * w, and the best utilization mode on width W is 3 * , w + 2 * l. erefore, it can be considered to combine 4 × 3 l × w piece boards into one large rectangle and 6 × 2 w × l piece board into another large rectangle. When a nesting layout comes into being, there is no room for a single-piece board on the remains in the middle. e decisive factors of nesting packing layout are as follows: (1) Number constraint: only 2 different large rectangles are concerned (2) Length and Width constraints: 3.3. Nonnesting Packing Layout. If the necessary conditions for the nesting layout are not met, the nesting packing mode cannot form. us, there will be some exceptions occur as follows: In case 1, a b × d rectangle is packed on the sheet board as shown in Figure 4. Cases 2-4 are similar to case 1. In case 5, a vertical strip with a size of l × c * w and a horizontal strip with a size of b * w × l are put on the sheet board to generate 2 initial schemes as shown in Figures 5(a) and 6(b). Case 6 is similar to Case 5. In Cases 7 and 8, the rectangles with a size of b × d and a × c can be directly taken as possible candidate schemes, as shown in Figures 6 and 7.
If a, b, c, and d are all positive numbers and the nesting packing conditions are not met, Case 9 happens. In this case, there will be a big rectangle A and a small rectangle B. We first place A on the bottom-left corner of the sheet board. en we place one B above A, and another B to the right of A as shown in Figures 8(a) and 8(b).
Afterwards, according to Figure 8(a), we first establish a vertical strip, and then a horizontal strip is created, as shown in Figure 9(a). According to Figure 8(b), we first establish a horizontal strip, and then a vertical strip is created, as shown in Figure 9(b). en, the layouts in Figure 9 are two candidate schemes.
If the nesting packing layout is classified as Case 10, then each time we are searching for the best combinations on each side of the remains, one of those Cases will be matched. If the remaining sheet board is still very large, we need to continue the next round of packing procedure. (MGPM-DP). Dynamic programming algorithm is very suitable and feasible for solving problems in a multi-round or divide-and-conquer way. e aforementioned dynamic programming algorithm was based on strips. Since each strip has some wasted parts, the final results may not be optimal. Here, we combined a dynamic programming algorithm with MGPM to produce a novel algorithm, namely, MGPM-DP. Formula (7) describes the state transition equation.
MGPM-DP is a rectangular-block-based algorithm rather than a strip-based dynamic programming algorithm. Here, an array of STRUCT structures is taken to store temporary unfinished schemes and record parent nodes in the last round, the number of packed pieces in the current round, rectangular blocks, and possible child nodes appearing in the next round. e classical dynamic algorithm relies on a time-consuming recursion mechanism and tries to shorten the computational time at the cost of memory space. Here, since the number of temporary schemes generated in each round of MGPM is unable to determine, it is easy to cause memory overflow or time limit exceedance when all tree nodes are recursively traversed. erefore, we record clcws for all the previously dealt with remains to avoid subsequently repeated combination acquiring process. en the computational time of MGPM-DP may be further reduced.
Some elements in MGPM-DP are defined as follows: Plan: temporary schemes generated by RECT Rnum: ideal number of piece boards on the remains Num1: number of packed piece boards in the current round

Branch-and-Cut-Based MGPM (MGPM-BC).
Even if the dynamic programming algorithm has some advantages in the solution-seeking procedure, with the increase in problem scale, the whole procedure will be rather time-consuming. Hence, we combine MGPM with a branch-and-cut idea. First, all plans are generated according to decisive factor (2) of MGPM. en, a variable WastRate (formula (8)) is adopted to sort the plans in the current round. Next, remove the worst PruneRate% plans. Repeat the MGPM procedure until the best scheme is reached.
e flowchart of MGPM-BC is shown in Figure 11.

Computational Practices
In this part, the MGPM-DP, the MGPM-BC, the simplex method, and the strip-based dynamic programming algorithms are coded in MATLIB2016 on a desktop computer with a 16 G RAM, an Intel i5 2.4 G CPU, a 64-bit Windows 10 OS, and a 500 G HD. Here, PruneRate is 0.2.

Exploration of Computational Performances of 4
Algorithms. Here, 1200 pieces of data from an electronic manufacturing company in Pan'an Zhejiang province, China, are selected and merged into 6 data sets. Each data set has 200 pieces of data. e computational results are listed in Table 1. We adopted AN to represent an average number, AUR to denote average utilization rate, ACT to depict average computational time, and DS as the abbreviation of data sets. It can be clearly seen in Table 1 that the average utilization rate and the average number of piece boards achieved by MGPM-DP are superior to the other 3 algorithms. Simplex Method shows an overwhelming advantage in computational time. e performance of MGPM-BC is only a little bit inferior to that of MGPM-DP in terms of AUR an AN. As for ACT, MGPM-BC does display its superiority over MGPPM-DP. Although the average utilization rate of the strip-based dynamic programming algorithm is acceptable, the time consumption is substantial and not quite satisfactory. Figure 12 shows a statistics chart of 1200 pieces of data falling into different sections of utilization rates. From Figure 12, we can find out the superiority of MGPM-DP over the other 3 algorithms as well.

Size-Fixed Sheet Board with Nonfixed Piece Boards.
Here, we check the utilization rate distributions for 5 common sheet boards (1230 mm × 1030 mm, 1224 mm × 1104 mm, 1224 mm × 1054 mm, 1220 mm × 1100 mm, and 1220 mm × 1100 mm), aiming to look for ideal piece boards for each sheet board in that company. e 3D distribution charts for each sheet board are presented in Figures 13-17. According to Figures 13-17, we can learn that piece boards in each figure with convex peaks (utilization rates closest to 1) are ideal ones for that sheet board.

Size-Fixed Piece Board with Nonfixed Sheet Boards.
In the real production setting, enterprises sometimes randomly set some workplates. ey first pack piece boards on the workplates. en they try to find the best packing layout of workplates on the sheet board. Here

Comparison of MGPM-DP with Yuanbo Commercial
Packing Software. Currently, there are many commercial packing software applications widely run in circuit board manufacturing companies. Yuanbo Software, which is apparently superior to other commercial software, is used as a comparison benchmark here. 5 experiments are performed                to further clarify the performance of MGPM-DP as shown in Figures 23-27. erefore, according to Figures 23-27, MGPM-DP's performance is clearly better than that of Yuanbo Commercial Software.

Conclusion
In this paper, we reduce the two-dimensional PCB board packing problem into two one-dimensional problems focusing on the best combinations on two sides of a rectangle sheet board. en, we try to obtain the best solution by applying multiple rounds of nesting packing mode. Experimental results show that the average utilization rates of MGPM methods are closer to the theoretical optimal value than the simplex method and strip-based dynamic programming algorithm. In addition, it is of great significance for enterprises to select and set the sizes of workplates by carrying out research on size-fixed sheet boards and piece boards, respectively. Moreover, comparisons between the MGPM-DP and the Yuanbo commercial packing software further verify the advantages and feasibility of the MGPM. Our follow-up work will aim at developing circuit packing software eagerly needed by electronic enterprises engaging in the PCB manufacturing industry. Single-size cutting-stock problem(s) BBA: Branch-and-bound algorithm.