xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 4KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-10
  • 語言: Matlab
  • 標簽: Cohort??Intelligence??

資源簡介

CoHort Intelligence的MATLAB 代碼,全網唯一,自編自寫

資源截圖

代碼片段和文件信息

%%?清空環境
clc;clear;
%%?CI算法參數(以函數值最大為目標)
maxgen=200;?????????????????????????%進化代數
popsize=10;???????????????????????%種群規模
varNum=10;?????????????????????????%采樣數目
r=0.5;?????????????????????????????%屬性約減因子
e=0.0001;??????????????????????????%convergence?parameter?
cmax=10;???????????????????????????%飽和次數
inibound=[-5?5;-5?5];?????????????????%采樣區間
%define?cohort?parameter
X=zeros(popsize2);%candidates
fitness=zeros(popsize1);%
%?interval=zeros(popsize22);%qualities?interval
%%?個體初始化

%?初始化種群
[Xinterval]=CreatIndividual(iniboundpopsize);
%計算個體適應度
for?tmp=1:popsize
????fitness(tmp)=fun(X(tmp:));
end
%?記錄每一代進化中最好的適應度和平均適應度
trace=[];
Fn=[00];
Fn_1=[00];
saturationNum=0;
%%?進化開始
for?i=1:maxgen
????fitness=1./fitness;
????sumfitness=sum(fitness);
????sumf=fitness./sumfitness;
????maxIndex=find(sumf==max(sumf));
????%
????Y=zeros(size(X));
????Yinterval=zeros(size(interval));
????Yfitness=zeros(size(fitness));
%?????varNum=floor(varNum*r+1);
????for?s=1:popsize
????????%?選擇一個個體去follow????????
%?????????if?s==maxIndex
%?????????????%the?best?one?follow?himself
%?????????????selectedIndex=maxIndex;
%??????????????bound=UpdateBou(rX(selectedIndex:)interval(selectedIndex::));
%?????????else
%?????????????selectedIndex=Select(sumfpopsize);?????
%?????????????%更新被選擇個體的特征采樣間隔
%?????????????bound=UpdateBou(rX(selectedIndex:)interval(selectedIndex::));
%?????????end?
????????selectedIndex=Select(sumfpopsize);?????
%?????????????更新被選擇個體的特征采樣間隔
????????bound=UpdateBou(rX(selectedIndex:)interval(selectedIndex::));
????????%?Sampling?from?the?updated?interval
????????
????????[samCansamIt]=CreatIndividual(boundvarNum);
????????%Calculate?fitness
????????samfitness=zeros(varNum1);
????????for?tmp=1:varNum
????????????samfitness(tmp)=fun(samCan(tmp:));
????????end
????????%update?current?candidate
????????maxIndex=find(samfitness==min(samfitness));
????????Y(s:)=samCan(maxIndex(1):);
????????Yinterval(s::)=samIt(maxIndex(1)::);
????????Yfitness(s)=samfitness(maxIndex(1));
????end???
????X=Y;
%?????scatter(X(:1)X(:2));
%?????axis([-55-55]);
%?????hold?on
????interval=Yinterval;
????fitness=Yfitness;
????
????%找到最大適應度的個體及它們在種群中的位置
????[bestfitnessbestindex]=min(fitness);
????avgfitness=sum(fitness)/popsize;
????trace=[trace;avgfitness?bestfitness];?%記錄每一代進化中最好的適應度和平均適應度
????%%?judge?the?stop?criterion
????Fn_1=Fn;
????Fn=[max(fitness)min(fitness)];
????if?(Fn(1)-Fn_1(1))<=e
????????if?(Fn(2)-Fn_1(2))<=e
????????????if?(Fn(1)-Fn(2))<=e
????????????????saturationNum=saturationNum+1;
????????????end
????????end
????end
????if?saturationNum>=cmax
????????break;
????end
end
%進化結束

%%?結果顯示
[r?c]=size(trace);
figure
plot([1:r]‘trace(:1)‘r-‘[1:r]‘trace(:2)‘b--‘);
title([‘函數值曲線??‘?‘終止代數=‘?num2str(i)]‘fontsize‘12);
xlabel(‘進化代數‘‘fontsize‘12);ylabel(‘函數值‘‘fontsize‘12);
legend(‘各代平均值‘‘各代最佳值‘‘fontsize‘12);
%?ylim([1.5?8])
di

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????3101??2017-11-08?09:38??Cohort?Intelligence\CI.asv

?????文件???????3310??2017-11-10?09:14??Cohort?Intelligence\CI.m

?????文件????????231??2017-11-07?11:32??Cohort?Intelligence\Code.m

?????文件????????286??2017-11-07?19:32??Cohort?Intelligence\CreatIndividual.m

?????文件????????182??2017-11-08?09:53??Cohort?Intelligence\fun.m

?????文件????????530??2017-11-07?22:16??Cohort?Intelligence\Select.m

?????文件????????595??2017-11-07?20:21??Cohort?Intelligence\UpdateBou.m

?????目錄??????????0??2017-11-07?21:29??Cohort?Intelligence

-----------?---------??----------?-----??----

?????????????????8235????????????????????8


評論

共有 條評論

相關資源