CPC G06F 30/27 (2020.01) [G06F 30/13 (2020.01); G06F 2111/06 (2020.01)] | 13 Claims |
1. A layout method based on a genetic algorithm, comprising:
determining a gene code mode based on standard part information and layout part information;
generating an initial population based on the gene code mode, the initial population comprising a plurality of gene codes, and the plurality of gene codes comprising standard code segments and layout code segments, and corresponding to layout schemes of standard parts and layout parts;
acquiring fitness of each of the plurality of gene codes;
based on the fitness, determining the gene code corresponding to the fitness meeting a preset requirement as a dominant gene code, wherein sequencing the gene codes of the initial population according to the fitness of each of the plurality of gene codes to obtain a gene code sequence; determining the gene code with highest fitness in the gene code sequence as the dominant gene code; or determining the gene code with the fitness higher than a preset threshold in the gene code sequence as the dominant gene code;
performing a double-point crossing operation and a double-point mutation operation on the dominant gene code to generate a next generation gene code, so as to form a dominant population; and
if a preset termination condition is met, determining the layout scheme corresponding to the dominant gene code in the dominant population as a target layout scheme;
wherein the determining the gene code mode based on the standard part information and the layout part information comprises:
determining a code mode of the standard code segment based on the standard part information, the standard part information comprising at least a standard part category and a standard part size, and the standard code segment comprising a number of codes and a code order;
determining a code mode of the layout code segment based on the layout part information, the layout part information comprising at least a layout part category and a layout part size, and the layout code segment comprising a number of codes and a code order; and
determining the gene code mode based on the code mode of the standard code segment and the code mode of the layout code segment;
wherein the standard part information further comprises priorities of the standard parts, and the determining the code mode of the standard code segment based on the standard part information comprises:
determining the number of codes of the standard code segment based on the standard part category;
for the standard parts with priorities, sequentially determining the codes at corresponding positions in the standard code segment according to the priorities of the standard parts, and the codes are kept unchanged in a subsequent process; and
for the standard parts without priorities, randomly determining the codes at corresponding positions in the standard code segment;
wherein the performing the double-point crossing operation and the double-point mutation operation on the dominant gene code to generate the next generation gene code, so as to form the dominant population comprises:
determining at least two positions of the standard code segment in a first one dominant gene code and corresponding positions of the standard code segment in a second one dominant gene code as standard segment crossing positions, and meanwhile determining at least two positions of the layout code segment in the first one dominant gene code and corresponding positions of the layout code segment in the second one dominant gene code as layout segment crossing positions; wherein when no priority is specified in the standard code segment, the standard segment crossing positions are allowed to be randomly selected in the standard code segment; when a priority is specified in the standard code segment, a code position with the priority is not subjected to the crossing operation, and the standard segment crossing positions are randomly selected from other positions of the standard code segment;
exchanging the codes at the standard segment crossing positions of the at least two dominant gene codes, and meanwhile exchanging the codes at the layout segment crossing positions of the at least two dominant gene codes, so as to obtain a crossing gene code;
determining the at least two positions of the standard code segment in the crossing gene code as standard segment mutation positions, and meanwhile determining the at least two positions of the layout code segment in the crossing gene code as layout segment mutation positions; wherein when no priority is specified in the standard code segment, the standard segment mutation positions are allowed to be randomly selected in the standard code segment; when a priority is specified in the standard code segment, a code position with the priority is not subjected to the mutation operation, and the standard segment mutation positions are randomly selected from other positions of the standard code segment;
exchanging the codes of the standard segment mutation positions of the crossing gene code, and meanwhile exchanging the codes of the layout segment mutation positions of the crossing gene code, so as to obtain the next generation gene code; and
constructing the dominant population according to the dominant gene code and the next generation gene code.
|