function CoGA
%COGA Summary of this function goes here
% Detailed explanation goes here
% 标准合作型协同进化遗传算法
clc;
clear all;
global POPSIZE POPULATION BESTINDIVIDUAL CURRENTBEST
global P0 P1 P2 P3 T PC PM BINDEX WINDEX FAVER FMAX
POPSIZE=20;T=3;Pc=0.95;Pm=0.3;
t=1;
bound=[-4 4];
PO1=initga(POPSIZE,bound);
PO2=initga(POPSIZE,bound);
%caculate the individual fitness
[PO1,x2]=gafit(PO1,PO2,POPSIZE,1);
[PO2,x1]=gafit(PO2,PO1,POPSIZE,1);
%maitain the best individuals
fitne1=PO1(:,2)';fitne2=PO2(:,2)';
fitne=[fitne1,fitne2];
fma1=max(fitne1);fma2=max(fitne2);
in1=find(fma1==fitne1);
in2=find(fma2==fitne2);
best{t,1}=[PO1(in1(1),:),x2;PO2(in2(1),:),x1];
%search for the best fitness
fmaa=[fma1,fma2];fma=max(fmaa);
in=find(fma==fmaa);
fmi1=min(fitne1);fmi2=min(fitne2);
fav=mean(fitne);
BINDEX1=findstr(fitne1,fma1); % the best fitness index of PO1
BINDEX2=findstr(fitne2,fma2);
WINDEX1=findstr(fitne1,fmi1); % the worst fitness index of PO1
WINDEX2=findstr(fitne2,fmi2); % the worst fitness index of PO1
Bestin1=PO1(BINDEX1,:);Bestin2=PO2(BINDEX2,:);
CURRENTBEST1{1,1}=Bestin1;
CURRENTBEST2{1,1}=Bestin2;
while t < T
t=t+1;
% generate the next time population
%PO1
PO11=selectga(PO1,POPSIZE,1);
PO12=crossga(PO11,POPSIZE,PC,1);
PO13=uniformMutate(PO12,bound,PM);
%PO2
PO21=selectga(PO2,POPSIZE,1);
PO22=crossga(PO21,POPSIZE,PC,1);
PO23=uniformMutate(PO22,bound,PM);
%caculate the individual fitness
[PO1,x2]=gafit(PO1,PO2,POPSIZE,1);
[PO2,x1]=gafit(PO2,PO1,POPSIZE,1);
%caculate the individual fitness
[PO1,x2]=gafit(PO1,PO2,POPSIZE,1);
[PO2,x1]=gafit(PO2,PO1,POPSIZE,1);
fitne1=PO1(:,2)';fitne2=PO2(:,2)';
fitne=[fitne1,fitne2];
fma1=max(fitne1);fma2=max(fitne2);
in1=find(fma1==fitne1);
in2=find(fma2==fitne2);
best{t,1}=[PO1(in1(1,1),:),x2(1,1);PO2(in2(1,1),:),x1(1,1)];
fmaa=[fma1,fma2];fma=max(fmaa);
in=find(fma==fmaa);
fmi1=min(fitne1);fmi2=min(fitne2);
fav=mean(fitne);
BINDEX1=findstr(fitne1,fma1); % the best fitness index of PO1
BINDEX2=findstr(fitne2,fma2);
WINDEX1=findstr(fitne1,fmi1); % the worst fitness index of PO1
WINDEX2=findstr(fitne2,fmi2); % the worst fitness index of PO1
Bestin1=PO1(BINDEX1(1,1),:);Bestin2=PO2(BINDEX2(1,1),:);
if Bestin1(:,2)>CURRENTBEST1{t-1,1}(:,2)
CURRENTBEST1{t,1}=Bestin1;
else
PO1(WINDEX1(1,1),:)=CURRENTBEST1{t-1,1};
CURRENTBEST1{t,1}=CURRENTBEST1{t-1,1};
end
if Bestin2(:,2)>CURRENTBEST2{t-1,1}(:,2)
CURRENTBEST2{t,1}=Bestin2;
else
PO2(WINDEX2(1,1),:)=CURRENTBEST2{t-1,1};
CURRENTBEST2{t,1}=CURRENTBEST2{t-1,1};
end
[PO13,x2]=gafit(PO13,PO23,POPSIZE,1);
PO1=PO13;
[PO23,x1]=gafit(PO23,PO13,POPSIZE,1);
PO2=PO23;
end
best
for i=1:T
a(:,:,i)=best{i,1};
end
a
没有合适的资源?快使用搜索试试~ 我知道了~
基于MATLAB实现的标准合作型协同进化遗传算法MATLAB源程序,对函数进行优化+使用说明文档.rar
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共12个文件
m:7个
asv:4个
md:1个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 37 浏览量
2024-05-22
17:16:56
上传
评论
收藏 8KB RAR 举报
温馨提示
CSDN IT狂飙上传的代码均可运行,功能ok的情况下才上传的,直接替换数据即可使用,小白也能轻松上手 【资源说明】 基于MATLAB实现的标准合作型协同进化遗传算法MATLAB源程序,对函数进行优化+使用说明文档.rar 1、代码压缩包内容 主函数:main.m; 调用函数:其他m文件;无需运行 运行结果效果图; 2、代码运行版本 Matlab 2020b;若运行有误,根据提示GPT修改;若不会,私信博主(问题描述要详细); 3、运行操作步骤 步骤一:将所有文件放到Matlab的当前文件夹中; 步骤二:双击打开main.m文件; 步骤三:点击运行,等程序运行完得到结果; 4、仿真咨询 如需其他服务,可后台私信博主; 4.1 期刊或参考文献复现 4.2 Matlab程序定制 4.3 科研合作 功率谱估计: 故障诊断分析: 雷达通信:雷达LFM、MIMO、成像、定位、干扰、检测、信号分析、脉冲压缩 滤波估计:SOC估计 目标定位:WSN定位、滤波跟踪、目标定位 生物电信号:肌电信号EMG、脑电信号EEG、心电信号ECG 通信系统:DOA估计、编码译码、变分模态分解、管道泄漏、滤波器、数字信号处理+传输+分析+去噪、数字信号调制、误码率、信号估计、DTMF、信号检测识别融合、LEACH协议、信号检测、水声通信 5、欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 12 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
IT狂飙
- 粉丝: 4779
- 资源: 2640
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)