最新消息:华育范文展示优秀的文章,范文,工作日记!

进化算法简介

外语翻译admin10浏览0评论

浑浑噩噩的英文噩翻译噩英语怎么说-食品安全 英语作文


2023年10月10日发(作者:国王的演讲英文字幕)

进化算法简介

阅读⽬录

进化算法,也被成为是演化算法(evolutionary algorithms,简称EAs),它不是⼀个具体的算法,⽽是⼀个“算法簇”。进化算法

的产⽣的灵感借鉴了⼤⾃然中⽣物的进化操作,它⼀般包括基因编码,种群初始化,交叉变异算⼦,经营保留机制等基本操作。与传统的

基于微积分的⽅法和穷举⽅法等优化算法(具体介绍见博客中的其他数学优化⽅法)相⽐,进化计算是⼀种成熟的具有⾼鲁棒性和⼴泛适

⽤性的全局优化⽅法,具有⾃组织、⾃适应、⾃学习的特性,能够不受问题性质的限制,有效地处理传统优化算法难以解决的复杂问题

(⽐如NP难优化问题)。

除了上述优点以外,进化算法还经常被⽤到多⽬标问题的优化求解中来,我们⼀般称这类进化算法为进化多⽬标优化算法

Step 4 个体选择:设计合适的选择算⼦来对种群P(g)个体进⾏选择,被选择的个体将进⼊交配池中组成⽗代种群FP(g),⽤于交叉变

% This example is used to explain the GA.

% max f(x1, x2) = 21.5 + x1·sin(4pi*x1) + x2·sin(20pi*x2)

% s.t. -3.0 <= x1 <= 12.1

% 4.1 <= x2 <= 5.8

clc; clear all;

M = 40;N = 33;

generation = 1000;

it = 1;

pm = 0.05;%变异概率

pc = 0.8;%交叉概率

maxdata = -200;

pop = round(rand(M,N));%初始化矩阵,产⽣初始种群

x1 = decode_x1(pop(:,1:18)); %x1 x2进⾏解码

x2 = decode_x2(pop(:,19:end));

fitness = 21.5 + x1.*sin(4*pi*x1) +x2.*sin(20*pi*x2);%适应度函数

while it < generation

[B] = seclection(fitness,pop);%轮盘赌选择

[newpop] = crossover(pc,B);%交叉

[B] = mutation(pm,newpop);%变异操作

pop = B;

x1 = decode_x1(pop(:,1:18));

x2 = decode_x2(pop(:,19:end));

fitness = 21.5 + x1.*sin(4*pi*x1) +x2.*sin(20*pi*x2);%计算适应度

[fit_best,index] = max(fitness);%本代中的最优⽬标值

if fit_best >= maxdata

function x2=encode_x2(code)

[M,N] = size(code);

sum = zeros(N);

%变异

function [newpop]=mutation(pm,A)

[M,N]=size(A);

newpop=A;

W = rand(M,N)

for i=1:M

for j=1:N

if W(i,j) ==1

if A(i,j)~=1

newpop(i,j)= 1;

else

newpop(i,j) = 0;

end

clear all

clc

tic

N=50;%the number of the population

numvariate=1;%the number of the variate of each individual

numfun=2;

%%%input :the population Rt of size N*m,output:the value of the population

%%%Rt of size N*numf,numf if the number of the objective

function [ funvalueRt ] = funfvalue( Rt)

%% 测试数据SCH

funvalueRt(:,1)=Rt.^2;

funvalueRt(:,2)=(Rt-2).^2;

% % input Pt ,size of N*m;output Rt,size of 2N*m

function [ Rt ] = Genetic_Operators( Pt,minx,maxx,numvariate,numfun)

%% 不交叉则变异,避免种群中数值相同的个体存在,这样可以保持种群的多样性

pc=0.9;

pm=0.1;

% %%Fii存储占优⾯上相应每个个体在种群Rt中的编号,即⾏号

function [Fii] = fast_nondominated_sort( Rt,numvariate,numfun)

N=size(Rt,1);

Sp=zeros(N,N+1);%Sp的第⼀列表⽰每个Spi所拥有的个数,即p所⽀配的个数,从第⼆列开始表⽰被p⽀配的个体

np=zeros(N,1);

Finum=zeros(N,N+1);

% Fi=zeros(N,N+1,numvariate);

prank=zeros(N,1);

funvalueRt=Rt(:,(numvariate+1):(numvariate+numfun));

for p=1:N

for q=1:N

if q~=p

%%% 这⾥还有另外⼀种情况,即Rt(p)不⽀配Rt(q),也不被Rt(q)⽀配

if dominate(funvalueRt(p,:),funvalueRt(q,:))==1

Sp(p,1)=Sp(p,1)+1;

Sp(p,Sp(p,1)+1)=q;

elseif dominate(funvalueRt(q,:),funvalueRt(p,:))==1

np(p)=np(p)+1;

end

%%% input:Fi of size 1*(2*N+1),output:Idistance of size 1*(FiRt(1,1))

function [Idistance] = crowdiing_distance_assignment(Fi,Rt,numvariate,numfun)

NFi=Fi(1,1);

Idistance=zeros(1,NFi);

funvalueI1=zeros(NFi,numfun);

if NFi<=2

Idistance=Inf*ones(1,NFi);

else

b=Fi(2:(Fi(1,1)+1));

funvalueI1=Rt(b,(numvariate+1):(numvariate+numfun));

% b=Fi(2:(Fi(1,1)+1));

% for i=1:NFi

% funvalueI1(i,:)=Rt(b(i),(numvariate+1):(numvariate+numfun));

辊筒的英文译语怎么说-sportlemon


浑浑噩噩的英文噩翻译噩英语怎么说-食品安全 英语作文


2023年10月10日发(作者:国王的演讲英文字幕)

进化算法简介

阅读⽬录

进化算法,也被成为是演化算法(evolutionary algorithms,简称EAs),它不是⼀个具体的算法,⽽是⼀个“算法簇”。进化算法

的产⽣的灵感借鉴了⼤⾃然中⽣物的进化操作,它⼀般包括基因编码,种群初始化,交叉变异算⼦,经营保留机制等基本操作。与传统的

基于微积分的⽅法和穷举⽅法等优化算法(具体介绍见博客中的其他数学优化⽅法)相⽐,进化计算是⼀种成熟的具有⾼鲁棒性和⼴泛适

⽤性的全局优化⽅法,具有⾃组织、⾃适应、⾃学习的特性,能够不受问题性质的限制,有效地处理传统优化算法难以解决的复杂问题

(⽐如NP难优化问题)。

除了上述优点以外,进化算法还经常被⽤到多⽬标问题的优化求解中来,我们⼀般称这类进化算法为进化多⽬标优化算法

Step 4 个体选择:设计合适的选择算⼦来对种群P(g)个体进⾏选择,被选择的个体将进⼊交配池中组成⽗代种群FP(g),⽤于交叉变

% This example is used to explain the GA.

% max f(x1, x2) = 21.5 + x1·sin(4pi*x1) + x2·sin(20pi*x2)

% s.t. -3.0 <= x1 <= 12.1

% 4.1 <= x2 <= 5.8

clc; clear all;

M = 40;N = 33;

generation = 1000;

it = 1;

pm = 0.05;%变异概率

pc = 0.8;%交叉概率

maxdata = -200;

pop = round(rand(M,N));%初始化矩阵,产⽣初始种群

x1 = decode_x1(pop(:,1:18)); %x1 x2进⾏解码

x2 = decode_x2(pop(:,19:end));

fitness = 21.5 + x1.*sin(4*pi*x1) +x2.*sin(20*pi*x2);%适应度函数

while it < generation

[B] = seclection(fitness,pop);%轮盘赌选择

[newpop] = crossover(pc,B);%交叉

[B] = mutation(pm,newpop);%变异操作

pop = B;

x1 = decode_x1(pop(:,1:18));

x2 = decode_x2(pop(:,19:end));

fitness = 21.5 + x1.*sin(4*pi*x1) +x2.*sin(20*pi*x2);%计算适应度

[fit_best,index] = max(fitness);%本代中的最优⽬标值

if fit_best >= maxdata

function x2=encode_x2(code)

[M,N] = size(code);

sum = zeros(N);

%变异

function [newpop]=mutation(pm,A)

[M,N]=size(A);

newpop=A;

W = rand(M,N)

for i=1:M

for j=1:N

if W(i,j) ==1

if A(i,j)~=1

newpop(i,j)= 1;

else

newpop(i,j) = 0;

end

clear all

clc

tic

N=50;%the number of the population

numvariate=1;%the number of the variate of each individual

numfun=2;

%%%input :the population Rt of size N*m,output:the value of the population

%%%Rt of size N*numf,numf if the number of the objective

function [ funvalueRt ] = funfvalue( Rt)

%% 测试数据SCH

funvalueRt(:,1)=Rt.^2;

funvalueRt(:,2)=(Rt-2).^2;

% % input Pt ,size of N*m;output Rt,size of 2N*m

function [ Rt ] = Genetic_Operators( Pt,minx,maxx,numvariate,numfun)

%% 不交叉则变异,避免种群中数值相同的个体存在,这样可以保持种群的多样性

pc=0.9;

pm=0.1;

% %%Fii存储占优⾯上相应每个个体在种群Rt中的编号,即⾏号

function [Fii] = fast_nondominated_sort( Rt,numvariate,numfun)

N=size(Rt,1);

Sp=zeros(N,N+1);%Sp的第⼀列表⽰每个Spi所拥有的个数,即p所⽀配的个数,从第⼆列开始表⽰被p⽀配的个体

np=zeros(N,1);

Finum=zeros(N,N+1);

% Fi=zeros(N,N+1,numvariate);

prank=zeros(N,1);

funvalueRt=Rt(:,(numvariate+1):(numvariate+numfun));

for p=1:N

for q=1:N

if q~=p

%%% 这⾥还有另外⼀种情况,即Rt(p)不⽀配Rt(q),也不被Rt(q)⽀配

if dominate(funvalueRt(p,:),funvalueRt(q,:))==1

Sp(p,1)=Sp(p,1)+1;

Sp(p,Sp(p,1)+1)=q;

elseif dominate(funvalueRt(q,:),funvalueRt(p,:))==1

np(p)=np(p)+1;

end

%%% input:Fi of size 1*(2*N+1),output:Idistance of size 1*(FiRt(1,1))

function [Idistance] = crowdiing_distance_assignment(Fi,Rt,numvariate,numfun)

NFi=Fi(1,1);

Idistance=zeros(1,NFi);

funvalueI1=zeros(NFi,numfun);

if NFi<=2

Idistance=Inf*ones(1,NFi);

else

b=Fi(2:(Fi(1,1)+1));

funvalueI1=Rt(b,(numvariate+1):(numvariate+numfun));

% b=Fi(2:(Fi(1,1)+1));

% for i=1:NFi

% funvalueI1(i,:)=Rt(b(i),(numvariate+1):(numvariate+numfun));

辊筒的英文译语怎么说-sportlemon


与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论