Irregular two-dimensional parts arrangement method based on image extension area coverage optimization
Through improved genetic algorithms and image expansion area coverage optimization technology, the problem of inefficiency in irregular two-dimensional parts layout is solved, and more efficient material utilization and lower waste are achieved.
Patent Information
- Application Number
- CN202410236321.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-01
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-03-01
AI Technical Summary
The prior art is inefficient when dealing with the arrangement of two-dimensional parts of irregular shapes, and cannot ensure optimal use of materials, resulting in high material waste and production costs.
Using improved genetic algorithms and image expansion area coverage optimization method, the CAD model of the parts is obtained, image preprocessing and expansion are performed, and the positional arrangement of parts on the board is optimized to ensure the maximum coverage of the extended area.
It improves the efficiency and material utilization of irregular two-dimensional parts layout, reduces material waste and production costs, and achieves tighter part layout and higher board utilization.
Smart Images

Figure CN118296743B_ABST
Abstract
Description
Technical field:
[0001] The invention relates to an irregular two-dimensional parts arrangement method based on an improved genetic algorithm and image extension area coverage optimization, and belongs to the field of computer science and engineering. Background technology:
[0002] Optimizing the use of materials to reduce waste and improve production efficiency has been a long-standing challenge in manufacturing and other industrial fields. This challenge becomes more significant when dealing with irregularly shaped two-dimensional parts. Traditional layout methods often rely on empirical judgment or simple algorithms, which are inefficient when dealing with parts of complex shapes and sizes and cannot ensure optimal utilization of materials. In addition, due to the lack of accurate and flexible optimization mechanisms, these methods usually lead to high material waste and production costs.
[0003] With the development of computer-aided design (CAD) technology, although significant progress has been made in part design and modeling, existing layout optimization techniques still face many limitations. For example, many existing methods fail to fully consider the complex interactions between parts, such as clearance requirements and potential overlapping areas, which are key factors in achieving efficient material utilization. In addition, traditional optimization algorithms, such as linear programming and simple genetic algorithms, are often computationally expensive and time-consuming to solve when dealing with large-scale or highly complex layout tasks.
[0004] In this context, there is an urgent need for an optimization method that can fully utilize modern computing power to improve the efficiency and material utilization of irregular 2D part placement. In particular, a method is needed that can accurately handle parts of different shapes and sizes while taking into account practical constraints in the production process, such as minimum clearance requirements between parts and specific placement rules.
[0005] In addition, with the increasing awareness of sustainable production and environmental protection, effectively reducing material waste can not only reduce production costs, but also contribute to the environmental responsibility and sustainable development goals of enterprises. Therefore, developing an optimization method for irregular two-dimensional part arrangement based on advanced algorithms and image processing technology is of great significance for improving production efficiency, reducing waste, and promoting the development of manufacturing industry in a greener and more efficient direction. Summary of the invention:
[0006] The present invention relates to an irregular two-dimensional parts arrangement method based on an improved genetic algorithm and image expansion area coverage optimization, which optimizes the arrangement of irregular two-dimensional parts on a plate, thereby further improving the corresponding arrangement efficiency while improving the utilization rate of the plate.
[0007] The present invention adopts the following technical solution: an irregular two-dimensional parts arrangement method based on image expansion area coverage optimization, and its arrangement process mainly includes the following steps:
[0008] S1. According to the CAD model of the part, obtain the part pattern image and perform binarization on it, where the black is the background and the white is the part area;
[0009] S2, obtaining the horizontal and vertical dimensions of the part, and obtaining the corresponding standard rectangular image based on the corresponding dimensions;
[0010] S3. Expand the part graphics for the first time according to the clearance requirements of the parts;
[0011] S4. Calculate the width of the corresponding expansion area according to the size of the part, and perform a second expansion on the graphics of the part;
[0012] S5, expanding the plate image based on the expansion width of the part image during the second expansion;
[0013] S6. Based on the improved genetic algorithm, the position of the first part image on the plate image is encoded, mutated, and decoded, and the coverage rate of the second extended area of the part image by the extended area of the plate image is optimized as the optimization target;
[0014] S7. After the position arrangement optimization of the first part is completed, the subsequent parts are also expanded twice, and the unexpanded plate image is expanded based on the width used for the second expansion of the current part;
[0015] S8. In the later arrangement process of parts, the calculation of the coverage of the extended area of the parts includes the extended area of the plate image and the coverage of the parts arranged on the plate image;
[0016] S9. For the arrangement of each part in the later stage, the space in the width area occupied on the left side is given priority. If it is difficult to find a suitable position in this area, the width of the search area is expanded;
[0017] S10, repeat the above process until all parts are arranged.
[0018] In step S4, the width of the corresponding expansion area is calculated according to the size of the part, and for parts with too small size, the lower limit of the minimum value is specified to ensure that there is enough expansion area for analysis and calculation in the later arrangement optimization;
[0019] In step S6-8, the coverage of the extended area of the first part image depends only on the extended area of the plate image, while the coverage of the subsequent parts depends on both the extended area of the plate image and the arranged and positioned part images;
[0020] In step S9, for the arrangement of each part in the later stage, the space in the width area occupied by the left side is given priority. If all samples are detected to overlap when searching in this area, the size of the overlapping area of each sample is calculated, and the codes of all samples are replaced with the codes of the samples with the smallest overlapping area. After mutation, it is detected whether there are any overlapping arrangement results. If there are, they are further optimized. If not, it is considered that no suitable position can be found in this area. Description of the drawings:
[0021] Figure 1 Schematic diagram of the initial processing of the image; 1(a) is the original image; 1(b) is the binarization result of the original image; 1(c) is the schematic diagram of the cropped image; 1(d) is the schematic diagram of adjusting the image according to the actual size of the workpiece;
[0022] Figure 2 2(a) is a schematic diagram of the area to be expanded; 2(b) is a schematic diagram of the image after expansion;
[0023] Figure 3 Schematic diagram of the image expansion process twice; 3(a) is the result of the first expansion of the part image; 3(b) is the result of the second expansion of the part image; 3(c) is the area obtained by the second expansion of the part image;
[0024] Figure 4 Schematic diagram of the plate image expansion process; 4(a) is a plate image without an expansion area; 4(b) is a plate image with an expansion area;
[0025] Figure 5 The binary coding used in the improved genetic algorithm;
[0026] Figure 6 It is a schematic diagram of the part image size;
[0027] Figure 7 This is a flow chart of the image arrangement technology solution based on improved genetic algorithm and image processing;
[0028] Figure 8 Schematic diagram of the arrangement of part images with overlapping areas and without overlapping areas; 8(a) is part image 1; 8(b) is part image 2; 8(c) is the arrangement of two part images with overlapping areas; 8(d) is the arrangement of two part images without overlapping areas;
[0029] Fig. 9Schematic diagram of the calculation of the occupied area of the extended area of the first part image and the final optimization result of the position of the first part image; wherein 9(a) is the random position of the first part image on the plate; 9(b) is the corresponding extended area of the part image; 9(c) is the occupied area of the extended area of the first part image; 9(d) is the optimized position of the extended area of the part image; 9(e) is the optimized position of the first part image;
[0030] Fig.10 Schematic diagram of the area occupied by the extended area of the second part image and the final optimized position of the second part image; 10(a) is the random position of the second part image on the plate image; 10(b) is the corresponding extended area of the second part image; 10(c) is a schematic diagram of the area occupied by the extended area of the second part image; 10(d) is the optimized position of the extended area image of the second part image; 10(e) is the corresponding optimized position of the second part image;
[0031] Fig.11 11(a) is a schematic diagram of the width of the area occupied by the first and second part images on the plate image; 11(b) is a schematic diagram of the position range of the third part image in the occupied width area;
[0032] Fig.12 Schematic diagram for increasing the width of the search area;
[0033] Fig.13 The final arrangement results of the part images; 13(a) is the arrangement result of the first group of part images; 13(b) is the arrangement result of the second group of part images. Specific implementation method:
[0034] In order to clarify the technical problems, technical solutions, implementation processes and performance demonstrations, the present invention is further described in detail below in conjunction with embodiments. It should be understood that the specific embodiments described herein are for explanation only. The present invention is not intended to limit the present invention. Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings do not have to be drawn to scale unless otherwise specified.
[0035] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0036] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0037] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings.
[0038] Image preprocessing, including image resizing and image expansion, includes the following:
[0039] Image resizing
[0040] The part image is obtained from the DWG file by using C++ programming. Afterwards, the color difference between the pattern and its background is used for binarization, as shown in Figure 1 As shown in (a) and (b).
[0041] In most cases, the image size of the part cannot accurately represent the actual size of the workpiece. Therefore, it is necessary to adjust the image size to correctly correspond to the actual size of the part. The first step involves cropping out the outer area of the image, such as Figure 1 (c). Afterwards, the image is resized to match the real size of the workpiece. Figure 1 (d) as shown.
[0042] Image Extension
[0043] In order to ensure the accurate positioning of the parts, it is essential to consider the gap between them. This gap is crucial because it allows some material to be removed during the cutting process. To accommodate this adjustment, the contour of the part image is expanded according to formula (1):
[0044]
[0045] Among them, I(i,j) represents the value of an element in the corresponding binary image matrix, 1 represents white, and 0 represents black. "pg" represents the size of the gap between components, with an accuracy of 0.5mm, where each pixel represents a size of 0.5mm. In addition, the gap between components is set to 4mm. The schematic diagram of the image expansion process is shown in Figure 2 shown.
[0046] exist Figure 2 In (a), white pixels represent the part pattern, gray pixels outline the area to be expanded, and black pixels represent the background. When these gray pixels satisfy equation (1), they are then converted to white. The expanded image is shown in Figure 2 As shown in (b).
[0047] For the expanded result of the first part image, such as Figure 3 As shown in (a), the extended area is contained in the periphery of the original image. The optimization theory applied to the layout process is based on the size of the area occupied by the extended area of the part image and the extended area of the plate image, which will be elaborated in detail later. Therefore, it is necessary to further expand it based on the previously expanded image. The width of the extended area for the second expansion is defined as follows:
[0048] w2=(L length +L width ) / 12 (2)
[0049] Among them, L length and L width Represent the length and width of the part respectively. As the size of the part image decreases, the width w2 of the extended area will also decrease. The minimum value of w2 is defined as 20, which can be expressed as:
[0050] w2=max(w2,20) (3)
[0051] This adjustment ensures that there is enough area in the part image for an optimized layout process. Figure 3 The first initial expansion area of the part image shown in (a) is at the boundary of the part. Figure 3 The part image shown in (b) is the second expansion state. The area obtained by the second expansion is as follows Figure 3 (c) as shown.
[0052] The image representing the plate should also be expanded, using the same expansion width value as the part image, such as Figure 4 In the figure, the middle area represents the sheet, while the surrounding area represents the extended area. This extended area does not exist in reality but is only used to optimize the positioning of the parts. Figure 4 The expanded area shown in (b) will be used for position optimization of the first part image.
[0053] The mathematical model and optimization principle include an improved genetic algorithm and optimization search. The improved genetic algorithm consists of three parts: encoding, mutation and decoding. The optimization search consists of three parts: overlap detection, arrangement of the first part and arrangement of subsequent parts. Specifically, it includes the following contents:
[0054] Improved genetic algorithm
[0055] (1) Coding
[0056] The present invention uses an improved genetic algorithm to determine the optimal spatial arrangement of parts. The positional properties of these parts in the plate are described using three parameters: x-coordinate, y-coordinate and rotation angle. Initially, these data are encoded in binary.
[0057] For each binary code, it includes 27 bits in total. The first 12 bits are used to represent the x-coordinate of the part, followed by bits 13 to 15, which are used to specify the rotation angle of the part. Subsequently, bits 16 to 27 are used to represent the y-coordinate of the part. Figure 5 shown.
[0058] (2) Variation
[0059] The improved genetic algorithm in the present invention randomly selects binary bits during the mutation process and changes them from 0 to 1 or vice versa. However, the number of binary bits to be modified is a difficult problem to determine. For this reason, the present invention introduces a parameter Nr_max. The code of the sample is represented by C, and the number of bits numbered "1" in the code C is represented by |C|1, and the number of bits numbered "0" is represented by |C|0. Based on Figure 5 , we can get:
[0060] |C|1+|C|0=27 (4) The value of parameter Nr_max is randomly selected from |C|1 or |C|0, which can be expressed as follows:
[0061] Nr_max∈{|C|1,|C|0} (5)
[0062] The number of bits to be modified is represented by Nr, and its maximum value is Nr_max. The specific value of Nr is any value between 0 and Nr_max, which can be expressed as:
[0063] Nr∈{0,1,2,...,Nr_max} (6)
[0064] In addition, another random variable, denoted as r, is used to determine the specific bit that will be changed during the mutation process. The variable r can take any integer value from 1 to 27, which can be expressed as:
[0065] r∈{1,2,3,...,27} (7)(3) Decoding
[0066] The x coordinate of the part (x c ) and the y coordinate (y c ) must be within the specified range, which can be expressed as follows:
[0067]
[0068] Among them, Lx and Ly represent the size of the search area along the X axis and Y axis respectively. In addition, lx and ly represent the size of the part along the X axis and Y axis respectively, such as Figure 6 shown.
[0069] Considering that a 12-bit binary number encodes 2^12=4096 unique information combinations, the spatial position characteristics of the part can be expressed as:
[0070] xc=BI(1:12)·(Lx-lx) / 4096 (9)
[0071] yc=BI(16:27)·(Ly-ly) / 4096 (10)
[0072] θ=BI(13:15)·45 (11)
[0073] Where BI represents the 27-bit binary code assigned to each sample, and θ represents the pattern rotation angle.
[0074] Refine your search
[0075] Figure 7 The flowchart of the proposed arrangement principle is presented, summarizing the basic steps of the corresponding search method. It starts with generating an initial solution set and goes through a series of computational optimizations to determine the best arrangement. Through a series of logical steps, including overlap determination, careful optimization of the layout, and strategic mutation of the sample encoding, the iterative optimization process towards the ideal solution is demonstrated.
[0076] (1) Overlap detection:
[0077] It is important to avoid overlap when arranging parts. This invention introduces a simple but very effective method to identify any overlap using the total number of white pixels in the image. Equation (12) describes the overlap criterion:
[0078] N_com=N1+N2 (12)
[0079] Where N_com represents the total number of white pixels in the merged image, while N1 and N2 represent the counts of white pixels in images I1 and I2, respectively. These metrics are quantized as follows:
[0080]
[0081]
[0082]
[0083] Where M and N are the length and width of the entire image, respectively. By comparing the number of white pixels, it is possible to detect whether part images overlap. If equation (12) is not satisfied, it means that part images overlap, and such an arrangement is considered unacceptable.
[0084] Here Figure 8For example, two part images are represented by white pixels and background pixels are designated as black. The combined image, denoted as I, can be described by the following formula:
[0085] I=I1∪I2 (16)
[0086] refer to Figure 8 (c), it is clear that there is an overlap between the two part images; for clarity, the overlapping area is marked with different colors. In contrast, Figure 8 As shown in (d), there is no overlap between the two part images and they are clearly separated, thus satisfying Equation (12).
[0087] (2) Arrangement of the first part:
[0088] For the positioning of part images, the key is to ensure that the entire part image is contained within the boundary of the plate. This needs to be ensured based on equations (9)-(10). Secondly, as mentioned earlier, it is essential to avoid overlap between part images.
[0089] The theoretical basis for optimizing the position of the part image is based on the occupied ratio of the extended area of the part image. Figure 3 (b) as shown.
[0090] For the first part, the extended area of its image can only overlap with the extended area of the plate image. However, for subsequent part images, the extended area can overlap with the extended area of the plate and the images of the parts already placed on the board.
[0091] Randomly introduce the first part image into the plate image, such as Fig. 9 (a) The optimization principle framework is based on evaluating the extent to which the extended area of the part image is covered by the extended area of the sheet. Fig. 9 In (b), the part image and the extended area of the plate are marked with a uniform color. Fig. 9 (c) The covered area in the extended area of the part image is marked with different colors. Using the improved genetic algorithm, the final optimized position is as follows Fig. 9 (d) shows the corresponding real part position. Fig. 9 (e) as shown.
[0092] (3) Arrangement of subsequent parts:
[0093] For the placement of the first part image, it mainly relies on calculating the number of pixels in the extended area of the part image that overlap with the extended area of the sheet image. However, for the positioning of subsequent parts, the method involves calculating the number of pixels in the extended area of the part image that are covered by the extended area of the sheet image and the part image area that has been placed on the sheet image.
[0094] This principle is Fig.10 , where the yellow border indicates the second part image to be positioned. Fig.10 (a), currently, its position lacks optimization. In order to optimize its position, the extended area image of the part image is used and positioned to the same position as the part image itself, such as Fig.10 (b). At this point, the sheet image is no longer empty because the first part image has been placed on it. Therefore, the arrangement of subsequent part images must ensure that not only the entire part image is located inside the sheet image, but also avoids overlapping with any parts that have already been positioned.
[0095] The placed part images, the extended areas of the part images to be optimized, and the extended areas of the plate images are all represented by a uniform color, such as Fig.10 (b) The overlapped parts of the extended area of the current part image and the extended areas of the already placed part images and board images are marked in different colors, as shown in Fig. 9 (c) The optimization goal is to maximize the overlapping area.
[0096] Based on the improved genetic algorithm, the final optimized placement of the part image and the extended image is as follows Fig.10 (d) corresponds to Fig.10 The position of the part image shown in (e) is considered the optimal position after five consecutive attempts failed to find a better result.
[0097] The arrangement of part images adopts a left-to-right method, starting from the area of occupied width, such as Fig.11 (a). The space to the left of the dashed line represents the area of occupied width. In the third arrangement of the part image, the search process prioritizes ensuring that the part image fits within this predefined area, with the goal of not expanding the occupied left width. Fig.11 As shown in (b), the part image outlined in yellow on the left represents the leftmost possible placement of the third part image, while the part image outlined in yellow on the right represents its rightmost boundary. This restriction on the position of the third part image is intended to ensure that it is completely within the area defined by L_occupied, thereby optimizing space usage without expanding the width of the occupation.
[0098] according to Fig.11 (b), the width of the search area of the third part image can be defined as follows:
[0099] L_range=L_occupied–L_width (17)
[0100] The x-coordinate of the location of the third part image can be defined as follows:
[0101] xc=BI(1:12)·(Lx-lx) / 4096 (18)
[0102] Obviously, in Fig.11 It is feasible to find a suitable position for the third part image within the width defined by L_occupied as shown in (a). However, finding a suitable position for the current part image while avoiding overlapping with previously placed part images may present challenges, such as Fig.12 As shown. Within the range of L_occupied, it may be difficult to find a suitable location for the current part. This does not mean that it is impossible to find a suitable location for the part; sometimes it is still possible.
[0103] If a part is detected to overlap with other parts in all samples, the size of the overlapping area of all samples is first calculated, and the area around the part position showing the smallest overlapping area is considered to be the position most likely to accommodate the part. Therefore, the codes of all samples are replaced with the code of the sample showing the smallest overlapping area. Subsequently, the codes of all samples are mutated. If a part can be found that does not overlap with other parts, the optimization process outlined in the arrangement of subsequent parts will be performed. However, there may be some cases where a suitable position for the part image still cannot be found. In this case, the search width of the current part position will be expanded by L_width, that is, the width of the current part, such as Fig.12 shown.
[0104] As the width of the occupied area increases, it is necessary to increase the number of samples used in the genetic algorithm used in the search process to ensure the possibility of finding a suitable location for the part image. In the present invention, the number of samples is determined as follows:
[0105]
[0106] Among them, the symbol Represents the mathematical ceiling function.
[0107] The following is pseudo code that illustrates the layout optimization principle:
[0108]
[0109]
[0110] Arrangement results
[0111] Fig.13 The final result of the arrangement using the irregular two-dimensional parts arrangement method based on image expansion area coverage optimization proposed by the present invention is demonstrated.
[0112] The results show compact arrangements, highlighting the effectiveness of the proposed modified genetic algorithm. Through iterative improvements and strategic arrangements, the algorithm effectively utilizes the available space, reduces waste and maximizes occupancy ratio.
[0113] In summary, the obtained results reinforce the potential of the modified genetic algorithm as a powerful tool for part image loading optimization. The ability of the algorithm to provide tight alignments demonstrates its practical applicability in industrial scenarios where material efficiency is critical. The academic rigor and methodological precision incorporated into the algorithm paves the way for future research and applications in the field of part image loading and optimization.
[0114] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments. The above embodiments and descriptions are only preferred examples of the present invention and are not intended to limit the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention. The scope of protection of the present invention is defined by the attached claims and their equivalents.
Claims
1. An irregular two-dimensional parts arrangement method based on image extension area coverage optimization, characterized by: The arrangement process mainly includes the following steps: S1. According to the CAD model of the part, obtain the part pattern image and perform binarization on it, where the black is the background and the white is the part area; S2, obtaining the horizontal and vertical dimensions of the part, and obtaining the corresponding standard rectangular image based on the corresponding dimensions; S3. Expand the part graphics for the first time according to the clearance requirements of the parts; S4. Calculate the width of the corresponding expansion area according to the size of the part, and perform a second expansion on the graphics of the part; S5, expanding the plate image based on the expansion width of the part image during the second expansion; S6. Based on a genetic algorithm, the position of the first part image on the plate image is encoded, mutated, and decoded, and the coverage rate of the second extended area of the part image by the extended area of the plate image is optimized as an optimization target; S7. After the position arrangement optimization of the first part is completed, the subsequent parts are also expanded twice, and the unexpanded plate image is expanded based on the width used for the second expansion of the current part; S8. In the later arrangement process of parts, the calculation of the coverage of the extended area of the parts includes the extended area of the plate image and the coverage of the parts arranged on the plate image; S9. For the arrangement of each part in the later stage, the space in the width area occupied on the left is given priority. If it is difficult to find a suitable position in this area, the width of the search area is expanded; S10, repeat the above process until all parts are arranged; The step S9 specifically includes the following contents: for the arrangement of each part in the later stage, priority is given to the space in the width area occupied on the left side. If all samples are detected to overlap when searching in this area, the size of the overlapping area of each sample is calculated, and the codes of all samples are replaced with the codes of the samples with the smallest overlapping area, and mutation is performed to detect whether there are any overlapping arrangement results. If there are, further optimization is performed. If not, it is considered that no suitable position can be found in this area.
2. The irregular two-dimensional parts arrangement method based on image expansion area coverage optimization according to claim 1 is characterized in that: In step S4, the width of the corresponding expansion area is calculated according to the size of the part, and for parts with too small size, the lower limit of the minimum value is specified to ensure that there is enough expansion area for analysis and calculation in the subsequent layout optimization.
3. The irregular two-dimensional parts arrangement method based on image expansion area coverage optimization according to claim 1, characterized in that: In step S6-8, the coverage of the extended area of the first part image depends only on the extended area of the plate image, while the coverage of the subsequent part area depends on both the extended area of the plate image and the arranged and positioned part images.
Citation Information
Patent Citations
Apparatus and method for manufacturing optical member-bonded body
CN105474292A
Part typesetting optimization method and device, electronic equipment and storage medium
CN111666717A