How to solve the following error when using PSOGWO to optimize an objective function ?

1 view (last 30 days)
I am using PSOGWO algorithm to optimize the following function:
function f = simple_fitness_two_bodies(x)
load ww2b.mat; % 100*1
load gh2b.mat; %100*2500
Wd=eye(100);
WM=diag(sqrt(gh2b'*gh2b));
wm=diag(WM);
mapr=zeros(2500,1);
PHm=0;
for j=1:2500;
PHm=PHm+(wm.^2*(1-exp(-abs(x(:)-mapr))));
end
f=norm(Wd*(gh2b*x(:)-ww2b),2)+15.8489*PHm;
and I have the following error....
Operands to the || and && operators must be convertible to logical scalar values.
Error in PSOGWO (line 38)
if fitness>Alpha_score && fitness<Beta_score
Error in main (line 28)
[Best_score,Best_pos,PSOGWO_cg_curve]=PSOGWO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
>>

Answers (0)

Categories

Find more on Problem-Based Optimization Setup in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!