Today, resource waste is considered as one of the most important challenges in different industries. In this regard, the Rectangle Packing Problem (RPP) can affect noticeably both time and design issues in businesses. In this study, the main objective is to create a set of non-overlapping rectangles so that they have specific dimensions within a rectangular plate with a specified width and an unlimited height. The ensued challenge is an NP-complete problem. NP-complete problem, any of a class of computational problems that still there are no efficient solution for them. Most substantial computer-science problems such as the traveling salesman problem, satisfiability problems (sometimes called propositional satisfiability problem and abbreviated SAT or B-SAT), and graph-covering problems are belong to this class. Essentially, it is complicated to spot the best arrangement with the highest rate of resource utilization by emphasizing the linear computation time. This study introduces a time-efficient and exploratory algorithm for the RPP, including the lowest front-line strategy and a Best-Fit algorithm. The obtained results confirmed that the proposed algorithm can lead to a good performance with simplicity and time efficiency. Our evaluation shows that the proposed model with utilization rate about 94.37% outperforms others with 87.75%, 50.54%, and 87.17% utilization rate, respectively. Consequently, the proposed method is capable to of achieving much better utilization rate in comparison with other mentioned algorithms in just 0.023 s running-time, which is much faster than others.

Decreasing wasting of resources affecting industries and businesses can be very advantageous [

In the RPP, there exists a set of rectangles with specific dimensions, and the aim is to arrange these rectangles in a rectangular page with a fixed width and an unlimited height without overlapping, provided that the packing is orthogonal [

In addition to waste reduction, increasing the utilization rate is one of the fundamental challenges in the industry. The utilization rate equals the sum of the area of the input rectangles (

In this equation, _{i}) and (_{i}) are the width and height of the replaced rectangles, respectively, and m is the number of these rectangles [

In the past decades, various related algorithms have been presented due to its crucial role and importance in the widespread applications. Despite a wide range of the RPP applications, the efficient implementation is still a complicated task. The most fundamental challenge is that we should solve an NP-complete set problem [

The rest of this article is organized as follows. In the second section, the related works about the rectangle packing context were discussed. In the third section, the methodology with the proposed algorithm was presented in full detail. In the fourth section, achieved results were presented, and ultimately the fifth section dealt with the conclusion.

To solve the RPP, one of the most favorite algorithms that has attracted many researchers is the Best-Fit algorithm. It is a multi-layered algorithm in which the layers are created gradually as the rectangles are inserted. The rectangle places into the higher level, if it cannot be placed in a layer. In conclusion, the rectangle will always be located in a layer that has less waste after insertion [

Hu et al. [

Liu et al. [

Huang et al. [

Chazelle [

Liu et al. [

In this section, at first, two algorithms including the Best-Fit decreasing height algorithm and the lowest front-line strategy are introduced. Then, the researchers present the proposed model in this research in its details.

An acceptable paper size is US Letter (

The lowest front-line strategy is designed based on the BL algorithm and is defined as follows [

The first step: The algorithm starts with the initial quantification of the front line. In the beginning, the front lines set contained only one line, and that is the horizontal line at the bottom of the page.

The second step: Locating the rectangle in a place using the lowest front-line strategy. _{i} is the position where the

The third step: In this step, the front line will be updated. Some of the old lines will be converted to new lines, and new lines will be added to the front line set. As the points mentioned in the second step, the adjacent lines with equal height must be merged to form a single line.

The fourth step: If all rectangles are placed, the algorithm ends, otherwise a new rectangle will be selected, and the process will continue to the second step.

_{1} will be selected for {_{1}_{5}}, and after that, the front line will be {_{1}_{2}, _{2}_{5}}. In the same way, _{2} will be selected for {_{2}_{5}}, and after the placement, the front line will be {_{1}_{2}, _{1}_{3}, _{3}_{5}}. Similarly, after placing the _{3} rectangle in {_{3}_{5}}, the front line will be {_{1}_{2}, _{1}_{3}, _{1}_{2}, _{4}_{5}}. In this point, the lowest line is {_{4}_{5}}, and it does not have enough space to place _{4}. So, the height of {_{4}_{5}} was increased until it reaches {_{1}_{3}}, the second-lowest front line. Finally, the {_{1}_{3}} line will be selected to place the _{4} rectangle, and the front line is {_{1}_{2}, _{1}_{2}, _{2}_{3}, _{1}_{2}, _{4}_{5}} at the end [

The lowest front-line strategy does not sort the input rectangles before placing them. Actually, this is a challenge for this algorithm. It increases page height and decreases the utilization rate. This algorithm always tries to find the lowest and the leftmost point possible to place the rectangles. The way the height increases in this algorithm is its positive point.

In the Best-Fit decreasing height algorithm, the rectangles are first sorted in decreasing order. Then, the biggest rectangle will be placed at the bottom-left corner, and the first layer will be created. To place the next rectangles, if the rectangles could not be placed in the created spaces of the created layer, we create a layer above the highest layer and place the rectangle in it. If there are several layers with enough space to place the rectangles, a layer will be selected with less waste after the rectangle placement [

The Best-Fit decreasing height algorithm is layered well, and it is suitable for non-guillotine cut issues. Finding the best position with the lowest waste is waste is a noticeable advantage of this algorithm. Also, due to sorting the inputs, this algorithm has a better utilization rate compared to the Best-Fit algorithm without sorting. In this algorithm, we cannot place a rectangle between two layers, and this causes wasting. Therefore, we can place the rectangle between the layers in the proposed algorithm.

This study presents an algorithm with the properties of both Best-Fit decreasing height algorithm and the lowest front-line strategy. This algorithm, similar to the Best-Fit method, always tries to find the best position for the rectangle. However, this algorithm aims to decrease the total height by increasing the height of the layers, inspired by the lowest front-line strategy.

The steps of the proposed algorithm are as follows:

The first step: At first, the algorithm starts with initial quantification. The height of this page is zero initially, and its final value is specified at the end of the algorithm. In this algorithm, there exist a set of lines called the front line for saving empty spaces. In the beginning, the front line is the bottom borderline of the page. The information of the input rectangles such as width, height, and the number of each one will be received at this stage of the algorithm.

In this algorithm, an array was used to reserve empty spaces. The first row of this front-line array is the starting point of the line, the second row of the front-line shows the endpoint of the line, the third row of the front-line array represents the distance of this line from the lowest front line, which is the bottom borderline of the page, and the fourth row of the front-line array shows the height of the next front-line after this line. With these four points, we can imagine a rectangle. If the value of the fifth row of the front-line array is 1, it means that this line is not occupied, and when a rectangle is placed, this value will become −1. The fifth row of the array is added to adhere to the not-overlapping assumption. When placing rectangles into a line using the fifth row of the front-line array, it will be checked whether it is full or empty.

The second step: In this step of the algorithm, the rectangles with more height than width will be rotated 90 degrees. It means that the height and the width will be replaced.

The third step: In this step, the rectangles will be sorted in decreasing height size order.

The fourth step: A rectangle will be selected from the beginning of the inputs list, and then, we search among the front-lines set for a place with enough space for the rectangle. Then, among the selected lines, we choose a line that has less waste. At this point, there are three modes:

If a line is found among the front-lines set with sufficient width and height for placing the rectangle, we select it; and if there are several lines for placing, we choose the one that wastes less space.

If we cannot find a line with the required height and width, we start searching among the longest front-lines for a line that has the required width for placing the rectangle. Also, if there are several lines, we choose the one that has less width and increases the height of the page lesser.

If we cannot find a position to place the rectangle in the two predicted modes mentioned above; and if we did not find any line that has enough space for placing the rectangle, then we create a new layer above the longest front-line and place the rectangle in the bottom-left of the created layer and increase the height of the page.

The fifth step: In this step, we update the front-line and empty spaces, and convert some of the old lines into new lines and also add new lines. In addition, we must identify all of the empty spaces. Then, we try to identify all of the empty houses that have common borders. In order to make the most of the wasted space available, if one or more than two houses have common borders, it must be merged with the house that creates larger free space after merging compared to other houses. This step plays an essential role in reducing waste.

The sixth step: In this step, we check the ending of the algorithm. If there is not a rectangle in the input list to place, the algorithm ends. Otherwise, we go to the beginning of the fifth step and continue the algorithm again. In the end, we calculate the utilization rate of the algorithm.

In this study, the MATLAB programming language was used in a PC with Intel(R) Core(TM) i7 and 12 GB internal storage. The data was deployed using the Liu algorithm [

Number | 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|

Width | 25 | 18 | 79 | 121 | 29 | 64 | 48 | 11 | 46 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 10 | 50 |

Height | 36 | 24 | 84 | 30 | 48 | 98 | 59 | 17 | 121 | 22 | 41 | 72 | 25 | 65 | 24 | 11 | 36 | 30 | 61 |

Quality | 4 | 5 | 3 | 4 | 11 | 2 | 3 | 2 | 2 | 1 | 2 | 2 | 2 | 2 | 3 | 2 | 2 | 3 | 2 |

Algorithm | The proposed | Liu | Front line | Best-Fit |
---|---|---|---|---|

Utilization | 94.37% | 87.75% | 50.54% | 87.17% |

Run time(s) | 0.023 | 26.3 | 0.042 | 0.031 |

In this section, we analyze the effects of the sorting and rotation on the utilization rate. Sorting the input rectangles has a significant impact on the utilization rate. We sorted the input rectangles in descending order of height, width, and area of the rectangles, and then we ran the algorithm. The results of running the algorithm show that sorting in descending order of height has better results.

Sort type | None | Width | Area | Height |
---|---|---|---|---|

Utilization rate | 69.25% | 72.22% | 87.89% | 94.37% |

Runtime(s) | 0.30 | 0.036 | 0.036 | 0.023 |

The rotation step was removed to run the algorithm again. Then, the new results were compared with the algorithm while considering the rotation. The results showed that the rotation has a positive effect on the utilization rate.

Impact of step | Run-time(s) | Utilization rate | Deleted step |
---|---|---|---|

14.75% | 0.032 | 82.24% | |

36.27% | 0.030 | 69.25% |

Comparing the algorithm with low-volume data and also, in some cases, comparing the algorithm with high-similarity data, is one of the challenges of the presented algorithms. Practically, there are various data with different sizes in the industry. Therefore, in this section, the proposed algorithm, the lowest front-line strategy, and the Best-Fit algorithm were analyzed by producing random data. The obtained results show that the utilization rate of the proposed algorithm is better than the other two algorithms. In addition, it has a shorter running time.

Run-time(s) | Utilization rate | Amount of front-line in the proposed algorithm | Amount of rectangles | N | ||||
---|---|---|---|---|---|---|---|---|

The proposed algorithm | Best-Fit | Front line | The proposed algorithm | Best-Fit Front line | ||||

0.061439 | 0.113711 | 0.135782 | 0.9680 | 0.9044 | 0.8213 | 142 | 283 | 50 |

0.179677 | 0.268977 | 0.365532 | 0.9759 | 0.9261 | 0.8076 | 294 | 560 | 100 |

0.268492 | 0.679887 | 0.940690 | 0.9722 | 0.9212 | 0.8018 | 379 | 808 | 150 |

0.561501 | 1.371588 | 1.670308 | 0.9720 | 0.9088 | 0.7620 | 498 | 1102 | 200 |

0.784825 | 1.683756 | 3.098013 | 0.9720 | 0.9355 | 0.7979 | 616 | 1444 | 250 |

1.136259 | 2.152571 | 3.692223 | 0.9735 | 0.9459 | 0.7850 | 672 | 1684 | 300 |

1.687331 | 3.185944 | 5.856734 | 0.9718 | 0.9281 | 0.8020 | 747 | 1972 | 350 |

1.792151 | 4.626413 | 6.491700 | 0.9737 | 0.9384 | 0.7742 | 836 | 2117 | 400 |

2.338938 | 6.179962 | 8.555913 | 0.9682 | 0.9335 | 0.7860 | 924 | 2380 | 450 |

2.532763 | 7.593715 | 12.461293 | 0.9705 | 0.9581 | 0.7893 | 1026 | 2738 | 500 |

2.609368 | 8.936252 | 16.055307 | 0.9695 | 0.9454 | 0.7790 | 1100 | 3012 | 550 |

3.789860 | 7.678264 | 17.209783 | 0.9737 | 0.9408 | 0.7863 | 1126 | 3260 | 600 |

3.503998 | 12.119956 | 21.050525 | 0.9750 | 0.9314 | 0.8077 | 1235 | 3497 | 650 |

5.143389 | 14.592887 | 27.870559 | 0.9710 | 0.9426 | 0.8253 | 1328 | 3955 | 700 |

5.692376 | 16.248161 | 30.576511 | 0.9693 | 0.9485 | 0.7703 | 1348 | 4110 | 750 |

6.548756 | 20.146549 | 38.626904 | 0.9768 | 0.9537 | 0.7935 | 1448 | 4534 | 800 |

5.552323 | 20.865130 | 41.414833 | 0.9673 | 0.9508 | 0.7987 | 1464 | 4592 | 850 |

7.132780 | 22.115729 | 48.515116 | 0.9740 | 0.9447 | 0.7807 | 1503 | 4819 | 900 |

8.174483 | 26.831960 | 57.326876 | 0.9691 | 0.9548 | 0.7943 | 1501 | 5244 | 950 |

9.152594 | 23.973368 | 65.242514 | 0.9678 | 0.9425 | 0.7896 | 1744 | 5763 | 1000 |

10.860228 | 34.939327 | 78.368714 | 0.9655 | 0.9531 | 0.7831 | 1644 | 6055 | 1100 |

9.508915 | 40.207071 | 99.702676 | 0.9675 | 0.9550 | 0.7966 | 1730 | 6615 | 1200 |

14.972989 | 46.728704 | 113.762547 | 0.9657 | 0.9625 | 0.7896 | 1909 | 7044 | 1300 |

16.997029 | 26.938338 | 411.017108 | 0.9708 | 0.9479 | 0.7981 | 1984 | 7671 | 1400 |

18.103096 | 28.565729 | 478.56225 | 0.9695 | 0.9673 | 0.8027 | 2008 | 8164 | 1500 |

21.743997 | 33.262568 | 598.293248 | 0.9681 | 0.9603 | 0.7964 | 2194 | 8796 | 1600 |

24.726140 | 38.004280 | 723.358521 | 0.9715 | 0.9596 | 0.7852 | 2232 | 9415 | 1700 |

25.643730 | 42.053160 | 786.529926 | 0.9706 | 0.9625 | 0.8030 | 2383 | 9853 | 1800 |

24.416149 | 45.981673 | 971.096964 | 0.9749 | 0.9517 | 0.7884 | 2750 | 10555 | 1900 |

31.034617 | 50.574680 | 1128.696616 | 0.9659 | 0.9603 | 0.7944 | 2623 | 11030 | 2000 |

The proposed method has the polynomial-time complexity. As a result, it needs maximum O(m) time for searching between m front-lines and finding the proper line to place the rectangle. This task must be done for all of the rectangles, and the total number of rectangles is n. Therefore, the time complexity of this algorithm is generally linear in time order and equals O(nm). The results of the implementation indicate that the value of m is always less than n. It means that at the end, the total number of the front-lines is always less than the total number of the rectangles. In

In this study, an efficient algorithm was presented for the Rectangle Packing Problem (RPP). RPP struggles to insert a set of non-overlapped rectangles (with specific features) in a rectangular space (with a constant width and an unlimited height), providing that the packing is orthogonal. To this end, we have implemented the proposed algorithm along with the Best-Fit decreasing height and the lowest front-line strategy. Our evaluation shows that the proposed model with utilization rate about 94.37% outperforms others with 87.75%, 50.54%, and 87.17% utilization rate, respectively. Consequently, the proposed method is capable to of achieving much better utilization rate in comparison with other mentioned algorithms in just 0.023 s running-time, which is much faster than others.

The proposed method has the polynomial-time complexity. It is generally linear in time order and equals

This problem is NP-complete and has numerous local extremum points. Consequently, it is possible that the presented algorithm cannot find some global extrema. Therefore, we can use this algorithm along with GA or unsupervised learning models [