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.

1. 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 )) 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 efficiency [1]. Sometimes, a PCB-P is not rectangular. Enterprises normally capsule an irregular piece into a rectangle if this situation happens.

There are two types of rectangular PCB packing decisions here. One is single-size RP-PPP, and the other is multi-size 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. Therefore, 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. Therefore, 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. Therefore, 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-and-bound method are mainly and extensively adopted means for solving single-size cutting-stock problems (SCPs) [3].

The nesting idea runs through the cutting problem of one-dimensional tubular objects, the cutting problem of two-dimensional graphics, the packing problem of three-dimensional 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. The algorithm first constituted 2 strips based on the guillotine cut idea. Then 2-section, 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. This 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. This 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. This algorithm adopted the continuous fractions method to obtain the upper bound. Then 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. Thus, 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. Then, 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 [713] are all features of the dynamic programming algorithm as described in the literature [9]. The 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 ≤ L ≤ l or ≤ 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 [1416] are strip and stage-based methods. First, in stages, segments should be decided. Then, 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. This 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. Those 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. Therefore, 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-and-prune 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.

2. 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 simplex method-based model, and the other is the dynamic programming algorithm-based model. Both algorithms are based on strips [9].

2.1. Simplex Method Based Model

Suppose the rectangle sheet board is in a coordination system. The coordinate of the bottom-left corner point is (0, 0). The X-axis overlaps with the length side of the sheet board and the Y-axis overlaps with the width side of the sheet board. The small PCB piece is has a length (l) and a width () as well.


X-axis algorithm procedure:Step 1: Establish the objective function C_X maximizing the number of PCB-PsStep 2: Set constraintsStep 3: Call the Linear Program Optimizer in Matlab2016Step 4: According to x and y, call the rectangle() function to depict the layout of strips on sheet board


Y-axis algorithm procedure:Step 1: Establish the objective function C_Y maximizing the number of PCB-PsStep 2: Set constraintsStep 3: Call the Linear Program Optimizer in Matlab2016Step 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].

2.2. Dynamic Programming Method Based Model

The dynamic programming model, which is based on two types of strips, is listed below:

Dynamic programming algorithm performs in a divide-and-conquer way. First, suppose the sheet board is divided into two layouts, with each one having two parts. The 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. Through 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 ≤ L ≤ l or ≤ W ≤ l. Therefore, we rectify formula (4) as formula (5):

The 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.

3. Multi-Round Gradual Packing Methods

The 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 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.

3.1. Prerequisite Conditions

Before the introduction of our proposed methods, there are some variables need to be listed as follows:L: Length side of the sheet boardW: Width side of the sheet boardl: Length side of the small piece board: Width side of the small piece boarda: Number of type 4 strips (Figure 1(d)) on L;b: Number of type 3 strips (Figure 1(c)) on L;c: Number of type 1 strips (Figure 1(a)) on W;d: Number of type 2 strips (Figure 1(b)) on W;CL: Matrix composed of combinations on L satisfying certain constraints [a1,b1; a2,b2; a3,b3;...];CW: Matrix composed of combinations on W satisfying certain constraints [c1,d1; c2,d2;c3,d3;...];clcw: Row vector generated from a Cartesian product of CL × CW [a,b,c,d];Msize: Matrix composed of clcws [clcw1;clcw2;clcw3;...];RECT: Matrix composed of rectangle pairs from Msize [[a1l,c1 ],[b1w,d1l];[a2l,c2 ], [b2w,d2l];...];

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 (ai,bi) on L are denoted by CL. And all enumerated combinations (cj,dj) satisfying the constraints on W are denoted by CW. And clcwi=(ai,bi,ci,di) is gained by doing the Cartesian product of CL and CW. Then Msize and RECT are obtained afterwards.

3.2. 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 lower-right 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. The best combination option on length L is 4l + 6w, and the best utilization mode on width W is 3,  + 2l. Therefore, it can be considered to combine 4 × 3 l× piece boards into one large rectangle and 6 × 2 ×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.

The decisive factors of nesting packing layout are as follows:(1)Number constraint: only 2 different large rectangles are concerned(2)Length and Width constraints: L-w<(al+b )≤L and W-w<(c +dl)≤W and ((alb and c dl) or (alb and c dl))

3.3. Nonnesting Packing Layout

If the necessary conditions for the nesting layout are not met, the nesting packing mode cannot form. Thus, 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 and a horizontal strip with a size of 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. Then 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). Then, 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.

3.4. Dynamic Programming Algorithm Based MGPM (MGPM-DP)

Dynamic programming algorithm is very suitable and feasible for solving problems in a multi-round or divide-and-conquer way. The 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. The 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. Therefore, we record clcws for all the previously dealt with remains to avoid subsequently repeated combination acquiring process. Then the computational time of MGPM-DP may be further reduced.

Some elements in MGPM-DP are defined as follows:Plan: temporary schemes generated by RECTRnum: ideal number of piece boards on the remainsNum1: number of packed piece boards in the current roundNum: ideal total number of piece boards in the current scheme (Num = Num1+Rnum)Respace: size of the remains in the current schemePlancoll: set consists of schemes [Plan1; Plan2; Plan3; ...]Mem: array for information storage

The executive mechanism of MGPM-DP goes as follows:(1)Enumerate all possible combinations of (a,b) on L to produce CL(2)Enumerate all possible combinations of (c,d) on W to produce CW(3)perform Cartesian product of CL and CW to obtain clcws, Msize, and RECT(4)Traverse each Plani to obtain Numli, Respacei, and Rnumi(5)Judge if Respacei can be further packed(6)Recursively apply MGPM-DP to Respacei until all final schemes are captured(7)Output the best scheme as the final solution

The flowchart of MGPM-DP is shown in Figure 10.

3.5. 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. Then, 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.

The flowchart of MGPM-BC is shown in Figure 11.

4. 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.

4.1. 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. The 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. The 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.

4.2. 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. The 3D distribution charts for each sheet board are presented in Figures 1317. According to Figures 1317, we can learn that piece boards in each figure with convex peaks (utilization rates closest to 1) are ideal ones for that sheet board.

4.3. Size-Fixed Piece Board with Nonfixed Sheet Boards

In the real production setting, enterprises sometimes randomly set some workplates. They first pack piece boards on the workplates. Then they try to find the best packing layout of workplates on the sheet board. Here, 5 common piece board sizes (62.5 mm × 23 mm, 37 mm × 25 mm, 27 mm × 27 mm, 238.5 mm × 75 mm, 315 mm × 209.6 mm) are selected to explore the utilization rate distribution on sheet boards with L [1220 mm, 2060 mm] and W [1030 mm, 1230 mm]. The results are shown in Figures 1822.

4.4. 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 2327.

Therefore, according to Figures 2327, MGPM-DP’s performance is clearly better than that of Yuanbo Commercial Software.

5. 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. Then, 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.


The pseudo code of MGPM-DP is as follows:input Pnl,Picoutput planbegin function [plan = Splice( Pnl,Pic ) flag←IfSpell(Pnl,Pic) % Judge if the remains is packable If flag==false  return; % No space is available CL←CreatCL CW←CreatCW % Combinations generation Msize←CreatMsize(CL,CW) FindMem(clcw,Mem) % search existing packing layout for each clcw RECT←CreatRECT Plancoll = [] for each RECT  if % Case 10   Remains←Createspace   Plan←CreatNode   Splice (Remains,Pic )   Plancoll = [Plancoll;Plan];  if % Case 1   Remains←Createspace   Plan←CreatNode   Splice(Remains,Pic )   Plancoll = [Plancoll;Plan] ....  end end Plan←ChooseBestPlan(Plancoll) % Update Plans Mem←InsertMem(clcw,Plan) % Record related dataend

The pseudo code of MGPM-BC is as follows:input Pnl,Picoutput planbegin function [plan] = Splice( Pnl,Pic ) flag←IfSpell(Pnl,Pic) If flag == false  return; CL←CreatCL, CW←CreatCW, RECT←CreatRECT, Plancoll = [] for each RECT  if % Case 10   Remains←CreateSpace   WasteRate←CreateWasteRate   Plan←CreatNode   Plancoll←[plancoll;plan];  if % Case 1   Remains←CreateSpace   WasteRate←CreateWasteRate   Plan←CreatNode   Plancoll←[Plancoll;Plan];  ....  end  plancoll←PruneNodes(plancoll) % Cut branches according to WasteRate for each plancoll  ChildPlan←Splice(Remains,Pic ) % Remaining schemes enter into the next round end Plan←ChooseBestPlan(plancoll) % Output the best schemeend


PCB:Printed circuit board
PCB-P(s):PCB pieces
MGPM(s):Multi-round gradual packing method(s)
MGPM-DP:Depth priority-based MGPM
MGPM-BC:Breadth priority-based branch-and-prune MGPM
RP-PPP(s):Rectangular PCB pieces packing problem(s)
SCP(s):Single-size cutting-stock problem(s)
BBA:Branch-and-bound algorithm.

Data Availability

All the data are available by contacting the corresponding author through email: [email protected].

Ethical Approval


Conflicts of Interest

The authors declare that they have no conflicts of interest.

Authors’ Contributions

PFP coded the MGPM algorithms in this paper. YH is responsible for writing this paper. The GYD and HXL summarized the literature. ZYJ coded Simplex Method and dynamic programming algorithm.


The authors are grateful to all the anonymous reviewers for their suggestions and comments. Talent Project of Zhejiang Shuren University (KXJ1420601).