📄 asexual_reproduction.m
字号:
clear;clc;GAInitial;GenerateBoat;fi(1,BOAT_NUM) = 0;averageFitnessEachGeneration(1,MAX_GEN) = 0;for k = 1:MAX_GEN As_Tournament_Best; As_Mutation; t = round(rand * BOAT_NUM); if t == 0 t = 1; end for i = 1:ROWER boat(t,i) = boat(max,i); end for n = 1:BOAT_NUM fi(1,n) = Fitness(n,ROWER,boat); end averageFitnessEachGeneration(1,k) = sum(fi) / BOAT_NUM;end b = 1:MAX_GEN;figure,plot(b,averageFitnessEachGeneration);xlabel('generation');ylabel('the average fitness');clear a;clear i;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -