Sie sind auf Seite 1von 3

Mars

13 Oct 2018

Okay.
Thank you very much!

I. Berkan Aydilek

13 Oct 2018

There is no problem
this if will run in 3.iteration after g_best_val_t is set
.....
for i=1:iter
.....
if (i>2) && (f_val(j,1)<=g_best_val_t(i-2,:))
.......

Mars

13 Oct 2018

Hi Berkan,

There are noticeable mistake in the publised codes.

For example:

function [f_valc, xc]=hfpso_v2(iter,swarm_size,c1,c2,LB,UB,D,vmax_coef,func_no,fhd)


% usage -> hfpso_v2(50,30,1.49445,1.49445,-100,100,30,0.1,1,'benchmark_func2017')
% new research cooperation are welcome with me: berkanaydilek@harran.edu.tr
% please cite my article
% ibrahim Berkan Aydilek,
% A hybrid firefly and particle swarm optimization algorithm for computationally expensive
numerical problems,
% Applied Soft Computing, Volume 66, May 2018, Pages 232-249
% you need download for benchmark_func2017
http://web.mysites.ntu.edu.sg/epnsugan/PublicSite/Shared%20Documents/CEC-2017/Bound-
Constrained/codes.rar and extract same folder
rand('state', sum(100*clock));
if size(LB)==1
LB=repmat(LB,D,1);
end
if size(UB)==1
UB=repmat(UB,D,1);
end
v_max= vmax_coef* (UB-LB);
v_min=-v_max;
particles_x=LB'+rand(swarm_size,D).*(UB-LB)';
particles_v=v_min'+rand(swarm_size,D).*(v_max-v_min)';
for piiz=1:swarm_size
f_val(piiz,1)=feval(fhd,particles_x(piiz,:),func_no);
end
p_best=particles_x;
p_best_val=f_val;
[~,index]= min(f_val(:,1));
g_best=particles_x(index,:);
g_best_val=f_val(index,1);
dmax = (UB-LB)*sqrt(D);
for i=1:iter
w_linear = 0.9-((0.9-0.5)/iter)*i; % Linear Decreasing Inertia Weight
w=w_linear;

for j=1:swarm_size

if (i>2) && (f_val(j,1)<=g_best_val_t(i-2,:))

Please attention the above sentence in your code.

The variable g_best_val_t has not been set to a value.

Why you can use it for comparison?

I. Berkan Aydilek

12 Oct 2018

Hi Mars, Please send your codes folder (zip) to my e-mail berkanaydilek[at]harran.edu.tr, i will
check it and what is your matlab version, i use 2018a now and i have no problem.
1. download http://web.mysites.ntu.edu.sg/epnsugan/PublicSite/Shared%20Documents/CEC-
2017/Bound-Constrained/codes.rar
2. extract it we use matlab folder in this codes.rar
3. put "A hybrid firefly and particle swarm optimization algorithm (HFPSO) codes" inside this
matlab folder
4. run main.m file
thanks

Mars

12 Oct 2018
Hi Berkan,
Thanks for your sharing.
However, there are many errors when I run this code.
Please correct it and re-publish it again.
Thanks!

If I use your recommanded code :


particles_x=-100'+rand(30,30).*(100-(-100))'

It also leads to many mistakes.


Please correct these mistakes!

I. Berkan Aydilek

6 Oct 2018

Hello Ravi, i think you use lower band(LB) or Upper band(UB) dimension wrong below trial
code must be run
particles_x=-100'+rand(30,30).*(100-(-100))'
and dont forget to downlaod benchmark_func2017
http://web.mysites.ntu.edu.sg/epnsugan/PublicSite/Shared%20Documents/CEC-2017/Bound-
Constrained/codes.rar and extract same folder

Ravi Kumar Poluru

5 Oct 2018

When i run this code i got this errors can anyone help to resolve this.
Error using .*
Matrix dimensions must agree.

Error in hfpso_v2 (line 28)


particles_x=LB'+rand(swarm_size,D).*(UB-LB)';

Error in main (line 12)


results(func_no,:) =hfpso_v2(50,30,1.49445,1.49445,-
100,100,30,0.1,func_no,'benchmark_func2017');

David Franco

21 Sep 2018

Thanks for sharing. Working perfectly! Greetings from Brazil \o/

Das könnte Ihnen auch gefallen