⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asexual_reproduction.asv

📁 遗传算法
💻 ASV
字号:
clear;clc;GAInitial;fi(1,BOAT_NUM) = 0;sumFitnessAfter30(1,MAX_GEN) = 0;averageFitnessAfter30(1,MAX_GEN) = 0;for q = 1:Run_Time    GenerateBoat;    for k = 1:MAX_GEN        As_Tournament_Best;        As_Mutation;        As_Tournament_Worst;     %%   if max1 > min1                             % replace the worst boat for the best boat            for i = 1:ROWER                boat(min,i) = boat(max,i);            end     %   else       %      for i = 1:ROWER       %         boat(max,i) = boat(min,i);        %    end   %  end       %% choose the best fitness of the boat                    for n = 1:BOAT_NUM                fi(1,n) = Fitness(n,ROWER,boat);            end           % averageFitness(1,q) = sum(fi) / BOAT_NUM;            sumFitnessEachGeneration(1,k) = sum(fi);            end    for n = 1:MAX_GEN        sumFitnessAfter30(1,n) = sumFitnessEachGeneration(1,n) + sumFitnessAfter30(1,n);    endendfor n = 1:MAX_GEN    averageFitnessAfter30(1,n) = sumFitnessAfter30(1,n) / 30;end% a = 1:Run_Time;% plot(a,maxFitness);% xlabel('running times');% ylabel('the best fitness');b = 1:MAX_GEN;figure,plot(b,averageFitnessAfter30);xlabel('generation');ylabel('the average fitness');    %       fprintf('This is the Individual Fitness you choose:  %d\n',Fitness_Value);     % show the graph of every running time's fitness  % a=1:Run_Time;% plot(a,For_Showing_Fitness);% calculate the average fitnessclear a;clear i;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -