【智能优化算法】基于黑猩猩算法求解多目标优化问题附matlab代码
?1 內(nèi)容介紹
tled attacker, barrier, chaser, and driver are employed for simulating the diverse intelligence. Moreover, the four main steps of hunting, driving, blocking, and attacking, are implemented. Afterward, the algorithm is tested on 30 well-known benchmark functions, and the results are compared to four newly proposed meta-heuristic algorithms in term of convergence speed, the probability of getting stuck in local minimums, and the accuracy of obtained results. The results indicate that the ChOA outperforms the other benchmark optimization algorithms.
?
2 仿真代碼
function [new_pops] = NondominatedSort_and_filling(pop, nobj, ncon, nreal, nbin)
N = size(pop,1);
fitsize = N/2;
[sorted_ranks, rankID] = sort(pop(:,nobj+ncon+nreal+nbin+2));
parentID = []; front = 1; front_array = [];
while size(parentID,2) < fitsize
? ? for i=1:N
? ? ? ? if sorted_ranks(i) ~= front
? ? ? ? ? ? break
? ? ? ? end
? ? ? ? front_array = [front_array rankID(i)];
? ? end
? ? size_check = size(parentID,2) + size(front_array,2);
? ? if size_check == fitsize
? ? ? ? parentID = [parentID front_array];
? ? ? ? break
? ? elseif size_check < fitsize
? ? ? ? parentID = [parentID front_array];
? ? ? ? sorted_ranks(1:size(front_array,2)) = [];
? ? ? ? rankID(1:size(front_array,2)) = [];
? ? ? ? N = N - size(front_array,2);
? ? ? ? front = front+1;
? ? ? ? front_array = [];
? ? else
? ? ? ? miss_size = fitsize - (size_check - size(front_array,2));
? ? ? ? n_consviol = nobj+ncon+nreal+nbin+1;
? ? ? ? n_rank= nobj+ncon+nreal+nbin+2;
? ? ? ? n_crowd = n_rank+1;
? ? ? ? if ncon==0,% if the problem does not have any constraints
? ? ? ? ? ?
? ? ? ? ? ? % sort crowding distance and select miss_size number of top individuals ?
? ? ? ? ? ? % and add them to the parent pop
? ? ? ? ? ? [~, distID] = sort(pop(front_array,n_crowd), 'descend');
? ? ? ? ? ? parentID = [parentID front_array(distID(1:miss_size))];
? ? ? ? ? ??
? ? ? ? else % if the problem have constraints
? ? ? ? ? ??
? ? ? ? ? ? %calculate the number of the feasible individuals
? ? ? ? ? ? feasible_ind=find(pop(front_array,n_consviol)==0);
? ? ? ? ? ? feasible_ind=(front_array(feasible_ind));
? ? ? ? ? ? number_feasible_ind=length(feasible_ind);
? ? ? ? ? ??
? ? ? ? ? ? if ?number_feasible_ind > miss_size, ??
? ? ? ? ? ? ? ? % sort feasible individuals based on crowdind distance?
? ? ? ? ? ? ? ? % select the best miss_size of them and add them to parent
? ? ? ? ? ? ? ? % pop
? ? ? ? ? ? ? ? [~, distID] = sort(pop(feasible_ind,n_crowd), 'descend');
? ? ? ? ? ? ? ? parentID = [parentID feasible_ind(distID(1:miss_size))]; ? ? ??
? ? ? ? ? ? elseif number_feasible_ind == miss_size,
? ? ? ? ? ? ? ? parentID = [parentID feasible_ind];?
? ? ? ? ? ? else % where number_feasible_ind < miss_size,
? ? ? ? ? ? ? ? % sort based on the constraint violation,
? ? ? ? ? ? ? ? [~, consviolationID] = sort(pop(front_array,n_consviol), 'descend');
? ? ? ? ? ? ? ? parentID = [parentID front_array(consviolationID(1:miss_size))];
? ? ? ? ? ? end
? ? ? ? end
? ? end
end
new_pops = pop(parentID,:);
end
function ab=SelectAlphaBonobo(pop,ncolumn)
[d2,ind]=sort(pop(:,ncolumn),'descend');
d2(1:2)=d2(3);
d2=d2/(sum(d2));
r=rand;
C=cumsum(d2);
i=find(r<=C,1,'first');
ab=pop(ind(i),:);
end
function ab=SelectAlphaBonobo(pop,ncolumn)
[d2,ind]=sort(pop(:,ncolumn),'descend');
d2(1:2)=d2(3);
d2=d2/(sum(d2));
r=rand;
C=cumsum(d2);
i=find(r<=C,1,'first');
ab=pop(ind(i),:);
end
3 運(yùn)行結(jié)果
4 參考文獻(xiàn)
[1]程國(guó)森, and 崔東文. "黑猩猩優(yōu)化算法-極限學(xué)習(xí)機(jī)模型在富水性分級(jí)判定中的應(yīng)用." 人民黃河 43.7(2021):6.
[2]劉成漢, and 何慶. "融合多策略的黃金正弦黑猩猩優(yōu)化算法." 自動(dòng)化學(xué)報(bào) 47(2021):1-14.
博主簡(jiǎn)介:擅長(zhǎng)智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測(cè)、信號(hào)處理、元胞自動(dòng)機(jī)、圖像處理、路徑規(guī)劃、無(wú)人機(jī)等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問(wèn)題可私信交流。
部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。
總結(jié)
以上是生活随笔為你收集整理的【智能优化算法】基于黑猩猩算法求解多目标优化问题附matlab代码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: LOL不用下载就能玩了?
- 下一篇: Rapid Tampere加速联合产业创