编程语言
首页 > 编程语言> > 【优化求解】基于政治优化算法求解最优目标matlab代码

【优化求解】基于政治优化算法求解最优目标matlab代码

作者:互联网

1 简介

PO 是由巴基斯坦国立计算机和新兴科学大学的 Qamar Askari 等人于 2020 年提出的一种受社会启发的新型全局优化算法,灵感来源于政治的多阶段过程。该算法通过将种群从逻辑上划分为政党和选区,赋予每个解双重角色,便于每个候选人更新政党领袖和选区获胜者的位置。

2 部分代码

%%%%%%%%%%%%%%%%%%%%% Parliamentarism %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

for a=1:areas

    newAWinner = aWinners(a,:);

    i = aWinnerInd(a);    

    

    toa = randi(areas);

    while(toa == a)

        toa = randi(areas);

    end

toAWinner = aWinners(toa,:);

    for j = 1:dim

        distance = abs(toAWinner(1,j) - newAWinner(1,j));

        newAWinner(1,j) a= toAWinner(1,j) + (2*rand()-1) * distance;

    end

    newAWFitness=fobj(newAWinner(1,:));

    

%Replace only if improves

if newAWFitness < fitness(i) 

        Positions(i,:) = newAWinner(1,:);

        fitness(i) = newAWFitness;

        aWinners(a,:) = newAWinner(1,:);

end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

3 仿真结果

4 参考文献

图片


 

标签:end,求解,toAWinner,newAWinner,newAWFitness,matlab,toa,优化,areas
来源: https://blog.csdn.net/qq_59747472/article/details/121599385