Function name: main GA |
Function: Optimized parameter combination |
BEGIN % the ipop array variable represents a population and consists of multiple chromosome individuals and is used to store the chromosomes of the i-th generation population. % the evals array stores the fitness values of the chromosomes at the corresponding locations in the ipop array. % uses the inialPops function to create the initial population. ipop = inialPops( ); % implements genetic manipulation cyclically with a minimum of 50 generations of genetic ma-nipulation. for i = 1 to 50 for k = 1 to m % m is the number of groups evals[k] = calculatefitnessvalue(ipop[k]); % calculates the fitness of the corresponding chromosome. if(evals[k] > best.fitness) { best.fitness = evals[k]; % records the most adaptive value with the corresponding chromosome. best.pop = ipop[k]; } end if end if(best.fitness >= n) { % n is the preset MAE threshold. select( ); % select operation. cross( ); % cross operation. matation( ); } % variation operation. else stop; % reaches the threshold requirement and stops executing the genetic algorithm. end if end END |