找回密码
 注册
关于网站域名变更的通知
查看: 364|回复: 1
打印 上一主题 下一主题

非支配排序算法通用MATLAB代码

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2020-10-15 15:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

您需要 登录 才可以下载或查看,没有帐号?注册

x
  V! |  O$ L$ Z! ]( h: U6 i5 {/ ~  Y
规模为N的种群中的每个个体都要针对M个目标函数和种群中的N-1个个体进行比较,复杂度为O(MN),因此种群中的N个个体都比较结束的复杂度为O(MN2),即每进行一次Pareto分级的时间复杂度为O(MN2)。
$ ^! W1 j: H% K/ u! J, n) W# `" V( h5 |4 Y" w4 a
该算法需要保存两个量:) ?# y5 }9 X+ n3 s+ A% d

/ \, @. ]( t  u(1).支配个数np。该量是在可行解空间中可以支配个体p的所有个体的数量。
$ ]5 `6 v4 q  t( p; G7 r: {- c! Y
(2).被支配个体集合SP。该量是可行解空间中所有被个体p支配的个体组成的集合。1 J5 d; m* `3 M% z5 q. J8 {6 Z. c& ?! z

% z& O: c/ S$ ^: O! k6 ]matlab代码:! f: m" s9 R+ }" q7 w" S4 e$ R2 A

; X8 _! N8 Z, @6 e$ C/ r! l5 K(注意PopObj填入的多目标的函数值,如果有两个目标,100个个体,那么就是100*2的矩阵,nSort是前沿面的编号)
" w  H6 w( S+ |, |+ ]6 P. B6 t( f3 @3 M' o5 k8 P; n
  • function [FrontNO,MaxFNO] = NDSort(PopObj,nSort)
  • %NDSort - Do non-dominated sorting on the population by ENS
  • %
  • %   FrontNO = NDSort(A,s) does non-dominated sorting on A, where A is a
  • %   matrix which stores the objective values of all the individuals in the
  • %   population, and s is the number of individuals being sorted at least.
  • %   FrontNO(i) means the number of front of the i-th individual.
  • %
  • %   [FrontNO,K] = NDSort(...) also returns the maximum number of fronts,
  • %   except for the value of inf.
  • %
  • %   In particular, s = 1 stands for find only the first non-dominated
  • %   front, s = size(A,1)/2 stands for sort only half of the population
  • %   (which is often used in the algorithm), and s = inf stands for sort the
  • %   whole population.
  • %
  • %   Example:
  • %       [FrontNO,MaxFNO] = NDSort(PopObj,1)
  •     [N,M] = size(PopObj);
  •     FrontNO = inf(1,N);
  •     MaxFNO  = 0;
  •     [PopObj,rank] = sortrows(PopObj);
  •     while sum(FrontNO<inf) < min(nSort,N)
  •         MaxFNO = MaxFNO + 1;
  •         for i = 1 : N
  •             if FrontNO(i) == inf
  •                 Dominated = false;
  •                 for j = i-1 : -1 : 1
  •                     if FrontNO(j) == MaxFNO
  •                         m = 2;
  •                         while m <= M && PopObj(i,m) >= PopObj(j,m)
  •                             m = m + 1;
  •                         end
  •                         Dominated = m > M;
  •                         if Dominated || M == 2
  •                             break;
  •                         end
  •                     end
  •                 end
  •                 if ~Dominated
  •                     FrontNO(i) = MaxFNO;
  •                 end
  •             end
  •         end
  •     end
  •     FrontNO(rank) = FrontNO;
  • end
    3 n: ~' V# Z& C3 k0 w7 f
                  

该用户从未签到

2#
发表于 2020-10-15 16:16 | 只看该作者
非支配排序算法通用MATLAB代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

EDA365公众号

关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

GMT+8, 2025-7-29 13:15 , Processed in 0.109375 second(s), 23 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表