A graphic layout method based on nested multi-population classification genetic algorithm
Through the nested multi-population classification genetic algorithm and the optimal preservation weighted selection operator, combined with the critical polygon algorithm, the problem of insufficient local search capability and gene richness of the graph nesting method in the existing technology is solved, and a higher level is achieved. The plate utilization rate and production efficiency.
Patent Information
- Application Number
- CN202410949722.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-07-16
AI Technical Summary
In terms of improving plate utilization and production efficiency, existing pattern layout methods have problems such as insufficient local search capabilities, insufficient gene richness, and the tendency to fall into local convergence, making it difficult to effectively optimize the arrangement of two-dimensional irregular graphics.
A method based on the nested multi-population classification genetic algorithm is used to classify the characteristics of the graphics to form a nested two-level population, and perform two rounds of selection crossover and exchange mutation through the optimal preservation weighted selection operator to eliminate fitness For poor individuals, the optimal result is output based on the critical polygon algorithm.
It improves the local search ability of the genetic algorithm, increases the gene richness, can better complete the layout task, improves the plate utilization and production efficiency, jumps out of local convergence, and provides more feasible solutions.
Smart Images

Figure CN118485010B
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of graphic layout optimization design, and in particular to a graphic layout method based on a nested multi-population classification genetic algorithm. Background Art
[0002] Graphic layout problems are common in industries that require workpiece cutting, such as the clothing industry and machinery manufacturing industry. They require that parts of a specified size be arranged on a certain area of plate, and the utilization rate of the plate should be as high as possible. In actual production, the higher the utilization rate of the plate, the more production costs are saved, which can improve production efficiency and is of great significance to corporate production. However, because most of the parts arranged in production are two-dimensional irregular graphics, it is a great challenge to the layout method.
[0003] The existing layout method mainly optimizes the arrangement order of parts through intelligent algorithms, and then uses heuristic algorithms or random search algorithms to locate and arrange the parts according to the optimal order. Common intelligent algorithms include genetic algorithms, simulated annealing algorithms, taboo search algorithms, artificial neural networks, etc. Common heuristic algorithms include critical polygon algorithms, leftmost and bottommost algorithms, scanning positioning algorithms, etc. Among them, genetic algorithms are a widely used and efficient intelligent algorithm. By simulating the process of biological evolution, the individuals of the population are continuously cross-mutated to finally obtain the optimal solution.
[0004] In order to solve the problem of optimizing the sorting by genetic algorithm, patent document CN113435094B provides a two-dimensional irregular parts arrangement method based on genetic algorithm. The patent optimizes the placement order and rotation angle according to the genetic algorithm, and determines whether other parts can be placed in the hole. If they can be placed, the part is placed in the hole first and then the parts are arranged according to the NFP and the lower left positioning order of the center of gravity. In order to solve the problem of arranging defective plates, patent document CN110570038B provides a rectangular arrangement method for irregular defective plates. The patent adopts a hybrid arrangement algorithm combining HL heuristic and genetic algorithm, taking the rectangular order as the gene encoding and HL heuristic as the decoding process, and searches for a better arrangement scheme through continuous iterative evolution.
[0005] Although the above-mentioned patent solutions all use genetic algorithms to optimize the layout problem, there are still some shortcomings: first, the genetic algorithms used are all mature algorithm logic, which is difficult to break through the framework of traditional genetic algorithms, and the ability to search locally for layout problems is poor; second, they do not fully utilize the characteristic parameters of the samples, the arrangement of irregular samples is not flexible enough, and the utilization rate of the plate is poor; finally, the genetic richness of the above-mentioned patent solutions is not enough, and they are prone to local convergence. Summary of the invention
[0006] In view of the above technical problems to be solved, the present invention provides a graphic layout method based on a nested multi-population classification genetic algorithm, which can better complete the layout task, thereby improving the utilization rate of the board material and the production efficiency.
[0007] In order to solve the above technical problems, the technical solution proposed by the present invention is:
[0008] A method for pattern arrangement based on nested multi-population classification genetic algorithm, firstly, the pattern to be arranged is characterized and classified, and each type of pattern after classification is nested into two sub-populations to obtain a nested two-layer population; then, the second-layer population of each type of pattern is subjected to two rounds of selection crossover and exchange mutation by using the optimal preservation weighted selection operator; individuals with poor fitness in the mutant population after the second round of mutation are eliminated, and individuals with higher fitness are retained; then, the critical polygon algorithm is used to arrange the sorted and optimized pattern to obtain the optimal result.
[0009] As a further improvement of the above technical solution:
[0010] Preferably, the graphic layout method specifically comprises the following steps:
[0011] Step S1: first obtain the parameters and quantity of each graphic, and form different matching methods by different search mechanisms, so as to classify all the graphics to be arranged;
[0012] Step S2: Initialize the population. Different types of graphics are defined as the first-level population. Two independent nested populations are set in each first-level population, which are defined as the second-level population.
[0013] Step S3: determine the fitness function and calculate the fitness function value of each individual;
[0014] Step S4: using the optimal preservation weighted selection operator to perform two rounds of selection crossover and exchange mutation on the second-layer population of each type of graph; eliminating individuals with poor fitness in the mutant population after the second round of mutation, and retaining individuals with higher fitness;
[0015] Step S5: If the algorithm does not meet the stopping criteria, steps S3 to S4 are repeatedly executed iteratively; if the algorithm meets the stopping criteria, an individual with the highest fitness function value is selected from the offspring population corresponding to each type of graphics, and the optimal solution for each type of graphics arrangement is output according to the feature classification;
[0016] Step S6: Use the critical polygon algorithm to arrange the graphics after sorting optimization to obtain the optimal result.
[0017] Preferably, in step S1, different matching methods are formed by different search mechanisms, specifically: the graphics to be arranged are classified according to the custom weights of the key parameters of the graphics, and the key parameters include at least the rotation angle of the graphics, the size of the graphics, the shape of the graphics, the number of graphics, and the center of gravity position of the graphics.
[0018] Preferably, in step S2, each second-layer population individual contains the required arrangement pattern of the first-layer population, and individuals in one of the two nested populations of the first-layer population are randomly generated, and individuals in the other are arranged in descending order by area.
[0019] Preferably, in step S3, the fitness function is:
[0020] ;
[0021] in, X is a feasible solution to this model, P j is the set of graphs within each population, S i Represents the area of a figure. W 0 Indicates the available width of the plate. L max Indicates the maximum length of the plate occupied by the current feasible solution.
[0022] Preferably, in step S4, the optimal preservation weighted selection operator is: two nested populations of a first-layer population generate weights by individual fitness values, and the probability of selecting an individual is proportional to the individual fitness value; one of the nested populations selects individuals in two populations through the weighted selection operator for crossover, generates offspring after crossover and records the best individual, if the offspring is better than the individual with the highest original fitness value, the original best individual in the population is replaced by the offspring, if the offspring is worse than the individual with the highest original fitness value, the crossover is selected again; the other nested population selects an individual in one population through the weighted selection operator and crosses with the best individual of a nested population, generates offspring after crossover and records the best individual, if the offspring is better than the individual with the highest original fitness value, the worst individual in the population is replaced by the offspring, if the offspring is worse than the individual with the highest original fitness value, the crossover is selected again.
[0023] The graphic layout method based on nested multi-population classification genetic algorithm provided by the present invention has the following advantages compared with the prior art:
[0024] (1) The graphic layout method based on the nested multi-population classification genetic algorithm of the present invention improves the local search capability of the genetic algorithm and greatly increases the gene richness, which can better complete the layout task, thereby improving the utilization rate of the board and production efficiency. The graphic layout method of the present invention also proposes an optimal preservation weighted selection operator, which makes full use of the nested multi-population structure of the present invention and makes it easier to find the optimal solution.
[0025] (2) The graphic layout method based on the nested multi-population classification genetic algorithm of the present invention forms a larger number of populations by classifying the graphics by features, and each type of graphics is first evolved separately to obtain more abundant chromosome genes for each type of graphics, which greatly enhances the local search capability of the genetic algorithm adopted by this patent and makes it easier to jump out of local convergence during the operation of the algorithm; it fully utilizes the influence of the characteristics of the layout graphics on the layout effect, makes the layout of irregular graphics more flexible, and improves the layout utilization rate and production efficiency.
[0026] (3) The graphic layout method based on nested multi-population classification genetic algorithm of the present invention adopts a new nested multi-population genetic algorithm, combined with the optimal preservation weighted selection operator to select and crossover population individuals, breaking the traditional genetic algorithm framework and providing more feasible solutions. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 It is a flow chart of the graphic layout method of the present invention.
[0028] Figure 2 It is a population relationship flow chart of the nested multi-population classification genetic algorithm of the present invention.
[0029] Figure 3 It is a specific flow chart of the optimal preservation weighted selection operator taking population B1 and population B2 as examples in an embodiment of the present invention. DETAILED DESCRIPTION
[0030] The specific embodiments of the present invention are described in detail below. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0031] The graphic arrangement method based on nested multi-population classification genetic algorithm of the present invention classifies the graphics to be arranged by features, and each type of graphics is nested with two sub-populations to obtain a nested two-layer population, thereby completing the subsequent selection crossover mutation process.
[0032] Taking a two-dimensional irregular graphic as an object, the graphic arrangement method of the present invention is specifically described by arranging the two-dimensional irregular graphic.
[0033] In this embodiment, the flowchart of the two-dimensional irregular pattern arrangement method based on the nested multi-population classification genetic algorithm is as follows: Figure 1 The specific steps are as follows:
[0034] Step S1: first obtain the size parameters and quantity of each two-dimensional irregular figure, and number each two-dimensional irregular figure, and then randomly generate a figure number and a rotation angle within a specified range as the encoding method of each population individual according to the graphic characteristics of the plate, and form three different matching methods by different search mechanisms, so that all the two-dimensional irregular figures to be arranged are divided into three categories, which are defined as the first type of figures, the second type of figures, and the third type of figures.
[0035] Three different matching methods are formed by different search mechanisms, specifically: the graphics to be arranged are classified according to the custom weights of the key parameters of the two-dimensional irregular graphics, and the key parameters include the graphics rotation angle, graphics size, graphics shape, graphics number, graphics center of gravity position, etc.
[0036] Step S2: Initialize the population. The first type of graphics, the second type of graphics, and the third type of graphics are defined as the first-level population, which are population A1, population A2, and population A3, respectively. Two independent nested populations are set in each first-level population, which are defined as the second-level population. According to the definition of the first-level population, the second-level populations are population B1, population B2, population B3, population B4, population B5, and population B6, respectively. Population A1 sets population B1 and population B2, population A2 sets population B3 and population B4, and population A3 sets population B5 and population B6. In addition, individuals in population B1, population B3, and population B5 are randomly generated, and individuals in population B2, population B4, and population B6 are arranged in descending order by area.
[0037] The final result of initializing the population is as follows Figure 2 As shown, the two-dimensional irregular graphics required for pattern arrangement are first divided into population A1, population A2, and population A3 according to the graphic characteristics, which are defined as the first-layer population. The first-layer populations are independent of each other; each first-layer population is nested with two populations, that is, population A1 is nested with population B1 and population B2, population A2 is nested with population B3 and population B4, and population A3 is nested with population B5 and population B6, which are defined as the second-layer population, and each individual of the second-layer population contains the required pattern arrangement of the first-layer population, and the individuals in population B1, population B3, and population B5 are randomly generated, and the individuals in population B2, population B4, and population B6 are arranged in descending order by area.
[0038] Further explanation: the graphic features are preset custom standards, such as the custom weights of the key parameters of the two-dimensional irregular graphic described in step S1 to classify the graphics to be arranged, mainly including the graphic size, graphic shape, center of gravity position, etc. Taking the graphic size as an example, 0-25 can be set as a small size, 25-100 as a medium size, and 100 or more as a large size. The graphic size can be calculated, so it can be classified. Other parameters can also be classified similarly, and then weights are added to these parameters to finally obtain three types of graphics.
[0039] Step S3: Determine the fitness function and calculate the fitness function value of each individual.
[0040] In this embodiment, the goal of two-dimensional layout is to maximize the utilization of the plate. Therefore, the ratio of the area of all the graphics currently arranged to the area of the plate currently used is used as the fitness value. If the fitness value is larger, it means that the area of all the graphics currently arranged accounts for a larger proportion of the area of the plate currently used, and the utilization rate is better.
[0041] The fitness function is:
[0042] ;
[0043] in, X is a feasible solution to this model, P j is a set of two-dimensional irregular shapes within each population, S i represents the area of a two-dimensional irregular figure, W 0 Indicates the available width of the plate. L max Indicates the maximum length of the plate occupied by the current feasible solution.
[0044] The subsequent calculation of the fitness function value of each individual is based on the population to which the individual currently belongs. The larger the fitness function value, the higher the individual fitness.
[0045] Step S4: using the optimal conservation weighted selection operator to perform two rounds of selection crossover and exchange mutation on the second-layer population of each type of two-dimensional irregular graphics; eliminating individuals with poor fitness in the mutant population after the second round of mutation, and retaining individuals with higher fitness.
[0046] Further explanation, in this embodiment, the judgment standard is a custom standard, that is, a standard preset according to the usage scenario, for example, judging according to the value of the individual fitness function, and 0.6 or less can be defined as poor fitness.
[0047] The specific steps of this step are:
[0048] Step S41: Use the optimal preservation weighted selection operator to perform selection crossover on the second-layer population of each type of two-dimensional irregular graphics to obtain a crossover population after the first round of crossover, and perform exchange mutation on the crossover population after the first round of crossover to obtain a mutated population after the first round of mutation.
[0049] Population B1 and population B2 are selected and crossed to obtain population C1 and population C2, population B3 and population B4 are selected and crossed to obtain population C3 and population C4, and population B5 and population B6 are selected and crossed to obtain population C5 and population C6; the crossover population C1, population C2, population C3, population C4, population C5, and population C6 after the first round of crossover are subjected to exchange mutation to obtain the mutant populations after the first round of mutation, which correspond to population D1, population D2, population D3, population D4, population D5, and population D6.
[0050] Step S42: merging the mutant population after the first round of mutation to obtain a merged population.
[0051] After the first round of mutation, the mutated population D1 is merged with population D2, population D3 is merged with population D4, and population D5 is merged with population D6 to obtain population E1, population E2, and population E3 respectively.
[0052] Step S43: using the optimal preservation weighted selection operator to perform pairwise crossover on the merged population to obtain a crossover population after the second round of crossover; performing exchange mutation on the crossover population after the second round of crossover to obtain a mutated population after the second round of mutation.
[0053] The optimal conservation weighted selection operator is used to perform a pairwise crossover on populations E1, E2, and E3 to obtain the crossover population after the second round of crossover. That is, populations E1 and E2 are selected to crossover to obtain populations F1 and F2, populations E1 and E3 are selected to crossover to obtain populations F3 and F4, and populations E2 and E3 are selected to crossover to obtain populations F5 and F6; after the second round of crossover, the crossover populations F1, F2, F3, F4, F5, and F6 are subjected to exchange mutation to obtain the mutant populations after the second round of mutation, which correspond to populations G1, G2, G3, G4, G5, and G6.
[0054] Step S43: Eliminate individuals with poor fitness in the mutant population after the second round of mutation, and retain individuals with higher fitness.
[0055] Eliminate individuals with poor fitness from the mutant populations G1, G2, G3, G4, G5, and G6 after the second round of mutation, retain individuals with higher fitness, and finally obtain populations H1, H2, H3, H4, H5, and H6.
[0056] In this embodiment, the specific process of the optimal preservation weighted selection operator is as follows: Figure 3 As shown, Figure 3 Take the selection crossover between population B1 and population B2 as an example. The weights of both populations B1 and B2 are generated by the individual fitness values, that is, the probability of selecting an individual is proportional to the individual fitness value; population B1 selects individuals from two populations through the weighted selection operator for crossover, generates offspring after crossover and records the best individual, if the offspring is better than the original individual with the highest fitness value, the original best individual in the population is replaced by the offspring, if the offspring is worse than the original individual with the highest fitness value, the selection crossover is performed again; population B2 selects an individual from its population through the weighted selection operator and crosses with the best individual of population B1, generates offspring after crossover and records the best individual, if the offspring is better than the original individual with the highest fitness value, the worst individual in the population is replaced by the offspring, if the offspring is worse than the original individual with the highest fitness value, the selection crossover is performed again.
[0057] The selection crossover between other populations is the same as the above process; the change relationship between populations during the two rounds of crossover mutation in step S4 can be expressed as Figure 2 What I see.
[0058] Step S5: If the algorithm does not meet the stopping criterion, steps S3 to S4 are repeatedly iterated, and population H1, population H2, population H3, population H4, population H5, and population H6 are used as the second-layer population B1, population B2, population B3, population B4, population B5, and population B6 of the next generation; if the algorithm meets the stopping criterion, an individual with the highest fitness function value is selected from the child population corresponding to each type of graphics, and the optimal solution for each type of two-dimensional irregular graphics arrangement is output according to feature classification.
[0059] Further explanation, in this embodiment, the stopping criterion is a custom standard, preferably the number of iterations, which is determined according to the specific use environment, and the iteration can be stopped if the fitness value is stable. Select a suitable number of iterations, otherwise too large a number of iterations will cause the calculation time to be too long.
[0060] Step S6: Using a critical polygon algorithm to arrange the two-dimensional irregular graphics after sorting optimization to obtain the optimal result.
[0061] Further explanation, in this embodiment, the critical polygon algorithm (NFP for short) is a heuristic algorithm for determining the placement of polygons by obtaining the critical polygon outlines of two polygons. It can be used to quickly determine whether there is overlap between polygon graphics and is an optimal algorithm for placing polygon positions.
[0062] Specifically: for two polygons A and B, assuming that A is fixed, polygon B moves around polygon A (without changing the rotation angle during the sliding process) for one circle while maintaining contact with polygon A but not overlapping, and returns to the origin. In this process, select any point P on B (usually the starting point of polygon B) as the reference point, and the movement trajectory of this reference point is the critical polygon. After obtaining the contour of the critical polygon, the non-overlapping and closely contacting arrangement position of polygon B relative to A can be obtained.
[0063] The above implementation cases are only preferred embodiments of the present invention and are not intended to limit the present invention in any form. Although the present invention has been disclosed as above with preferred embodiments, they are not intended to limit the present invention. Therefore, any simple modification, equivalent changes and modifications made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention shall fall within the scope of protection of the technical solution of the present invention.
Claims
1. A graphic layout method based on nested multi-population classification genetic algorithm, characterized in that: First, the graphics to be arranged are characterized and classified. After classification, each type of graphics is nested into two sub-populations to obtain a nested two-layer population, namely the first-layer population and the second-layer population. Then, the optimal preservation weighted selection operator is used to perform two rounds of selection crossover and exchange mutation on the second-layer population of each type of graphics. Individuals with poor fitness in the mutant population after the second round of mutation are eliminated, and individuals with higher fitness are retained. Then, the critical polygon algorithm is used to arrange the graphics after sorting optimization to obtain the optimal result. The optimal preservation weighted selection operator is as follows: two nested populations of a first-layer population generate weights by individual fitness values, and the probability of selecting an individual is proportional to the individual fitness value; one of the nested populations selects individuals in two populations through the weighted selection operator for crossover, generates offspring after crossover and records the best individual, and if the offspring is better than the individual with the highest original fitness value, the original best individual in the population is replaced by the offspring, and if the offspring is worse than the individual with the highest original fitness value, the crossover is selected again; the other nested population selects an individual in one population through the weighted selection operator and crosses with the best individual of a nested population, generates offspring after crossover and records the best individual, and if the offspring is better than the individual with the highest original fitness value, the worst individual in the population is replaced by the offspring, and if the offspring is worse than the individual with the highest original fitness value, the crossover is selected again; The individual fitness value is calculated by the fitness function, and the fitness function is: ; in, X is a feasible solution to this model, P j is the set of graphs within each population, S i Represents the area of a figure. W 0 Indicates the available width of the plate. L max Indicates the maximum length of the plate occupied by the current feasible solution; The fitness function value of each individual is calculated based on the population to which the individual currently belongs. The larger the fitness function value, the higher the individual fitness.
2. The graphic layout method based on nested multi-population classification genetic algorithm according to claim 1, characterized in that: The graphic layout method specifically comprises the following steps: Step S1: first obtain the parameters and quantity of each graphic, and form different matching methods by different search mechanisms, so as to classify all the graphics to be arranged; Step S2: Initialize the population. Different types of graphics are defined as the first-level population. Two independent nested populations are set in each first-level population, which are defined as the second-level population. Step S3: determine the fitness function and calculate the fitness function value of each individual; Step S4: using the optimal preservation weighted selection operator to perform two rounds of selection crossover and exchange mutation on the second-layer population of each type of graph; eliminating individuals with poor fitness in the mutant population after the second round of mutation, and retaining individuals with higher fitness; Step S5: If the algorithm does not meet the stopping criteria, steps S3 to S4 are repeatedly executed iteratively; if the algorithm meets the stopping criteria, an individual with the highest fitness function value is selected from the offspring population corresponding to each type of graphics, and the optimal solution for each type of graphics arrangement is output according to the feature classification; Step S6: Use the critical polygon algorithm to arrange the graphics after sorting optimization to obtain the optimal result.
3. The pattern arrangement method based on nested multi-population classification genetic algorithm according to claim 2, characterized in that: In step S1, different matching methods are formed by different search mechanisms, specifically: the graphics to be arranged are classified according to the custom weights of the key parameters of the graphics, and the key parameters include at least the rotation angle of the graphics, the size of the graphics, the shape of the graphics, the number of graphics, and the center of gravity position of the graphics.
4. The pattern arrangement method based on nested multi-population classification genetic algorithm according to claim 2, characterized in that: In step S2, each second-layer population individual contains the required arrangement pattern of the first-layer population, and individuals in one of the two nested populations of the first-layer population are randomly generated, and individuals in the other are arranged in descending order by area.
