2024年2月17日发(作者:cpu风扇转速多少正常)
methods function main(Algorithm,Problem) %% Parameter setting phi = terSet(0.1);
%% Generate random population Population = lization();
%% Optimization while minated(Population) % Determine the losers and winners rank = randperm(Problem.N); loser = rank(1:end/2); winner = rank(end/2+1:end); replace = FitnessSingle(Population(loser)) < FitnessSingle(Population(winner)); temp = loser(replace); loser(replace) = winner(replace); winner(replace) = temp; % Update the losers by learning from the winners LoserDec = Population(loser).decs; WinnerDec = Population(winner).decs; LoserVel = Population(loser).adds(zeros(size(LoserDec))); R1 = repmat(rand(Problem.N/2,1),1,Problem.D); R2 = repmat(rand(Problem.N/2,1),1,Problem.D); R3 = repmat(rand(Problem.N/2,1),1,Problem.D); LoserVel = R1.*LoserVel + R2.*(WinnerDec-LoserDec) + phi.*R3.*(repmat(mean(,1),Problem.N/2,1)-LoserDec); LoserDec = LoserDec + LoserVel; Population(loser) = SOLUTION(LoserDec,LoserVel); end endendend
发布者:admin,转转请注明出处:http://www.yc00.com/num/1708168794a1543533.html
评论列表(0条)