资源简介

matlab程序,PBIL 分布估计 EDA算法

资源截图

代码片段和文件信息

clc
close all
clear
tic
% m=input(‘请输入种群中的个体数量 m=‘);
% n=input(‘请输入二进制编码位数(推荐16位) n=‘);
% t=input(‘请输入自变量个数 t=‘);
% a=input(‘请输入学习速率 a=‘)
m=100
n=32;t=2;
x=zeros(tnm);
X=zeros(tm);a=0.01;
% [mn]=size(x(1));
for k=1:1:m
    for i=1:1:t
        for j=1:1:n
            x(ijk)=round(rand());
        end
    end
end
I=1;
Imax=20;
p=zeros(tImaxn);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
while I<=Imax %总循环
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%生成新一代
    if I>1
        for j=1:n
            p(:Ij)=(1-a).*p(:I-1j)+a.*x(:jindex(m));
        end
        for i=1:m
            for j=1:n
                for k=1:t
                    temp=rand;
                    if temp                        x(kji)=1;
                    else
                        x(kji)=0;
                    end
                end
            end
        end
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%译码为十进制数
    for i=1:m
        for k=1:t
            temp=zeros(1t);
            for j=1:n
                temp(k)=temp(k)+x(kji)*2^(j-1)
%                 X(ki)=(temp+x(kij)*2^(j-1)/(2^n-1))*10-5;
            end
            X(ki)=temp(k)/(2^n-1)*10-5;
        end
    end
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%计算目标函数
    for i=1:m
        

评论

共有 条评论