Multi-population optimization system and method based on GPU parallel improved genetic algorithm
By parallel processing of genetic algorithms on GPUs, traditional genetic algorithms are solved by solving the problems of local optimization and inefficiency in complex optimization problems, and a more efficient and diverse optimization solution is achieved.
Patent Information
- Application Number
- CN202411675785.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-03-18
AI Technical Summary
Traditional genetic algorithms are prone to fall into local optimization when dealing with complex optimization problems and are less efficient in large-scale data operations.
A multi-group optimization system for genetic algorithm based on parallel improvement of GPU is designed. Through modules such as population initialization, parallel selection, parallel crossover, parallel variation, fitness calculation, migration and communication, adaptive parameter adjustment and termination judgment, the execution of the algorithm is accelerated using the parallel processing capabilities of the GPU.
It significantly improves the execution efficiency of the algorithm, enhances individual diversity, avoids the algorithm from falling into local optimization, and improves the adaptability to different problems.
Smart Images

Figure CN119647563A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of genetic algorithms, and in particular to a multi-population optimization system and method based on a GPU parallel improved genetic algorithm. Background Art
[0002] Traditional genetic algorithms are prone to fall into local optimality when dealing with complex optimization problems, and are inefficient in large-scale data operations. In order to improve the global search capability and operational efficiency of genetic algorithms, a multi-population evolution algorithm is proposed, which divides the population into multiple sub-populations for parallel evolution, thereby enhancing population diversity. However, with the increase in data volume and problem scale, the algorithm's operational speed and efficiency remain a challenge. Therefore, it is necessary to design a multi-population optimization system and method based on GPU parallel improved genetic algorithm. Summary of the invention
[0003] In order to overcome the deficiencies of the prior art, the object of the present invention is to provide a multi-population optimization system and method based on a GPU parallel improved genetic algorithm.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] The present invention provides a multi-population optimization system based on GPU parallel improved genetic algorithm, comprising:
[0006] The population initialization module is used to generate the initial population in the CPU, divide it into several sub-populations and transfer them to the GPU storage;
[0007] Parallel selection module, used to implement population selection operation on GPU, selecting parent individuals based on fitness distribution;
[0008] The parallel crossover module is used to perform crossover operations in parallel on the GPU to generate new individuals;
[0009] Parallel mutation module, used to implement mutation operations on GPU;
[0010] The fitness calculation module is used to calculate the fitness function value of each individual in parallel by GPU and feed it back to the main storage;
[0011] Migration and communication module, used to realize migration and information exchange between subpopulations on GPU;
[0012] An adaptive parameter adjustment module is used to adjust the crossover rate and mutation rate of subpopulations according to the evolutionary status of subpopulations;
[0013] The termination judgment module is used to judge the termination condition of the algorithm on the CPU side. If it is met, the optimal solution is output, otherwise the loop continues;
[0014] The output module is used to transfer the final optimal solution and its fitness function value from the GPU storage to the CPU;
[0015] The display module is used to display the final optimal solution as a visual graph or optimization data.
[0016] The present invention also provides a multi-population optimization method based on GPU parallel improved genetic algorithm, comprising:
[0017] Step 100: Generate an initial population in the CPU based on the population initialization module, divide it into several sub-populations and transmit them to the GPU storage;
[0018] Step 200: Calculate the fitness function value of each individual of each subpopulation based on the fitness calculation module;
[0019] Step 300: Implementing a population selection operation on the GPU based on a parallel selection module, and selecting a parent individual based on fitness distribution;
[0020] Step 400: performing crossover operations in parallel on the GPU based on the parallel crossover module to generate new individuals;
[0021] Step 500: Implementing a mutation operation on a GPU based on a parallel mutation module;
[0022] Step 600: Implementing migration and information exchange between subpopulations on the GPU based on the migration and communication module;
[0023] Step 700: adjusting the crossover rate and mutation rate of the subpopulation according to the evolutionary state of the subpopulation based on the adaptive parameter adjustment module;
[0024] Step 800: Based on the termination judgment module, the algorithm termination condition is judged on the CPU side. If it is satisfied, the optimal solution is output, otherwise the cycle continues;
[0025] Step 900: transferring the final optimal solution and its fitness function value from the GPU storage to the CPU based on the output module;
[0026] Step 1000: Based on the display module, the final optimal solution is displayed as a visual graph or optimized data.
[0027] Preferably, in step 100, an initial population is generated in the CPU based on the population initialization module, and the initial population is divided into several sub-populations and then transmitted to the GPU for storage, specifically:
[0028] Based on the population initialization module, an initial population is generated in the CPU and divided into multiple subpopulations according to a preset partitioning strategy. The initial population and subpopulation division method are adjusted according to the scale of the specific problem and the GPU hardware configuration. The generated multiple subpopulation data are transferred to the GPU memory, and ensure that each subpopulation is stored in an independent memory area.
[0029] Preferably, in step 200, the fitness function value of each individual of each subpopulation is calculated based on the fitness calculation module, specifically:
[0030] The fitness function is determined according to the corresponding system, and the fitness function value of the corresponding subpopulation is calculated in each thread block of the GPU based on the fitness function based on the fitness calculation module. For complex fitness functions, multiple threads are allocated based on the CUDA kernel to complete them collaboratively.
[0031] Preferably, in step 300, a population selection operation is implemented on a GPU based on a parallel selection module, and a parent individual is selected based on fitness distribution, specifically:
[0032] Based on the parallel quick sorting algorithm, the individuals in each subpopulation are sorted according to the fitness function value;
[0033] Based on the improved roulette and tournament selection algorithm, individuals with higher fitness function values in each subpopulation are selected as parents in the subpopulation.
[0034] Preferably, in step 400, crossover operations are performed in parallel on the GPU based on the parallel crossover module to generate new individuals, specifically:
[0035] Based on the parallel crossover module, arithmetic crossover operator and single-point crossover operator are used to perform crossover operations on the real number code and integer code in each subpopulation to generate new offspring individuals.
[0036] Preferably, in step 500, the mutation operation is implemented on the GPU based on the parallel mutation module, specifically:
[0037] Based on the parallel mutation module, real number codes are uniformly mutated on the GPU, and integer codes are randomly mutated.
[0038] Preferably, in step 600, migration and information exchange between subpopulations are implemented on the GPU based on the migration and communication module, specifically:
[0039] Based on the migration and communication module, the migration operation is performed on the GPU. The best individual of the jth subpopulation is forced to mutate and replace the worst individual in the j+1th subpopulation. The best individual of the qth subpopulation is forced to mutate and replace the worst individual in the 1st subpopulation, where 1≤j≤q-1, q is the total number of subpopulations.
[0040] During the migration operation, global information exchange is performed to broadcast the optimal solution in each subpopulation to other subpopulations;
[0041] Among them, the migration operation and the communication operation are performed asynchronously.
[0042] Preferably, in step 800, the algorithm termination condition is judged on the CPU side based on the termination judgment module, specifically:
[0043] The algorithm termination condition is judged on the CPU side based on the termination judgment module, where the termination condition is to satisfy the maximum evolutionary generation and the maximum continuous generation of the optimal individual of the subpopulation.
[0044] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0045] The present invention provides a multi-population optimization system and method based on GPU parallel improved genetic algorithm, the method includes generating an initial population in a CPU based on a population initialization module, dividing the initial population into several subpopulations and then transmitting them to GPU storage, calculating the fitness function value of each individual of each subpopulation based on a fitness calculation module, implementing population selection operation on GPU based on a parallel selection module, selecting parent individuals based on fitness allocation, performing crossover operation in parallel on GPU based on a parallel crossover module to generate new individuals, implementing mutation operation on GPU based on a parallel mutation module, implementing migration and information exchange between subpopulations on GPU based on a migration and communication module, adjusting the crossover rate and mutation rate of subpopulations according to the evolutionary state of subpopulations based on an adaptive parameter adjustment module, performing algorithm termination condition judgment on the CPU side based on a termination judgment module, outputting the optimal solution if satisfied, otherwise continuing the cycle, transmitting the final optimal solution and its fitness function value from GPU storage to CPU based on an output module, and displaying the final optimal solution as a visual graph or optimized data based on a display module. The present invention includes the following advantages:
[0046] 1. Computing acceleration: GPU parallel processing capabilities are used to enable the selection, crossover, mutation and fitness calculation of a large number of individuals in the population evolution process to be completed in parallel, thereby greatly improving the execution efficiency of the algorithm;
[0047] 2. Diversity maintenance: Multiple populations and migration mechanisms enhance individual diversity, helping to prevent the algorithm from falling into local optimality;
[0048] 3. Enhanced adaptability: Through the adaptive parameter adjustment mechanism, the algorithm’s adaptability to different problems is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0050] Figure 1 A flow chart of a method provided by an embodiment of the present invention;
[0051] Figure 2 Schematic diagram of crossover operation. DETAILED DESCRIPTION
[0052] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] The purpose of the present invention is to provide a multi-population optimization system and method based on GPU parallel improved genetic algorithm, which can utilize the powerful parallel computing capability of GPU to accelerate the execution process of multi-population genetic algorithm and realize the rapid solution of large-scale complex problems.
[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0055] The present invention provides a multi-population optimization system based on GPU parallel improved genetic algorithm, comprising:
[0056] The population initialization module is used to generate the initial population in the CPU, divide it into several sub-populations and transfer them to the GPU storage;
[0057] Parallel selection module, used to implement population selection operation on GPU, selecting parent individuals based on fitness distribution;
[0058] The parallel crossover module is used to perform crossover operations in parallel on the GPU to generate new individuals;
[0059] Parallel mutation module, used to implement mutation operations on GPU;
[0060] The fitness calculation module is used to calculate the fitness function value of each individual in parallel by GPU and feed it back to the main storage;
[0061] Migration and communication module, used to realize migration and information exchange between subpopulations on GPU;
[0062] An adaptive parameter adjustment module is used to adjust the crossover rate and mutation rate of subpopulations according to the evolutionary status of subpopulations;
[0063] The termination judgment module is used to judge the termination condition of the algorithm on the CPU side. If it is met, the optimal solution is output, otherwise the loop continues;
[0064] The output module is used to transfer the final optimal solution and its fitness function value from the GPU storage to the CPU;
[0065] The display module is used to display the final optimal solution as a visual graph or optimization data.
[0066] like Figure 1 As shown, the present invention also provides a multi-population optimization method based on GPU parallel improved genetic algorithm, including:
[0067] Step 100: Generate an initial population in the CPU based on the population initialization module, divide it into several sub-populations and transmit them to the GPU storage;
[0068] Step 200: Calculate the fitness function value of each individual of each subpopulation based on the fitness calculation module;
[0069] Step 300: Implementing a population selection operation on the GPU based on a parallel selection module, and selecting a parent individual based on fitness distribution;
[0070] Step 400: performing crossover operations in parallel on the GPU based on the parallel crossover module to generate new individuals;
[0071] Step 500: Implementing a mutation operation on a GPU based on a parallel mutation module;
[0072] Step 600: Implementing migration and information exchange between subpopulations on the GPU based on the migration and communication module;
[0073] Step 700: adjusting the crossover rate and mutation rate of the subpopulation according to the evolutionary state of the subpopulation based on the adaptive parameter adjustment module;
[0074] Step 800: Based on the termination judgment module, the algorithm termination condition is judged on the CPU side. If it is satisfied, the optimal solution is output, otherwise the cycle continues;
[0075] Step 900: transferring the final optimal solution and its fitness function value from the GPU storage to the CPU based on the output module;
[0076] Step 1000: Based on the display module, the final optimal solution is displayed as a visual graph or optimized data.
[0077] In step 100, an initial population is generated in the CPU based on the population initialization module, which is divided into several sub-populations and then transmitted to the GPU for storage, specifically:
[0078] Based on the population initialization module, an initial population is generated in the CPU, and it is divided into multiple subpopulations according to a preset partitioning strategy. The initial population and the subpopulation division method are adjusted according to the scale of the specific problem and the GPU hardware configuration. The generated multiple subpopulation data are transmitted to the GPU memory, and it is ensured that each subpopulation is stored in an independent memory area to avoid cross-region thread interference.
[0079] In step 200, the fitness function value of each individual of each subpopulation is calculated based on the fitness calculation module, specifically:
[0080] It should be noted that the genetic algorithm uses fitness to measure the degree to which each individual in the population reaches or approaches the optimal solution in the optimization analysis. In the genetic algorithm, the function that measures the fitness of an individual is the fitness function. The value of the fitness function should always be non-negative, and the larger the better;
[0081] The fitness function is determined according to the corresponding system, and the fitness function value of the corresponding subpopulation is calculated in each thread block of the GPU based on the fitness function based on the fitness calculation module. For complex fitness functions, multiple threads are allocated based on the CUDA kernel to complete them collaboratively.
[0082] In step 300, a population selection operation is implemented on the GPU based on a parallel selection module, and a parent individual is selected based on fitness distribution, specifically:
[0083] Based on the parallel quick sorting algorithm, the individuals in each subpopulation are sorted according to the fitness function value;
[0084] Introduce the parallel quick sort algorithm:
[0085] (I) Designing the partitioning function
[0086] An unsorted array a=a 0 , a 1 , …, a n-1 The pivot point is divided into two independent sub-arrays. The pivot point position is determined by the MedianOfThree() function, rather than simply using the first element as the pivot point like the general quick sort function, nor is the pivot point randomly selected, because this method may also reduce the time complexity of quick sort to O(n) in the worst case. 2The basic approach of the MeanOfThree method is to use the median of the three elements at the leftmost, rightmost and center positions as the pivot element. The implementation code of the MeanOfThree method is as follows:
[0087]
[0088] First, in order to obtain the center position subscript, a right shift operation is used. This is because on most processors, the execution speed of the division instruction is slow, requiring about 30 clock cycles, while the shift operation only requires 1 or several clock cycles. Moreover, in the process of sorting large samples, a large number of subarrays need to be operated on three numbers, so the use of shift operations will greatly improve the program execution efficiency. Secondly, all the swap operations in the implementation code of the algorithm proposed by the present invention are implemented in the form of macro definition functions, that is, #defineSWAP(a, b){a=a+b;b=ab;a=ab}. This is because the swap operation is used in large quantities in the process of algorithm implementation. If it is implemented in the form of ordinary functions, every time the program flow executes to the swap function, in order to switch and protect the scene, the swap function will be pushed into the system stack, and after the execution is completed, it will be popped out of the system stack, and the processor stack operation will be repeatedly executed, while the macro function is only a text replacement on the source code file, without a process of switching and protecting the scene, so the execution efficiency of the code can be significantly improved.
[0089] After the reference point position p is determined, the left subarray on the left side of the reference point and the right subarray on the right side of the reference point are divided. Then the left and right subarrays will be divided into general subarrays in dual threads at the same time, using the same reference point ap. When the left and right subarray division operation is completed, the index position at the end of the division will be returned. The original array will be divided into four subarrays by the reference point and the left and right end indexes. The specific code implementation is as follows:
[0090]
[0091]
[0092] Among them, iL, iR, jL, jR represent the leftmost and rightmost subscripts of the left and right subarrays respectively, and the local variable d saves a copy of the reference point position p variable. The pragma compiler directive is used to instruct the compiler to perform OpenMP parallel programming. The total number of threads is 2. Because d needs to be mutually exclusive between the two threads, it is set as a thread private variable. In the two OpenMP tasks, the left and right subarrays are divided into four subarrays. id and jd save the position subscripts of the division end, which are used for the re-division of the left and right subarrays.
[0093] (II) Designing the Merge Function
[0094] First, after the division operation is completed, according to the characteristics of the division operation of the quick sort function, it can be known that the lengths of the second subarray (greater than the part) and the third subarray (less than or equal to the part) are not necessarily equal, and there may be three types of situations where the length is greater than, less than, and equal to. Therefore, before performing the exchange operation, the lengths of the two word arrays should be compared first, and different processing is performed according to the comparison results. Since the length calculation operation occurs frequently, in the algorithm proposed by the present invention, the operation of calculating the length of the array is also implemented using the macro function LEN to improve the code execution efficiency. The code is implemented as follows:
[0095] #define LEN(x,y)((y)-(x)+1)
[0096] Where x and y are the subscripts at both ends of the subarray, and y≥x. Taking one of the cases as an example, when the second subarray is shorter, the length to be exchanged should first be set to the length of the shorter subarray, and the element with the largest subscript in the longer subarray that exceeds the length should be exchanged with the reference point element, and the reference point position variable should be updated. A temporary local variable temp is then used to store the updated leftmost position of the third subarray. Subsequently, the exchange operation will be performed cyclically, starting from the leftmost position of the second subarray and the temp position at the same time, and the exchange operation of the two subarrays can be completed by performing length data exchanges cyclically. The other two cases are similar, and the implementation code is as follows:
[0097]
[0098] Among them, SIMD instructions are used in the loop operation. During the loop execution, multiple iterations will be executed in parallel using the processor's SIMD instruction set instructions. The compiler will treat this instruction as a comment. If the processor does not support it, SIMD will not affect the normal execution of the program.
[0099] (III) Qsort function
[0100] This function recursively implements the division and merging operations for each sub-array in the sorting process. The recursion ends when the size of each block is smaller than the cutting length variable u. The cutting length variable u is defined to prevent excessive division from affecting the overall performance of the sorting operation. According to the principle of quick sorting, for an array that is not large and has been divided, the speed is significantly improved by using the standard library quick sorting function to sort. The Qsort function implementation code is as follows:
[0101]
[0102] Among them, ParallelPartition only calls the partition operation and the merge operation in sequence, so I will not go into details. From the above code, we can see that when the length of a partition block is less than u, the program will recursively partition and merge the partition block until the length of the partition block is greater than or equal to u, then exit the recursion and sort the partition block using the standard library quick sort function.
[0103] Based on the improved roulette and tournament selection algorithm, individuals with higher fitness function values in each subpopulation are selected as the parents in the subpopulation;
[0104] Improved roulette and tournament selection algorithms: Roulette selection is a common selection operator, that is, the probability of each individual being selected is proportional to its fitness. It should be noted that the error of this selection method is large, and sometimes even individuals with high fitness are not selected. Tournament selection is to randomly select N individuals from the population each time (N is the competition size, generally 2), and the individual with the highest fitness is selected.
[0105] The present invention combines the above two selection strategies to form a new selection operator, that is, executing roulette selection twice, selecting a pair of individuals, comparing the fitness of the two individuals, and the individual with higher fitness is selected, and repeating this process until the selection is full.
[0106] In step 400, crossover operations are performed in parallel on the GPU based on the parallel crossover module to generate new individuals, specifically:
[0107] Based on the parallel crossover module, the real number code and integer code in each subpopulation are crossovered using arithmetic crossover operator and single-point crossover operator to generate new offspring individuals, specifically:
[0108] The present invention uses arithmetic crossover operator and single-point crossover operator to perform crossover operation on real number code and integer code respectively. Assuming that the lengths of real number code and integer code are L respectively 1 and L 2 (Encoding total L = L 1 +L 2 ), the randomly selected intersection point is L 0 (an integer in the range [1, L-1]). 0 ≥L 1 When a single-point crossover is performed, the two individuals L to be crossed are exchanged. 0 After the number locus (excluding L 0 )’s gene value, such as Figure 2 As shown in a. 0 <L 1 When the two individuals L to be crossed 0 +1 to L 1Perform arithmetic crossover on each locus and exchange L 1 After the number locus (excluding L 1 )’s gene value, such as Figure 2 As shown in b.
[0109] Figure 2 As shown in b, the control power matrix coefficient b A′ and b B′ First, the crossover operation is performed according to the improved arithmetic crossover operator:
[0110]
[0111] If the result calculated by the above formula exceeds the limit value of the control power weight matrix coefficient b, the crossover operation is performed according to the following arithmetic crossover operator:
[0112]
[0113] In the formula, c 1 =0.5+γ,c 2 =0.5-γ, where γ is a random number in the range [0,1] that conforms to the uniform distribution.
[0114] In step 500, the mutation operation is implemented on the GPU based on the parallel mutation module, specifically:
[0115] Based on the parallel mutation module, the real number code is uniformly mutated on the GPU, and the integer code is randomly mutated. Specifically:
[0116] Suppose the real number to be mutated is y, and its value range is [y min ,y max ], then the new gene value after uniform mutation is:
[0117] y′=y min +r·(y max -y min )
[0118] Where r is a random number in the range [0, 1] that conforms to a uniform distribution. In addition, the integer code randomly changes to a different integer in the range [1, n].
[0119] In step 600, migration and information exchange between subpopulations are implemented on the GPU based on the migration and communication module, specifically:
[0120] Based on the migration and communication module, the migration operation is performed on the GPU. The best individual of the jth subpopulation is forced to mutate and replace the worst individual in the j+1th subpopulation. The best individual of the qth subpopulation is forced to mutate and replace the worst individual in the 1st subpopulation, where 1≤j≤q-1, q is the total number of subpopulations.
[0121] During the migration operation, global information exchange is performed to broadcast the optimal solution in each subpopulation to other subpopulations;
[0122] Among them, the migration operation and the communication operation are performed asynchronously.
[0123] In step 700, the crossover rate and mutation rate of the subpopulation are adjusted according to the evolutionary state of the subpopulation based on the adaptive parameter adjustment module, specifically:
[0124] The present invention proposes a new crossover probability and mutation probability adaptive adjustment method, specifically:
[0125]
[0126] Where P c and P M are the crossover probability and mutation probability, respectively, min and f max are the minimum fitness and maximum fitness of the subpopulation respectively; f 1 is the larger value of the fitness of the two individuals crossed; f 2 is the fitness of the mutant individual; f MAX is the maximum fitness of the entire population; tanh(·) is the hyperbolic tangent function.
[0127] The calculated crossover probability and mutation probability are related to both individual fitness and the subpopulation evolution speed (expressed by the maximum fitness of the subpopulation). For subpopulations with relatively slow evolution speed, the crossover probability and mutation probability should be appropriately increased.
[0128] In step 800, the algorithm termination condition is determined on the CPU side based on the termination determination module, specifically:
[0129] The algorithm termination condition is judged on the CPU side based on the termination judgment module, where the termination condition is to satisfy the maximum evolutionary generation and the maximum continuous generation of the optimal individual of the subpopulation.
[0130] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0131] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A multi-population optimization system based on GPU parallel improved genetic algorithm, characterized in that: include: The population initialization module is used to generate the initial population in the CPU, divide it into several sub-populations and transfer them to the GPU storage; Parallel selection module, used to implement population selection operation on GPU, selecting parent individuals based on fitness distribution; The parallel crossover module is used to perform crossover operations in parallel on the GPU to generate new individuals; Parallel mutation module, used to implement mutation operations on GPU; The fitness calculation module is used to calculate the fitness function value of each individual in parallel by GPU and feed it back to the main storage; Migration and communication module, used to realize migration and information exchange between subpopulations on GPU; An adaptive parameter adjustment module is used to adjust the crossover rate and mutation rate of subpopulations according to the evolutionary status of subpopulations; The termination judgment module is used to judge the termination condition of the algorithm on the CPU side. If it is met, the optimal solution is output, otherwise the loop continues; The output module is used to transfer the final optimal solution and its fitness function value from the GPU storage to the CPU; The display module is used to display the final optimal solution as a visual graph or optimization data.
2. A multi-population optimization method based on GPU parallel improved genetic algorithm, characterized in that: include: Step 100: Generate an initial population in the CPU based on the population initialization module, divide it into several sub-populations and transmit them to the GPU storage; Step 200: Calculate the fitness function value of each individual of each subpopulation based on the fitness calculation module; Step 300: Implementing a population selection operation on the GPU based on a parallel selection module, and selecting a parent individual based on fitness distribution; Step 400: performing crossover operations in parallel on the GPU based on the parallel crossover module to generate new individuals; Step 500: Implementing a mutation operation on a GPU based on a parallel mutation module; Step 600: Implementing migration and information exchange between subpopulations on the GPU based on the migration and communication module; Step 700: adjusting the crossover rate and mutation rate of the subpopulation according to the evolutionary state of the subpopulation based on the adaptive parameter adjustment module; Step 800: Based on the termination judgment module, the algorithm termination condition is judged on the CPU side. If it is satisfied, the optimal solution is output, otherwise the cycle continues; Step 900: transferring the final optimal solution and its fitness function value from the GPU storage to the CPU based on the output module; Step 1000: Based on the display module, the final optimal solution is displayed as a visual graph or optimized data.
3. The method according to claim 2, characterized in that In step 100, an initial population is generated in the CPU based on the population initialization module, which is divided into several sub-populations and then transmitted to the GPU for storage, specifically: Based on the population initialization module, an initial population is generated in the CPU and divided into multiple subpopulations according to a preset partitioning strategy. The initial population and subpopulation division method are adjusted according to the scale of the specific problem and the GPU hardware configuration. The generated multiple subpopulation data are transferred to the GPU memory, and ensure that each subpopulation is stored in an independent memory area.
4. The method according to claim 2, characterized in that: In step 200, the fitness function value of each individual of each subpopulation is calculated based on the fitness calculation module, specifically: The fitness function is determined according to the corresponding system, and the fitness function value of the corresponding subpopulation is calculated in each thread block of the GPU based on the fitness function based on the fitness calculation module. For complex fitness functions, multiple threads are allocated based on the CUDA kernel to complete them collaboratively.
5. The method according to claim 2, characterized in that: In step 300, a population selection operation is implemented on the GPU based on a parallel selection module, and a parent individual is selected based on fitness distribution, specifically: Based on the parallel quick sorting algorithm, the individuals in each subpopulation are sorted according to the fitness function value; Based on the improved roulette and tournament selection algorithm, individuals with higher fitness function values in each subpopulation are selected as parents in the subpopulation.
6. The method according to claim 2, characterized in that In step 400, crossover operations are performed in parallel on the GPU based on the parallel crossover module to generate new individuals, specifically: Based on the parallel crossover module, arithmetic crossover operator and single-point crossover operator are used to perform crossover operations on the real number code and integer code in each subpopulation to generate new offspring individuals.
7. The method according to claim 2, characterized in that In step 500, the mutation operation is implemented on the GPU based on the parallel mutation module, specifically: Based on the parallel mutation module, real number codes are uniformly mutated on the GPU, and integer codes are randomly mutated.
8. The method according to claim 2, characterized in that: In step 600, migration and information exchange between subpopulations are implemented on the GPU based on the migration and communication module, specifically: Based on the migration and communication module, the migration operation is performed on the GPU. The best individual of the jth subpopulation is forced to mutate and replace the worst individual in the j+1th subpopulation. The best individual of the qth subpopulation is forced to mutate and replace the worst individual in the 1st subpopulation, where 1≤j≤q-1, q is the total number of subpopulations. During the migration operation, global information exchange is performed to broadcast the optimal solution in each subpopulation to other subpopulations; Among them, the migration operation and the communication operation are performed asynchronously.
9. The method according to claim 2, characterized in that: In step 800, the algorithm termination condition is determined on the CPU side based on the termination determination module, specifically: The algorithm termination condition is judged on the CPU side based on the termination judgment module, where the termination condition is to satisfy the maximum evolutionary generation and the maximum continuous generation of the optimal individual of the subpopulation.