Two-dimensional strip block boxing method based on cluster search
Optimizing two-dimensional strip boxing through the cluster search algorithm and greedy loading method solves the problem that container width is difficult to further reduce in the prior art, improves the utilization rate of raw materials, and reduces material waste.
Patent Information
- Application Number
- CN202510079932.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-18
- Publication Date
- 2025-08-01
AI Technical Summary
The existing two-dimensional strip packing method still has room for improvement in reducing the width of the container, resulting in insufficient utilization of raw materials, especially in the process of plate cutting and fabric cutting.
The cluster search algorithm is used to splice the rectangular boxes into blocks in pairs, and the loading order of the container is optimized through the cluster search algorithm, and multiple container widths are generated to reduce the final container width. Combined with greedy loading and quick loading methods, the box placement strategy is optimized.
It effectively reduces container width, improves the utilization rate of raw materials, and reduces production costs, especially in the process of sheet cutting and fabric cutting, which reduces material waste.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of two-dimensional strip-packing problems (2DSP: two-dimensional strip-packing), and particularly relates to a two-dimensional strip block packing method based on beam search. Background Art
[0002] Problem description: Given a rectangular container with a fixed length and infinite width and some rectangular boxes, the goal of the problem is to place these rectangular boxes into the rectangular container and make the width of the occupied rectangular container as short as possible.
[0003] This problem is mainly applied to the cutting of plates and the cutting of fabrics. For example, in industries such as metal processing, wood processing, and glass processing, it is necessary to cut out various small parts with different shapes and sizes from large raw material plates (such as steel plates, wood plates, and glass plates). The two-dimensional strip-packing problem can help optimize the cutting plan to improve the utilization rate of raw materials and reduce waste. For example, in furniture manufacturing, it is necessary to cut out different-shaped table tops, chair legs, etc. from standard-sized wood plates. Through an effective two-dimensional strip packing algorithm, the best cutting order and layout can be determined, thereby reducing production costs. In the garment manufacturing industry, cutting garment pieces from large pieces of fabric is an important link in the production process. The two-dimensional strip packing technology can reasonably arrange the cutting layout according to the garment style and the shape and size of the garment pieces to maximize the utilization rate of the fabric. For example, for mass-produced shirts, multiple pieces such as front pieces, back pieces, and cuffs need to be cut from a whole roll of fabric. Through an optimized two-dimensional strip packing plan, the corner waste of the fabric can be reduced.
[0004] Existing technologies: Currently, the algorithms used to solve this problem are mainly divided into exact algorithms, heuristic algorithms, and deep learning algorithms. The exact algorithm [5] can obtain the optimal solution for loading, but for problems with a large number of boxes and large container sizes, it is difficult for this type of algorithm to give a loading plan within a reasonable time range. The heuristic algorithms [1, 2, 3, 4] search for a better loading plan in the solution space through tree search or search algorithms such as simulated annealing and genetic algorithms. This type of algorithm can give a better solution within a reasonable time range and is the current mainstream method. With the development of deep learning, there are currently many studies [6] using methods such as reinforcement learning to train loading models to solve this type of problem. A two-dimensional strip block packing method based on beam search of the present invention belongs to the heuristic algorithm.
[0005] Existing problems: Nowadays, many two-dimensional strip-packing methods based on heuristic algorithms have achieved good loading effects, but there is still room for improvement. The width of the used container can be further reduced, thereby reducing waste of raw materials in the industrial cutting process and improving the utilization rate of raw materials.
[0006] References: [1] Zhang H, Yao S, Zhang S, et al. A block-based heuristic search algorithm for the two-dimensional guillotine strip packing problem[J]. Engineering Applications of Artificial Intelligence, 2024, 134: 108624. [2] Bortfeldt A, Jungmann S. A tree search algorithm for solving the multi-dimensional strip packing problem with guillotine cutting constraint[J]. Annals of Operations Research, 2012, 196: 53-71. [3] Cui Y, Yang L, Chen Q. Heuristic for the rectangular strip packing problem with rotation of items[J]. Computers&Operations Research, 2013, 40(4): 1094-1099. [4] Wei L, Tian T, Zhu W, et al. A block-based layer building approach for the 2D guillotine strip packing problem[J]. European Journal of Operational Research, 2014, 239(1): 58-69. [5] Côté J F, Dell'Amico M, Iori M. Combinatorial Benders' cuts for the strip packing problem[J]. Operations Research, 2014, 62(3): 643-661. [6]Neuenfeldt Júnior A, Siluk J, Francescatto M, et al. A framework to select heuristics for the rectangular two-dimensional strip packing problem[J]. 2023. Summary of the invention
[0007] Overview of the packing method involved in the present invention: First step, splice two rectangular boxes together, and the large rectangular box after splicing is simply called a block. Second step, first generate a new rectangular container with a length equal to the length of the original rectangular container and a width equal to the total area of all rectangular boxes divided by the length of the original container, and then use the blocks generated in the first step to fill the new rectangular container based on the beam search algorithm. Third step, if all the boxes in the best filling result in the second step are placed in the new rectangular container, then return the filling result; otherwise, generate a new container identical to the original container, and then use the remaining boxes in the second step to fill the new container based on the beam search algorithm. Add the width occupied by the container after filling to the width occupied by the container in the second step, and the obtained width is called the larger width. The width of the new rectangular container in the second step is called the minimum width. Generate multiple widths between the minimum width and the larger width with a step size of 1. These widths do not include the minimum width but include the larger width. Then, use the length of the original rectangular container as the length and these widths as the widths to produce new rectangular containers respectively. Finally, use the blocks generated in the first step to fill these new containers based on the beam search algorithm, and return the best filling result after the beam search ends. See the flowchart in Figure 5 。
[0008] First step: Splice the rectangular boxes of the same size in the length and width directions to splice out all possible rectangular boxes, simply called blocks. A single rectangular box also counts as a block. See Figure 1 。Put all the spliced blocks into the blockList, and make a copy and put it into the pList. Let the maximum number of blocks allowed to be generated be MaxBlocks. If the number of blocks in the blockList is less than MaxBlocks, then repeat the following steps: Generate an empty list newBlockList, and sequentially take each block block in the pList i and splice it with each block block in the blockList j The splicing method is that if the widths of block i and block j are the same, then splice these two blocks in the length direction. If blocki If it is the same length as block j , then splice these two blocks in the width direction. Do not splice except for the above two cases. Put the spliced block into newBlockList. If there is no block in newBlockList, end the repetition. Otherwise, put the blocks in newBlockList into blockList, and the number of blocks in blockList cannot be greater than MaxBlocks. Then replace the blocks in pList with the blocks in newBlockList, and then return to the beginning of the repetition.
[0009] Step 2: Let the length of the original container be length, and the sum of the areas of all rectangular boxes be area. Then set the length of the new container to be equal to length, and the width to be equal to area / length. Set an initial state, which includes the remaining space of the new container, blockList, and the remaining boxes not yet loaded. Initially, the remaining space of this state is the entire container space, blockList is the blockList generated in the first step, and the remaining boxes not yet loaded are all the boxes to be loaded. When beam search is performed for the first time, the number of successor nodes expanded by each node (state) is w = 1, and in each subsequent new search round, w is expanded to . The way of node expansion is as follows: Use the space selection method to select a space from the remaining space, use the block selection method to select w blocks from blockList, take out one block from the w blocks each time and put it into the space, then delete the space from the remaining space, put the generated new space into the remaining space, see Figure 2 , delete the boxes contained in the block from the remaining boxes not yet loaded, and delete the blocks that cannot be spliced with the remaining boxes not yet loaded from blockList. The resulting remaining space, blockList, and remaining boxes not yet loaded constitute a new state node (if no block is selected by the block selection method, no new state is generated). For each state state i among the newly generated w states, we use the greedy loading method to load it until there is no available remaining space. Then use the loading area after the loading ends as the score of this state, and then select the state with the largest score from the w states as the node to be expanded next. When the search time limit is reached, end the beam search. The pseudocode for Step 2 is shown in Figure 3 .
[0010] For the space selection method in Step 2: Assume that each space in the remaining space has a score, and this score is equal to the sum of the coordinate x and coordinate y at the lower left corner of the space. The space selection method selects the space with the largest score.
[0011] For the block selection method in the second step: First, select all the blocks from the blockList that can fit into the space according to their sizes (if the number of selected blocks is 0, there are no blocks that can fit into the space). Then, calculate a score for each of these blocks. Finally, select the top w blocks in descending order of the scores. The way to calculate the score is as follows: First, obtain the average width agHigh of all the boxes except the boxes contained in the block from the remaining unboxed boxes. Let the area of the block be blockArea, the area of the space be spaceArea, parameter a = 1.1, and parameter b = 1.0. Then the score of the block is equal to a * (blockArea / spaceArea) + b * agHigh.
[0012] For the greedy loading method in the second step: First, generate a copy of the state state i and perform loading with this copy. If there is still remaining space in this copy, keep repeating: Use the space selection method to select a space, use the block selection method to select a block. If a block is selected, put the block into the space, remove the space from the remaining spaces, put the newly generated space into the remaining spaces, remove the boxes contained in the block from the remaining unboxed boxes, and remove the blocks that cannot be assembled from the remaining unboxed boxes from the blockList. If no block is selected, remove the selected space from the remaining spaces. After the loop ends, if the loaded area of the copy is greater than the area of the best loaded solution found so far, update the best loaded solution to the loaded solution of this copy. Finally, return the loaded area of the copy as the score of state i . The pseudocode is shown in Figure 4 .
[0013] Step 3: If all the boxes are loaded in the best loading scheme in Step 2, then take this scheme as the final result and end. Otherwise, generate a new container with a length equal to length and an infinite width. Use the fast loading search based on beam search to load the remaining boxes into this container. Add the occupied width of the container with the best loading scheme obtained from the fast loading search to the occupied width of the container with the best loading scheme in Step 2. Denote the obtained width as fastHigh, which is called the larger width. Denote the width of the new rectangular container in Step 2 (area / length) as the minimum width, denoted as minHigh. Generate a width set between (minHigh, fastHigh] with a step size of 1. For each width in the set, use length as the length to generate fastHigh - minhigh new containers. Use the blocks generated in Step 1 and a search process similar to that in Step 2 to search each of the fastHigh - minhigh containers respectively. The difference between the search process in this step and the search process described in Step 2 is only the greedy loading method. After all the containers are searched, select the best one from the best loading results of all the containers as the final result.
[0014] For the fast loading search in Step 3: First, generate an initial state, which includes the remaining space of the new container and the remaining unloaded boxes. The remaining space is the entire container space, and the remaining unloaded boxes are the boxes that were not loaded into the container in the best loading scheme in Step 2. Then use beam search for loading. When beam search is first performed, the number of successor nodes expanded for each node (state) is w = 1. In each subsequent new search round, expand w to . The way to expand nodes is as follows: Use the space selection method to select a space from the remaining space, and use the box selection method to select w boxes from the remaining unloaded boxes. Take out one box from the w boxes each time and put it into the space, then delete the space from the remaining space, put the newly generated space into the remaining space, and delete the box from the remaining unloaded boxes. The resulting remaining space and remaining unloaded boxes form a new state node. For each of the w newly generated states state j , we use the greedy loading method to load it until there is no available remaining space. After that, use the loading width after loading as the score of this state, and then select the state with the largest score from the w states as the node to be expanded next. When w is greater than 2, end the beam search.
[0015] For the space selection method in the fast loading search: Select the space with the smallest y - coordinate at the lower - left corner of the remaining space. If there are multiple such spaces, then select the space with the smallest x - coordinate value among them.
[0016] For the box selection method in quick loading search: First, select all the boxes from the remaining unloaded boxes that can fit into the space according to their sizes (if the number of selected boxes is 0, there are no boxes that can fit into the space). Then, select the top w boxes in descending order of their widths from these boxes.
[0017] For the greedy loading method in quick loading search: First, generate a copy of the state state j and perform loading with this copy. If there is still remaining space in this copy or there are still remaining unloaded boxes in the copy, keep repeating: If there is no remaining space in the copy and there are still remaining unloaded boxes, obtain the width of the container occupied by the boxes in the current state, denoted as y, generate a space with length length, infinite width, and the lower left corner coordinate (0, y), and put the space into the remaining space. Use the space selection method in the quick loading method to select a space, use the box selection method in the quick loading method to select a box. If a box is selected, put the box into the space, delete the space from the remaining space, put the newly generated space into the remaining space, and delete the box from the remaining unloaded boxes. If no box is selected, delete the selected space from the remaining space. After the loop ends, if the loading width of the copy is less than the width of the best loading scheme found so far, update the best loading scheme to the loading scheme of this copy. Finally, return the loading width of the copy as the score of state j of.
[0018] For the greedy loading method in the third step: First, generate a copy of the state state k and perform loading with this copy. If there is still remaining space in this copy, keep repeating: Use the space selection method to select a space, use the block selection method to select a block. If a block is selected, put the block into the space, delete the space from the remaining space, put the newly generated space into the remaining space, delete the boxes contained in the block from the remaining unloaded boxes, and delete the blocks that cannot be assembled from the remaining unloaded boxes from the blockList. If no block is selected, delete the selected space from the remaining space. After the loop ends, if all the boxes in the copy are loaded into the container and the loading width of the copy is less than the width of the best loading scheme found so far, update the best loading scheme to the loading scheme of this copy. Otherwise, use the quick loading search to continue loading the boxes that have not been loaded into the container, and then merge the best loading result of the quick loading search with the result of the copy as the complete result. If the loading width of the complete result is less than the width of the best loading scheme found so far, update the best loading scheme to the complete result. Finally, take the loading area of the copy as the score of state k of.
[0019] Effect comparison: Comparison results with existing relatively new technologies when the box does not rotate on datasets C, N, NT-N, NT-T, and KR. The data is the gap, and the calculation method is detailed in [1].
[0020] Set SPTRS[2] IBRL[3] BBHSA[1] Our C 1.80 1.24 1.11 1.51 N 1.16 0.29 0.23 0.73 NT-N 4.66 4.61 4.59 2.71 NT-T 5.31 5.36 4.67 2.81 KR 3.39 3.25 4.12 2.74 Description of the Drawings Figure 1 : Diagram of block splicing. Figure 2 : Diagram of the remaining space. Figure 3 : Diagram of the pseudocode for Step 2. Figure 4 : Diagram of the pseudocode for the greedy loading method. Figure 5 : Flowchart of the method.
Claims
1. A two-dimensional strip block packing method based on beam search, characterized in that: Step 1: Assemble cuboid boxes of the same size in the length and width directions to assemble all possible cuboid boxes, simply referred to as blocks. A single cuboid box also counts as a block. Put all the assembled blocks into the blockList, and make a copy and put it into the pList. Let the maximum number of blocks allowed to be generated be MaxBlocks. If the number of blocks in the blockList is less than MaxBlocks, repeat the following steps: Generate an empty list newBlockList, and sequentially take each block block in the pList i and assemble it with each block block in the blockList j . The assembly method is that if the widths of block i and block j are the same, then assemble these two blocks in the length direction; if the lengths of block i and block j are the same, then assemble these two blocks in the width direction; do not assemble in other cases. Put the assembled blocks into the newBlockList. If there are no blocks in the newBlockList, end the repetition; otherwise, put the blocks in the newBlockList into the blockList, and the number of blocks in the blockList cannot be greater than MaxBlocks. Then replace the blocks in the pList with the blocks in the newBlockList, and then return to the beginning of the repetition. Step 2: Let the length of the original container be length, and the sum of the areas of all rectangular boxes be area. Then let the length of the new container be equal to length, and the width be equal to area / length. Set an initial state, which includes the remaining space of the new container, the blockList, and the remaining unloaded boxes. Initially, the remaining space of this state is the entire container space, the blockList is the blockList generated in the first step, and the remaining unloaded boxes are all the boxes to be loaded. When the beam search first searches, the number of successor nodes expanded by each node (state) is w = 1, and in each subsequent new search round, w is expanded to ; The way of node expansion is as follows: Use the space selection method to select a space from the remaining spaces, use the block selection method to select w blocks from the blockList. Each time, take out one block from the w blocks and put it into the space, then delete the space from the remaining spaces, put the newly generated space into the remaining spaces, delete the boxes contained in the block from the remaining unpacked boxes, and delete the blocks that cannot be assembled from the remaining unpacked boxes from the blockList. The resulting remaining spaces, blockList, and remaining unpacked boxes constitute a new state node (if the block selection method does not select any blocks, no new state is generated); For each state state in the newly generated w states i , we use the greedy packing method to pack it until there is no available remaining space. After that, use the packing area after packing as the score of this state, and then select the one with the largest score from the w states as the node to be expanded next; When the search time limit is reached, end the beam search; For the space selection method in the second step: Assume that each space in the remaining spaces has a score, and this score is equal to the sum of the coordinate x and coordinate y of the lower left corner of the space; The space selection method selects the space with the largest score; For the block selection method in the second step: First, select all the blocks from the blockList that can be put into the space according to their sizes (if the number of selected blocks is 0, there are no blocks that can be put into the space), then calculate a score for each of these blocks, and finally select the top w blocks in descending order of scores; The way to calculate the score is as follows: First, obtain the average width agHigh of all the boxes except the boxes contained in the block from the remaining unpacked boxes; Assume the area of the block is blockArea, the area of the space is spaceArea, the parameter a = 1.1, and the parameter b = 1.0, then the score of the block is equal to a * (blockArea / spaceArea) + b * agHigh; For the greedy packing method in the second step: First, generate a copy of the state state i and use this copy for packing; If there is still remaining space in this copy, keep repeating: Use the space selection method to select a space, use the block selection method to select a block. If a block is selected, put the block into the space, delete the space from the remaining spaces, put the newly generated space into the remaining spaces, delete the boxes contained in the block from the remaining unpacked boxes, and delete the blocks that cannot be assembled from the remaining unpacked boxes from the blockList; If no block is selected, delete the selected space from the remaining spaces; After the loop ends, if the packing area of the copy is greater than the area of the best packing plan found so far, update the best packing plan to the packing plan of this copy; Finally, return the packing area of the copy as the score of state i ; Step 3: If all the boxes are packed in the best packing plan in the second step, use this plan as the final result and end; Otherwise, generate a new container with a length equal to length and an infinite width; Use fast loading search based on beam search to load the remaining boxes into the container; add the occupied width of the container with the best loading scheme obtained by fast loading search to the occupied width of the container with the best loading scheme in the second step, and record the obtained width as fastHigh, which is called the larger width; call the width (area / length) of the new rectangular container in the second step the minimum width, and record it as minHigh; generate a width set between (minHigh, fastHigh] with a step size of 1, and use each width in the set as the width and length as the length to generate fastHigh - minhigh new containers; use the blocks generated in the first step and a search process similar to that in the second step to search each of the fastHigh - minhigh containers respectively. The difference between the search process in this step and the search process described in the second step is only the greedy loading method; after all containers are searched, select the best one from the best loading results of all containers as the final result; for the fast loading search in the third step: first generate an initial state, which includes the remaining space of the new container and the remaining unloaded boxes; the remaining space is the entire container space, and the remaining unloaded boxes are the boxes not loaded into the container in the best loading scheme of the second step; then use beam search for loading. When beam search is first performed, the number of successor nodes expanded by each node (state) is w = 1, and in each subsequent new search round, w is expanded to ; the way of node expansion is: select a space from the remaining space using the space selection method, select w boxes from the remaining unloaded boxes using the box selection method, take out one box from the w boxes each time and put it into the space, then delete the space from the remaining space, put the generated new space into the remaining space, and delete the box from the remaining unloaded boxes; the resulting remaining space and remaining unloaded boxes constitute a new state node; for each state state j in the newly generated w states, we use the greedy loading method to load it until there is no available remaining space, and then use the loading width after loading as the score of this state, and then select the one with the largest score from the w states as the node to be expanded next; when w is greater than 2, end the beam search; for the space selection method in the fast loading search: select the space with the smallest y coordinate at the lower left corner of the remaining space; if there are multiple such spaces, select the one with the smallest x coordinate value at the lower left corner; for the box selection method in the fast loading search: first select all the boxes that can be put into the space according to their sizes from the remaining unloaded boxes (if the number of selected boxes is 0, there are no boxes that can be put into the space), and then select the top w boxes in descending order of their widths; for the greedy loading method in the fast loading search: first generate state j a copy of it and load with this copy; if there is still remaining space in this copy or there are still remaining boxes not loaded in the copy, keep repeating: if there is no remaining space in the copy and there are still remaining boxes not loaded, obtain the width of the container occupied by the boxes in the current state, denoted as y, generate a space with length as length, infinite width, and the lower left corner coordinate of (0, y), and put the space into the remaining space; use the space selection method in the fast loading method to select a space, use the box selection method in the fast loading method to select a box, if a box is selected, put the box into the space, delete the space from the remaining space, put the newly generated space into the remaining space, and delete the box from the remaining boxes not loaded; if no box is selected, delete the selected space from the remaining space; after the loop ends, if the loading width of the copy is less than the width of the best loading scheme searched at this time, update the best loading scheme to the loading scheme of this copy; finally, return the loading width of the copy as state j the score of; for the greedy loading method in the third step: first generate the state state k a copy of it and load with this copy; if there is still remaining space in this copy, keep repeating: use the space selection method to select a space, use the block selection method to select a block, if a block is selected, put the block into the space, delete the space from the remaining space, put the newly generated space into the remaining space, delete the boxes contained in the block from the remaining boxes not loaded, and delete the blocks that cannot be pieced together with the remaining boxes not loaded from the blockList; if no block is selected, delete the selected space from the remaining space; after the loop ends, if all the boxes in the copy are loaded into the container and the loading width of the copy is less than the width of the best loading scheme searched at this time, update the best loading scheme to the loading scheme of this copy; otherwise, use the fast loading search to continue loading the boxes not loaded into the container, and then merge the best loading result of the fast loading search with the result of the copy as the complete result; If the loading width of the complete result is less than the width of the best loading solution found at this time, then update the best loading solution to the complete result; finally, use the loading area of the copy as the score of state k of.