Disclosure of Invention
The invention aims to provide a method and a system for determining glass typesetting so as to improve the utilization rate of glass original sheets.
In order to achieve the purpose, the invention provides the following scheme:
a method of glass composition determination, the method comprising:
acquiring the sizes and the number of all glass pieces to be cut and all glass original sheets, wherein the sizes comprise the length and the width;
randomly generating an initial population P according to the sizes and the numbers of all glass pieces to be cut and all glass original sheets, wherein the initial population P comprises N individuals, N is more than or equal to 100, and each individual is a typesetting form of a plurality of glass pieces to be cut on one glass original sheet;
determining the size of the largest rectangle in the glass waste corresponding to each glass original sheet according to the sizes and the number of all glass pieces to be cut and all glass original sheets, wherein the size of the largest rectangle comprises the length and the width of the largest rectangle;
layering all N individuals in the initial population according to the sizes and the number of all glass pieces to be cut and all glass original sheets and the size of the largest rectangle in each glass waste, wherein each layer comprises a plurality of individuals, and the excellence degree of the individual with low layer number is higher than that of the individual with high layer number;
acquiring the aggregation distance of each individual in each layer;
screening M individuals in the initial population according to the aggregation distance and the number of layers of each individual in the initial population; m is more than 1 and less than N;
crossing and mutating the M individuals to generate a mutated population Q, wherein the mutated population Q comprises M crossed and mutated individuals;
combining the initial population P and the varied population Q to generate a population R;
stratifying all individuals in the population R;
screening N individuals with highest excellence according to the layering result of the population R;
and determining the N individuals as glass typesetting forms to be selected by the user.
Optionally, the layering all N individuals in the initial population according to the sizes and the numbers of all the glass pieces to be cut and all the glass original sheets and the size of the largest rectangle in each glass waste specifically includes:
using the function f according to the sizes and quantities of all the glass pieces to be cut and of all the glass masters1(i)=(Li+Wi) /1000 determining a first target value f for the ith individual1(i) (ii) a Wherein i is more than or equal to 1 and less than or equal to N, LiShowing the length of the glass piece to be cut exceeding the length boundary of the glass original after the typesetting is finished according to the ith individual, WiThe length of the glass piece to be cut exceeding the width boundary of the glass original after the typesetting is finished according to the ith individual;
using functions based on the size and number of all glass pieces to be cut and all glass blanks
Determining a second target value f for the ith individual
2(i) (ii) a Wherein S is the area of the glass original sheet corresponding to the ith individual, l
jLength of the jth glass piece to be cut, w, for the ith individual
jThe width of the jth glass piece to be cut corresponding to the ith individual;
using the function according to the size of the largest rectangle in each glass waste
Determining a third target value f for the ith individual
3(i) (ii) a Wherein, g
iThe area of the largest rectangle in the glass waste corresponding to the ith individual;
determining the excellence of each individual according to the first target value, the second target value and the third target value of each individual;
determining variables and sets corresponding to each individual according to the excellence of each individual; the variable is the number of individuals with the excellence degree higher than that of the current individual in the initial population, and the set is the set of the numbers of the individuals with the excellence degree lower than that of the current individual in the initial population;
and layering according to the variable and the set corresponding to each individual.
Optionally, the layering according to the variable and the set corresponding to each individual specifically includes:
for the ith individual, judging whether a variable k of the ith individual is equal to 0 or not to obtain a first judgment result;
when the first judgment result indicates that the variable k of the ith individual is equal to 0, determining the ith individual as the individual of the mth layer; m is more than or equal to 1;
when the first judgment result shows that the variable k of the ith individual is not equal to 0, judging whether an individual with the excellence degree larger than that of the ith individual exists in the (m-1) th layer or not, and obtaining a second judgment result;
when the second judgment result indicates that an individual with the excellence degree larger than that of the ith individual exists in the m-1 th layer, updating the variable of the ith individual to be k-1;
judging whether the variable k-1 after the ith individual is updated is equal to 0 or not to obtain a third judgment result;
when the third judgment result shows that the variable k-1 after the update of the ith individual is equal to 0, determining the ith individual as the individual at the m +1 th layer;
when the third judgment result shows that the variable k-1 after the update of the ith individual is not equal to 0, judging whether an individual with the excellence degree larger than that of the ith individual exists in the mth layer;
all individuals were stratified sequentially.
Optionally, the screening out M individuals in the initial population according to the aggregation distance and the number of layers of each individual in the initial population specifically includes:
randomly selecting n individuals from the initial population; n is more than 1;
obtaining the individual with the lowest layer number in the n individuals;
judging whether the individual with the lowest layer number comprises a plurality of individuals or not to obtain a fourth judgment result;
when the fourth judgment result shows that the individual with the lowest layer number comprises a plurality of individuals, determining the individual with the largest aggregation distance in the plurality of individuals;
determining the individual with the largest aggregation distance as one of the screened M individuals;
when the fourth judgment result shows that a plurality of individuals are not included in the individuals with the lowest layer number, determining the individual with the lowest layer number as one of the screened M individuals;
and sequentially determining the screened M individuals.
Optionally, the crossing and mutating the M individuals to generate a mutated population Q specifically includes:
crossing the 2q-1 individual and the 2q individual by adopting a single-point crossing method to obtain two crossed individuals;
performing exchange variation on the two crossed individuals to obtain two varied individuals;
and obtaining all mutated individuals in turn.
Optionally, the screening N individuals with the highest excellence according to the stratification result of the population R further includes:
obtaining iteration times;
judging whether the current iteration reaches the iteration times to obtain a fifth judgment result;
when the fifth judgment result shows that the current iteration reaches the iteration number, determining the N individuals with the highest screening excellence degree as the N finally output individuals;
and when the fifth judgment result shows that the current iteration does not reach the iteration number, updating the N individuals with the highest screening excellence degree into an initial population, and returning to the step of layering all the N individuals in the initial population according to the sizes and the number of all the glass pieces to be cut and all the glass original sheets and the size of the maximum rectangle in each glass waste.
A glass composition determination system, the system comprising:
the device comprises a parameter acquisition module, a parameter acquisition module and a parameter setting module, wherein the parameter acquisition module is used for acquiring the sizes and the number of all glass pieces to be cut and all glass original sheets, and the sizes comprise lengths and widths;
the initial population generating module is used for randomly generating an initial population P according to the sizes and the numbers of all glass pieces to be cut and all glass original sheets, wherein the initial population P comprises N individuals, N is more than or equal to 100, and each individual is a typesetting form of the plurality of glass pieces to be cut on one glass original sheet;
the device comprises a glass waste maximum rectangle size determining module, a glass waste cutting module and a glass waste cutting module, wherein the glass waste maximum rectangle size determining module is used for determining the size of a maximum rectangle in glass waste corresponding to each glass original sheet according to the sizes and the number of all glass pieces to be cut and all glass original sheets, and the size of the maximum rectangle comprises the length and the width of the maximum rectangle;
the layering module is used for layering all N individuals in the initial population according to the sizes and the number of all glass pieces to be cut and all glass original sheets and the size of the largest rectangle in each glass waste, each layer comprises a plurality of individuals, and the excellence degree of the individual with the low layer number is higher than that of the individual with the high layer number;
the aggregation distance acquisition module is used for acquiring the aggregation distance of each individual in each layer;
the first screening module is used for screening M individuals in the initial population according to the aggregation distance and the number of layers of each individual in the initial population; m is more than 1 and less than N;
a varied population generation module, configured to intersect and vary the M individuals to generate a varied population Q, where the varied population Q includes M intersected and varied individuals;
a population merging module, configured to merge the initial population P and the varied population Q to generate a population R;
the layering module is also used for layering all the individuals in the population R;
the second screening module is used for screening N individuals with highest excellence according to the layering result of the population R;
and the determining module is used for determining the N individuals as the glass typesetting form to be selected by the user.
Optionally, the layering module specifically includes:
a first target value determining unit for determining the size and number of all glass pieces to be cut and all glass original sheets by using the function f1(i)=(Li+Wi) /1000 determining a first target value f for the ith individual1(i) (ii) a Wherein i is more than or equal to 1 and less than or equal to N, LiShowing the length of the glass piece to be cut exceeding the length boundary of the glass original after the typesetting is finished according to the ith individual, WiThe length of the glass piece to be cut exceeding the width boundary of the glass original after the typesetting is finished according to the ith individual;
a second target value determining unit for determining the size and number of all the glass pieces to be cut and all the glass original sheets by using the function
Determining a second target value f for the ith individual
2(i) (ii) a Wherein S is the area of the glass original sheet corresponding to the ith individual, l
jLength of the jth glass piece to be cut, w, for the ith individual
jThe width of the jth glass piece to be cut corresponding to the ith individual;
a third target value determining unit for determining a maximum moment of each of the glass waste materialsSize of shape, using function
Determining a third target value f for the ith individual
3(i) (ii) a Wherein, g
iThe area of the largest rectangle in the glass waste corresponding to the ith individual;
a goodness of merit determination unit for determining the goodness of merit for each individual based on the first target value, the second target value, and the third target value for each individual;
the variable and set determining unit is used for determining the variable and set corresponding to each individual according to the excellence degree of each individual; the variable is the number of individuals with the excellence degree higher than that of the current individual in the initial population, and the set is the set of the numbers of the individuals with the excellence degree lower than that of the current individual in the initial population;
and the layering unit performs layering according to the variable and the set corresponding to each individual.
Optionally, the hierarchical unit specifically includes:
the first judgment subunit is configured to, for an ith individual, judge whether a variable k of the ith individual is equal to 0, and obtain a first judgment result;
an individual determination subunit, configured to determine the ith individual as an individual of the mth layer when the first determination result indicates that the variable k of the ith individual is equal to 0; m is more than or equal to 1;
a second judging subunit, configured to, when the first judgment result indicates that the variable k of the ith individual is not equal to 0, judge whether there is an individual with a degree of excellence greater than that of the ith individual in the m-1 th layer, and obtain a second judgment result;
a variable updating subunit, configured to update the variable of the ith individual to k-1 when the second determination result indicates that there is an individual with a degree of excellence greater than the degree of excellence of the ith individual in the m-1 th layer;
a third judging subunit, configured to judge whether the updated variable k-1 of the ith individual is equal to 0, so as to obtain a third judgment result;
the individual determining subunit is further configured to determine the ith individual as an individual at the m +1 th layer when the third determination result indicates that the updated variable k-1 of the ith individual is equal to 0;
a second determining subunit, configured to determine whether there is an individual with a degree of excellence greater than that of the ith individual in the mth layer when the third determination result indicates that the updated variable k-1 of the ith individual is not equal to 0;
all individuals were stratified sequentially.
Optionally, the first screening module specifically includes:
an individual selecting unit for randomly selecting n individuals from the initial population; n is more than 1;
the number of layers obtaining unit is used for obtaining the individual with the lowest number of layers in the n individuals;
a fourth judging unit, configured to judge whether the individual with the lowest number of layers includes multiple individuals, and obtain a fourth judgment result;
an aggregation distance determining unit configured to determine, when the fourth determination result indicates that the individual with the lowest number of layers includes a plurality of individuals, an individual with a largest aggregation distance among the plurality of individuals;
an individual determination unit, configured to determine the individual with the largest aggregation distance as one individual of the screened M individuals;
and the individual determining unit is further used for determining the individual with the lowest layer number as one of the screened M individuals when the fourth judgment result shows that the individuals with the lowest layer number do not comprise a plurality of individuals.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
according to the invention, on the basis of the traditional glass typesetting optimization target, the maximum recyclable area in the glass waste is also used as an optimization target to carry out glass typesetting optimization, so that the waste generated in glass cutting can be continuously used as the raw sheet material for subsequent glass cutting, and the utilization rate of the glass raw sheet is further improved.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
FIG. 1 is a schematic flow chart of a glass composition determining method according to the present invention. As shown in fig. 1, the method includes:
step 101: and acquiring the sizes and the numbers of all glass pieces to be cut and all glass original sheets. The dimensions include length and width. The glass original sheet refers to a glass raw material for cutting, and the glass piece to be cut refers to a glass product required by a customer.
Step 102: and randomly generating an initial population according to the sizes and the quantities of all the glass pieces to be cut and all the glass original sheets. The initial population P comprises N individuals, N is more than or equal to 100, for example, the number of the individuals in the initial population can be 100. In the multi-objective evolutionary algorithm, the number of individuals in the initial population is generally greater than or equal to 100, and the diversity of the population is guaranteed as much as possible, for example, 100 or 200 individuals are taken. Each individual represents a solution representing a composition of a plurality of glass pieces to be cut on a glass master.
Each individual is represented by a special polish expression, assuming that one of the individual encoding modes is as exemplified in table 1 (assuming that only glass to be cut is No. 1, No. 2, No. 3):
TABLE 1 Individual encoding modes (examples)
The first row 1,2, 3 represents glass No. 1,2, 3, respectively. -1, -2 represent vertical and horizontal alignment, respectively.
The suffix expression in the first row of the table is first converted into a binary tree.
The conversion method is as follows, for the first row 1,2, 3, -1, -2 sequence in the table, first initialize an empty stack containing 5 (and the length of the sequence is consistent) storage spaces. And scanning the first parameter, and if the first parameter is the parameters No. 1, No. 2 and No. 3 which represent the glass serial number, pushing the stack (the stack is a concept in the data structure), and continuing to scan the next element. If the parameter is-1 and-2, the two elements are popped from the stack to form a subtree. For example, for the sequence of the first row in the above table, scan 1, push, scan 2, push, scan 3, push. Scanning to-1, popping up two elements of 3 and 2 to form a subtree, wherein the popped element is taken as a right subtree firstly, and the popped element is taken as a left subtree secondly. -1 represents the first glass No. 3 ejected (-right subtree of 1) arranged vertically below the second glass No. 2 ejected (-left subtree of 1), and the whole formed by the glass No. 3 and the glass No. 2 is pressed into the stack. Scanning is continued, and a whole formed by popping the glass No. 3 and the glass No. 2 (-the right subtree of 2) and the glass No. 1 (-the left subtree of 2) are scanned to-2, and the whole formed by popping the glass No. 3 and the glass No. 2 is horizontally arranged on the right side of the glass No. 1 popped later.
The data 1 and 2 in the second row respectively represent that the corresponding glass in the first row is horizontally or vertically arranged. 6, 7 represent the alignment of the glass currently to be handled (as explained below) with the previous glass, 6 represents the alignment along the upper or left edge, and 7 represents the alignment along the right or lower edge, respectively.
For example, the first row of the table, 1,2, 3, -1, -2, corresponds to the second row, 1,2, 1, 6, respectively. The first row 1 in the table corresponds to the second row 1 and indicates that the No. 1 glass is placed vertically. The first row 2 corresponds to the second row 2 and indicates that No. 2 glass is laid horizontally. The first row 3 corresponds to the second row 1 and represents the vertical placement of glass No. 3. Combining the table with the above converted binary tree, the first row-1 corresponds to the second row 6, -1, which represents the right subtree No. 3 glass vertically arranged below the left subtree No. 2 glass. And 6 denotes the right subtree No. 3 glass of-1 is aligned along the left edge with the left subtree No. 2 glass (vertical alignment is aligned along the left edge and horizontal alignment is aligned along the top edge). The first row-2 corresponds to the second row 6-2 and represents the right subtree (glass nos. 3 and 2 as a whole) arranged to the right of glass No. 1 of the left subtree. And 6 represents that the right subtree (glass integer No. 3 and 2) is aligned along the upper edge.
Step 103: and determining the size of the largest rectangle in the glass waste corresponding to each glass original sheet according to the sizes and the number of all the glass pieces to be cut and all the glass original sheets. The dimensions of the largest rectangle include the length and width of the largest rectangle. After each glass sheet is typeset according to the corresponding typesetting mode, the residual glass waste can be cut into different rectangles. The area of the largest rectangle among these different rectangles is gi。giLarger means larger maximum area of the waste material which can be cut, and the waste material with the maximum area can be used as the glass raw material of a small-sized workpiece to be cut and reused later, so giThe larger the waste, the larger the reusable area of the waste.
Step 104: all individuals in the starting population are stratified according to the size and number of all the glass pieces to be cut and all the glass master pieces and the size of the largest rectangle in each glass waste. Each layer comprises a plurality of individuals, and the excellence of the individual with the low layer number is higher than that of the individual with the high layer number.
The layering step is specifically as follows:
(1) using the function f according to the sizes and quantities of all the glass pieces to be cut and of all the glass masters1(i)=(Li+Wi) /1000 determining a first target value f for the ith individual1(i) (ii) a Wherein i is more than or equal to 1 and less than or equal to N, LiShowing that after the typesetting is finished according to the ith individual, the length of the glass piece to be cut exceeding the length boundary of the glass original is L when the length does not exceediEqual to 0; wiAfter the typesetting is finished according to the ith individual, the length of the glass piece to be cut exceeding the width boundary of the glass original is calculated, and when the width does not exceed the length, the WiEqual to 0. If the typesetting method represented by a certain individual code has the length and the width exceeding the boundary of the glass original sheet, the first target value of the individual is larger, and the length and the width exceeding the boundary of the glass original sheet are smaller, the first target value of the individual is smaller. If the first target value is 0, the glass typesetting method represented by the individual is not out of the boundary, and the actual requirement is met。
(2) Using functions based on the size and number of all glass pieces to be cut and all glass blanks
Determining a second target value f for the ith individual
2(i) (ii) a Wherein S is the area of the glass original sheet corresponding to the ith individual, l
jLength of the jth glass piece to be cut, w, for the ith individual
jThe width of the jth glass piece to be cut corresponding to the ith individual. If the size of the glass piece to be cut exceeds the area of the original glass piece after typesetting is finished, setting the second target value of the individual as 1, and indicating that the typesetting method represented by the individual does not meet the actual requirement; otherwise, the result is calculated according to the function.
The utilization rate of the single glass original sheet is represented, and the higher the utilization rate of the single glass original sheet of the typesetting method represented by the individual is, the smaller the second target value is. The lower the utilization rate of a single glass original sheet of the typesetting method represented by the individual is, the larger the second target value is.
(3) Using the function according to the size of the largest rectangle in each glass waste
Determining a third target value f for the ith individual
3(i) (ii) a Wherein, g
iThe area of the largest rectangle in the glass waste corresponding to the ith individual. If the typesetting mode represented by the individual code exceeds the size of the original glass sheet after the typesetting is finished, setting the individual third target value as 1; otherwise, the result is calculated according to the function.
The proportion of the reusable area in the waste material to the glass original sheet is represented, the smaller the third target value of the individual is, the larger the proportion of the reusable area in the waste material to the glass original sheet is represented, and the larger the third target value of the individual is, the larger the proportion of the reusable area in the waste material to the glass original sheet is representedIs small.
(4) Determining the excellence of each individual according to the first target value, the second target value and the third target value of each individual. Excellence of each individual (f)1(i),f2(i),f3(i) Is) is shown. In the multi-objective evolutionary algorithm, when the A individuals are superior to the B individuals, the A individuals dominate the B, and the A dominates the B for short. Assuming that the individual A has two target values of 1 and 2, denoted A (1,2), and the individual B has two target values, denoted B (3,4), it can be observed that the two target values of A are smaller than the two target values of B, respectively, so that A dominates (Pareto dominates) B, and B is dominated by A, i.e. the excellence of A is higher than that of B. Assuming that the two individuals are A (2,4) and B (2,5), respectively, then the A individual has only a second sub-goal superior to the B individual, the first sub-goal being the same as the B individual, which is also referred to as the A individual dominating the B individual. Assuming that A (1,7) and B (2,5), it can be seen that the first sub-standard of the A individuals is better than the B individuals, and the second sub-standard is worse than the B individuals, the A individuals and the B individuals are mutually independent.
(5) Determining variables and sets corresponding to each individual according to the excellence of each individual; the variable is the number of individuals with the superiority higher than that of the current individual in the initial population, and the set is the number of individuals with the superiority lower than that of the current individual in the initial population. Assuming that the current individual is the individual No. 1, the variable N of the individual No. 1 represents the number of individuals dominating the current individual, and is a number, namely representing how many individuals from the individual No. 2 to the individual No. N dominate the individual No. 1 (how many individuals are superior to the individual No. 1). S represents a set, the S set of the No. 1 individual represents the No. 2 individual to the No. N individual, which individuals are dominated by the No. 1 individual (which individuals are worse than the No. 1 individual), and the serial numbers of the individuals dominated by the No. 1 individual are stored in the S set of the No. 1 individual.
(6) And layering according to the variable and the set corresponding to each individual. The specific process is as follows:
for the ith individual, judging whether a variable k of the ith individual is equal to 0 or not to obtain a first judgment result;
when the first judgment result indicates that the variable k of the ith individual is equal to 0, determining the ith individual as the individual of the mth layer; m is more than or equal to 1;
when the first judgment result shows that the variable k of the ith individual is not equal to 0, judging whether an individual with the excellence degree larger than that of the ith individual exists in the (m-1) th layer or not, and obtaining a second judgment result;
when the second judgment result indicates that an individual with the excellence degree larger than that of the ith individual exists in the m-1 th layer, updating the variable of the ith individual to be k-1;
judging whether the variable k-1 after the ith individual is updated is equal to 0 or not to obtain a third judgment result;
when the third judgment result shows that the variable k-1 after the update of the ith individual is equal to 0, determining the ith individual as the individual at the m +1 th layer;
when the third judgment result shows that the variable k-1 after the update of the ith individual is not equal to 0, judging whether an individual with the excellence degree larger than that of the ith individual exists in the mth layer;
all individuals were stratified sequentially.
For example, determination of first tier individuals: firstly, judging whether n of each individual in the population is equal to 0, if yes, determining that the individual is a first-layer non-dominant individual. The variable for each individual represents the number of individuals in the current population that are superior to the current individual. If the value of the variable for the current individual is 0, indicating that no other individual in the current population is superior to the current individual, then the current individual is one of the top-ranked individuals. In the initial population, each individual has its own variable value after comparing the dominant relationship two by two. Judging the variable value of each individual, if the value is 0, indicating that the individual is excellent and is not dominated by any other individual, separating the individual from the population, and putting the individual into a set, wherein the set formed by all the individuals of which the variable value is 0 in the population is the set of the first-layer non-dominated individuals.
Determination of second floor individuals: separating the first layer of non-dominant individuals in the initial population, finding out the individuals dominated by the first layer of individuals in the rest individuals, assuming that the individuals are No. 15, No. 19 and No. 28, respectively reducing the variable values of the 3 individuals by one, which means that after the first layer of non-dominant individuals are separated from the population, the individuals dominated by No. 15, No. 19 and No. 28 in the current population are reduced by one. And then continuously judging whether the variable values of all the rest individuals in the population are equal to 0, if so, determining that the population is the second layer of non-dominant individuals. Repeating the steps until all the individual layers are finished.
After the initial population is layered, each individual belongs to a certain level. The individuals belonging to the first tier are the most elegant set of individuals in the overall population. The individuals in the second layer are the group consisting of the most excellent individuals in the population except the individuals in the first layer, and by analogy, the lower-level individuals are more excellent.
Step 105: the aggregate distance of each individual in each layer is obtained. The aggregate distance of each individual represents the distance between the individual and the surrounding individuals (within the same layer). The greater the focus distance, the further away the individual is from the surrounding individuals. The smaller the focus distance, the closer the individual is to the surrounding individuals. The aggregate distance for each individual is calculated to maintain the individual's distribution. For example, when vegetable seeds are sown, the seeds are sown on the vegetable field uniformly for better growth of each seed, but not all the seeds are sown in a small area. In the multi-objective evolutionary algorithm, the most excellent individuals in the population can be obtained finally, but not one individual. The individuals are independent of each other (equally good), so we want the individuals to be evenly distributed over all the best solutions, rather than concentrated at one point. The specific formula is as follows:
in the formula, P [ i]
dis tan ceIs the aggregation distance of individual i, P [ i]K is the function value of the individual i on the sub-target k. r represents the number of targets. When calculating the aggregation distance of each individual, the groups need to be arranged in descending order according to each sub-objective function value.
Step 106: and screening M individuals in the initial population according to the aggregation distance and the number of layers of each individual in the initial population. M is more than 1 and less than N. The screening process employs tournament selection. The specific process is as follows:
n individuals were randomly selected from the initial population (n > 1; n in the algorithm was 2). And (3) finding out the most excellent individuals (namely the individuals with the smallest level, if a plurality of individuals exist in the same level, finding the individuals with the largest aggregation distance) from the n individuals, entering a matching pool, and repeating the current operation until the matching pool is full.
Tournament selection is performed to place more excellent individuals in the population into the matching pool (very excellent individuals may be placed into the matching pool multiple times), while poor performing individuals may have difficulty entering the matching pool. The offspring generated by crossing and mutation of excellent individuals has higher probability to become more excellent.
Step 107: and (5) crossing and mutating the M individuals to generate a mutated population Q. The varied population Q comprises M crossed and varied individuals. Crossing the 2q-1 individual and the 2q individual by adopting a single-point crossing method to obtain two crossed individuals;
performing exchange variation on the two crossed individuals to obtain two varied individuals; and obtaining all mutated individuals in turn. For example, there are 100 individuals in the matching pool, and the 100 individuals are numbered sequentially No. 1, No. 2. And sequentially selecting individuals No. 1 and No. 2 for crossing and mutation to generate two new individuals, assuming that the individuals A and B are the individuals A and B, putting the individuals A and B into the population Q, then continuously and sequentially selecting the individuals No. 3 and No. 4 to generate the individuals C and D, and repeating the operations until 100 new individuals are generated and put into the population Q.
Step 108: and combining the initial population and the varied population to generate a population R. Here, the initial population P includes 100 individuals, and the population Q includes 100 individuals. The initial population P (100 individuals) and the sub-population Q (100 individuals) are combined into a large set R (200 individuals), so as to select excellent individuals (most excellent 100 individuals) in the large set of R (200 individuals) to form a new P (100 individuals) population.
Step 109: individuals in the population R are stratified. The layering is performed in the layered manner of step 104.
Step 1010: and (4) screening N individuals with highest excellence according to the layering result of the population R. Taking the example of an R population being a population with 200 individuals, each individual is assigned to a respective level according to the method of stratification in step 104. The lower the hierarchy, the better the rank, and 100 individuals were selected from 200, the most excellent. Firstly, selecting the individuals of the first layer, adding the individuals into a new total group P, if the number of the individuals of the second layer does not exceed 100, continuing to add the individuals into the new total group P, and if the number of the individuals of a certain layer exceeds 100 after the individuals of the layer are added into the new group P, adding the individuals with large aggregation distance in the layer into the new group P, so that the number of the total individuals in the new group is just 100.
Whether the stopping condition is met or not needs to be judged, and the method specifically comprises the following steps:
obtaining iteration times;
judging whether the current iteration reaches the iteration times to obtain a fifth judgment result;
when the fifth judgment result shows that the current iteration reaches the iteration number, ending the iteration, and determining the N individuals with the highest screening excellence degree as the N finally output individuals;
and when the fifth judgment result shows that the current iteration does not reach the iteration number, updating the N individuals with the highest screening excellence degree into an initial population, returning to the step 104, and continuing the iteration.
Step 1011: and determining the N individuals as the glass typesetting forms to be selected by the user.
The invention adopts the NSGA-II algorithm in the multi-objective evolutionary algorithm, the process that the initial population finishes the NSGA-II algorithm after being executed for one time is the population iteration for one time, when the population iterates to the appointed times (for example, 500 generations), the program is ended, and the individuals meeting the requirements in the population are output.
FIG. 2 is a schematic diagram of the glass composition determining system according to the present invention. As shown in fig. 2, the system includes:
the parameter acquisition module 201 is used for acquiring the sizes and the number of all glass pieces to be cut and all glass original sheets, wherein the sizes comprise lengths and widths;
the initial population generating module 202 is used for randomly generating an initial population P according to the sizes and the numbers of all glass pieces to be cut and all glass original sheets, wherein the initial population P comprises N individuals, N is more than or equal to 100, and each individual is a typesetting form of a plurality of glass pieces to be cut on one glass original sheet;
the size determining module 203 for the largest rectangle in the glass waste is used for determining the size of the largest rectangle in the glass waste corresponding to each glass original sheet according to the sizes and the number of all glass pieces to be cut and all glass original sheets, wherein the size of the largest rectangle comprises the length and the width of the largest rectangle;
a layering module 204, configured to layer all N individuals in the initial population according to the sizes and the numbers of all to-be-cut glass pieces and all glass original sheets and the size of the largest rectangle in each glass waste, where each layer includes multiple individuals, and the excellence of an individual with a low layer number is higher than that of an individual with a high layer number;
an aggregation distance obtaining module 205, configured to obtain an aggregation distance of each individual in each layer;
a first screening module 206, configured to screen out M individuals in the initial population according to the aggregation distance and the number of layers of each individual in the initial population; m is more than 1 and less than N;
a varied population generating module 207, configured to intersect and vary the M individuals to generate a varied population Q, where the varied population Q includes M intersected and varied individuals;
a population merging module 208, configured to merge the initial population P and the varied population Q to generate a population R;
a layering module 204, configured to layer all individuals in the population R;
a second screening module 209, configured to screen N individuals with the highest excellence according to the stratification result of the population R;
a determining module 2010, configured to determine the N individuals as the glass composition forms to be selected by the user.
The layering module 204 specifically includes:
a first target value determining unit for determining the size and number of all glass pieces to be cut and all glass original sheets by using the function f1(i)=(Li+Wi) /1000 determining a first target value f for the ith individual1(i) (ii) a Wherein i is more than or equal to 1 and less than or equal to N, LiShowing the length of the glass piece to be cut exceeding the length boundary of the glass original after the typesetting is finished according to the ith individual, WiThe length of the glass piece to be cut exceeding the width boundary of the glass original after the typesetting is finished according to the ith individual;
a second target value determining unit for determining the size and number of all the glass pieces to be cut and all the glass original sheets by using the function
Determining a second target value f for the ith individual
2(i) (ii) a Wherein S is the area of the glass original sheet corresponding to the ith individual, l
jLength of the jth glass piece to be cut, w, for the ith individual
jThe width of the jth glass piece to be cut corresponding to the ith individual;
a third target value determination unit for utilizing the function according to the size of the largest rectangle in each glass waste material
Determining a third target value f for the ith individual
3(i) (ii) a Wherein, g
iThe area of the largest rectangle in the glass waste corresponding to the ith individual;
a goodness of merit determination unit for determining the goodness of merit for each individual based on the first target value, the second target value, and the third target value for each individual;
the variable and set determining unit is used for determining the variable and set corresponding to each individual according to the excellence degree of each individual; the variable is the number of individuals with the excellence degree higher than that of the current individual in the initial population, and the set is the set of the numbers of the individuals with the excellence degree lower than that of the current individual in the initial population;
and the layering unit performs layering according to the variable and the set corresponding to each individual.
The hierarchical unit specifically includes:
the first judgment subunit is configured to, for an ith individual, judge whether a variable k of the ith individual is equal to 0, and obtain a first judgment result;
an individual determination subunit, configured to determine the ith individual as an individual of the mth layer when the first determination result indicates that the variable k of the ith individual is equal to 0; m is more than or equal to 1;
a second judging subunit, configured to, when the first judgment result indicates that the variable k of the ith individual is not equal to 0, judge whether there is an individual with a degree of excellence greater than that of the ith individual in the m-1 th layer, and obtain a second judgment result;
a variable updating subunit, configured to update the variable of the ith individual to k-1 when the second determination result indicates that there is an individual with a degree of excellence greater than the degree of excellence of the ith individual in the m-1 th layer;
a third judging subunit, configured to judge whether the updated variable k-1 of the ith individual is equal to 0, so as to obtain a third judgment result;
the individual determining subunit is further configured to determine the ith individual as an individual at the m +1 th layer when the third determination result indicates that the updated variable k-1 of the ith individual is equal to 0;
a second determining subunit, configured to determine whether there is an individual with a degree of excellence greater than that of the ith individual in the mth layer when the third determination result indicates that the updated variable k-1 of the ith individual is not equal to 0;
all individuals were stratified sequentially.
The first screening module specifically comprises:
an individual selecting unit for randomly selecting n individuals from the initial population; n is more than 1;
the number of layers obtaining unit is used for obtaining the individual with the lowest number of layers in the n individuals;
a fourth judging unit, configured to judge whether the individual with the lowest number of layers includes multiple individuals, and obtain a fourth judgment result;
an aggregation distance determining unit configured to determine, when the fourth determination result indicates that the individual with the lowest number of layers includes a plurality of individuals, an individual with a largest aggregation distance among the plurality of individuals;
an individual determination unit, configured to determine the individual with the largest aggregation distance as one individual of the screened M individuals;
and the individual determining unit is further used for determining the individual with the lowest layer number as one of the screened M individuals when the fourth judgment result shows that the individuals with the lowest layer number do not comprise a plurality of individuals.