资源简介
分布式估计算法EDA,里面含有PPT和相关文档介绍,运行结果可行
代码片段和文件信息
%%%%%%%%%%%%PBIL algorithm
clc
clear
clf
tic %%%%%%%%%%%开始计时
%%%%%%%%%%%%参数设置
Pop_Size=40;
Individual_Len=20;%%%%%%%%%每个变量的长度
Variable_Num=2;
Learning_Rate=0.01;
Iteration_Times=1000;
I=1;
%%%%%%%%%%%%%%%产生初始种群
Binary_X=zeros(Pop_SizeVariable_NumIndividual_Len);
for i=1:1:Pop_Size
for j=1:1:Variable_Num
for k=1:1:Individual_Len
Binary_X(ijk)=round(rand());
end
end
end
Best_Individual=zeros(1Iteration_Times);
Probability_Vector=zeros(Iteration_TimesVariable_NumIndividual_Len);
traces=zeros(3Iteration_Times);%%%%%追踪每一代的最优值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%对每一代执行如下操作
while I<=Iteration_Times
%%%%%%%%%%%%%%%%将采样的值,由二进制转化到十进制
Decimal_X=zeros(Pop_SizeVariable_Num);
for i=1:1:Pop_Size
for j=1:1:Variable_Num
k=Individual_Len;
t=1;
while k>=1
Decimal_X(ij)=Decimal_X(ij)+Binary_X(ijk)*2^(t-1);
k=k-1;
t=t+1;
end
end
end
%%%%%%%%%%%%%%%%%将十进制映射到解空间中
Solution=zeros(Pop_SizeVariable_Num);
for i=1:1:Pop_Size
for j=1:1:Variable_Num
Solution(ij)=-2+Decimal_X(ij)*4/(2^Individual_Len-1);
end
end
%%%%%%%%%%%%%%%%%%计算适应值
Fitness_Value=zeros(1Pop_Size);
for i=1:1:Pop_Size
% Fitness_Value(i)=100*(Solution(i1)^2-Solution(i2))^2+(1-Solution(i1))^2;
% Fitness_Value(i)=Solution(i1)*cos(2*pi*Solution(i2))+Solution(i2)*sin(2*pi*Solution(i1));
%Fitness_Value(i)=Solution(i1)+Solution(i2);
% Fitness_Value(i)=Solution(i1)^2+Solution(i2);
%Fitness_Value(i)=Solution(i1)*Solution(i2);
%Fitness_Value(i)=(Solution(i1)-Solution(i2))^2;
Fitness_Value(i)=Solution(i1).*cos(2*pi*Solution(i2))+Solution(i2).*cos(2*pi*Solution(i1));
end
%%%%%%%%%%%%%%%%%%将适应值按照从小到大的顺序排序,并选出最优个体
[FitnessValueindex]=sort(Fitness_Value);%%%%%%%排序
Best_Individual(I)=Fitness_Value(index(Pop_Size));%%%%%%%%选最优个体
traces(1I)=Solution(index(Pop_Size)1);
traces(2I)=Solution(index(Pop_Size)2);
traces(3I)=Fitness_Value(index(Pop_Size));
%%%%%%%%%%%%%%%%选出优势群体
Superiority_Polution=zeros(Pop_Size/2Variable_NumIndividual_Len);
for i=1:1:Pop_Size/2
for j=1:1:Variable_Num
for k=1:1:Individual_Len
Superiority_Polution(ijk)=Binary_X(index(i+Pop_Size/2)jk);
end
end
end
%%%%%%%%%%%%%%%从优势群体中统计基因位的值,来更新概率向量
Ones_Number=zeros(Variable_NumIndividual_Len);
for i=1:1:Pop_Size/2
for j=1:1:Variable_Num
for k=1:1:Individual_Len
if Superiority_Polution(ijk)==1
Ones_Number(jk)=Ones_Number(jk)+1;
end
end
end
end
for j=1:1:Variable_Num
for k=1:1:Individual_Len
Probability_Vector(Ijk)=Ones_Number(jk)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4487 2012-12-07 13:07 分布式估计算法EDA\PBIL.m
文件 3264000 2017-12-04 09:03 分布式估计算法EDA\分布估计算法.ppt
文件 10850414 2017-12-04 10:25 分布式估计算法EDA\分布估计算法教案.pdf
目录 0 2017-12-04 10:26 分布式估计算法EDA\
评论
共有 条评论