【优化算法】静电放电优化算法(ESDA)【含Matlab源码 1439期】

205 阅读1分钟

一、获取代码方式

获取代码方式1: 通过订阅紫极神光博客付费专栏,凭支付凭证,私信博主,可获得此代码。

获取代码方式2: 通过紫极神光博客主页开通CSDN会员,凭支付凭证,私信博主,可获得此代码。

获取代码方式3: 完整代码已上传我的资源:【优化算法】静电放电优化算法(ESDA)【含Matlab源码 1439期】

备注:开通CSDN会员,仅只能免费获得1份代码(有效期为开通日起,三天内有效); 订阅紫极神光博客付费专栏,可免费获得2份代码(有效期为订阅日起,三天内有效);

二、部分源代码

clear all
clc
close all
d=5;                % dimension
options.lb=-32*ones(1,d);   % lower bound
options.ub=32*ones(1,d);    % upper bound
options.ProblemSize=length(options.ub);    % dimension of the problem.
options.ObjectsSize=100;                   % m: number of objects
options.MaxIter=100; % MAXITER: maximum number of iterations
options.ObjFunction=@Ackley; % the name of the objective function
options.Display_Flag=1; % Flag for displaying results over iterations
options.run_parallel_index=0; % 1 for parallel processing
options.run=10;

if options.run_parallel_index
    stream = RandStream('mrg32k3a');
    parfor index=1:options.run
        set(stream,'Substream',index);
        RandStream.setGlobalStream(stream)
        [Xbest, Fbest,FunctionEvolution_best]=ESDA_v1(options);
        bestX_M(index,:)=Xbest;
        Fbest_M(index)=Fbest;
        fbest_evolution_M(index,:)=FunctionEvolution_best;
    end
else
    rng('default')
    for index=1:options.run
        [Xbest, Fbest,FunctionEvolution_best]=ESDA_v1(options);
        bestX_M(index,:)=Xbest;
        Fbest_M(index)=Fbest;
        fbest_evolution_M(index,:)=FunctionEvolution_best;
    end
end


[a,b]=min(Fbest_M);
figure
plot(1:options.MaxIter,fbest_evolution_M(b,:))
xlabel('Iterations')
ylabel('Fitness')

fprintf(' MIN=%g  MEAN=%g  MEDIAN=%g MAX=%g  SD=%g \n',...
    min(Fbest_M),mean(Fbest_M),median(Fbest_M),max(Fbest_M),std(Fbest_M))


三、运行结果

在这里插入图片描述

四、matlab版本及参考文献

1 matlab版本 2014a

2 参考文献 [1] 包子阳,余继周,杨杉.智能优化算法及其MATLAB实例(第2版)[M].电子工业出版社,2016. [2]张岩,吴水根.MATLAB优化算法源代码[M].清华大学出版社,2017.