NSGA-II在引入算术交叉算子的同时,提出并引入累积排序适应度赋值策略。实验表明,INSGA具有更高的收敛速度和更好的种群多样性。
登录后复制
clc;clear;close all;warning off;addpath 'func\'%% parametres settingnvar=3; % number of variablelb=[-4 -4 -4]; % lower boundub=[4 4 4]; % upper boundnpop=40; % number of populationpc=0.7; % percent of crossoverncross=2*round(npop*pc/2); % number of crossover offspringpm=0.3; % percent of mutationnmut=round(npop*pm); % number of mutation offspringmaxiter=150;%% initializationempty.pos=[];empty.cost=[];empty.dcount=[]; % dominate countempty.dset=[]; % dominate setempty.rank=[]; empty.cdis=[]; % crowding distancepop=repmat(empty,npop,1);for i=1:npop pop(i).pos=lb+rand(1,nvar).*(ub-lb); pop(i).cost=fitness(pop(i).pos);end[pop F]=non_dominated_sorting(pop);pop=calculated_crowding_distance(pop,F);pop=sorting(pop);%% main loopfor iter=1:maxiter % crossover crosspop=repmat(empty,ncross,1); crosspop=crossover(crosspop,pop,ncross,F,nvar); % mutation mutpop=repmat(empty,nmut,1); mutpop=mutation(mutpop,pop,nmut,lb,ub,nvar); [pop]=[pop;crosspop;mutpop]; [pop F]=non_dominated_sorting(pop); pop=calculated_crowding_distance(pop,F); pop=sorting(pop); pop=pop(1:npop); [pop F]=non_dominated_sorting(pop); pop=calculated_crowding_distance(pop,F); pop=sorting(pop); C=[pop.cost]'; figure(1) plotpareto(F,C) disp([ ' iter = ' num2str(iter) ' BEST F1 = ' num2str(min(C(:,1))) ' BEST F2 = ' num2str(min(C(:,2))) ' NF1 = ' num2str(length(F{1})) ]) end%% resultspareto=pop(F{1},:);1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删