non-dominated sorting算法的matlab实现
来源:互联网 发布:pp软件2015下载 编辑:程序博客网 时间:2024/06/06 01:49
实现了一个non-dominated sorting的算法,效率是最差的那种,但是感觉思路很清晰。先描述下思路吧:
1:对于全部的种群N,每一条染色体上的元素是这么个意思[决策变量 目标函数值 rank distance],在这个地方我主要是设置rank,distance是另外步骤用的。
2:首先一个空的集合has_assigend_index 也就是已经找到rank的就挪到这里面来。
3:依次从第一个染色体开始,看看有没有已经被assigned,如果没有那就查看是否有别的dominate它,如果没有那么它就是non-dominate的了,设置当前的rank以及放入到has_assigned_index中去。一直到被全部放入到has_assigned_index。那么就完成了全部的rank的设置,并且同时还按照front的level的到对应的结果集,这个是用于distance的时候用的。
代码如下:
function [ chromosomes, fronts ] = nondominated_sorting( chromosomes, number_of_decision_variables, number_of_objectives )
% each chromosome contains four segments,[decision_variables,
% corresponding_objective_value, rank_of_front, crowding_distance].
% when this function is finished, rank of each chromosome will be assigned
% the third segment.
% Besides, a struct named “fronts” would be also got, it’s form is like
% this: fronts{i}=[chromosome1, ….], i is the rank of chromosome1…
V = number_of_decision_variables;
Q = number_of_objectives;
[M, N] = size(chromosomes);
F = 0;
fronts = [];
% once the chromosome i is assgned to the fronts, its’ index will be remove to
% has_assigned_index.
has_assigned_index = [];
F = 0;
while length(has_assigned_index) ~= M
length(has_assigned_index)
F = F + 1
fronts{F} = [];
for i = 1:M
dominate_i = [];
if isempty(find(has_assigned_index == i))
for j = 1:M
if (i ~= j) && (isempty(find(has_assigned_index == j)))
fprintf(‘compare %d, %d\n’, i, j);
less_count = 0;
equal_count = 0;
more_count = 0;
for k=V+1:V+Q
if chromosomes(i, k) < chromosomes(j, k)
less_count = less_count + 1;
elseif chromosomes(i, k) > chromosomes(j, k)
more_count = more_count + 1;
else
equal_count = equal_count + 1;
end
end
if (more_count > 0) && (less_count == 0)
% j dominates i
dominate_i = [dominate_i j];
end
end
end
if length(dominate_i) == 0
has_assigned_index = [has_assigned_index i];
chromosomes(i, end-1) = F;
fronts{F} = [fronts{F} i];
end
end
end
end
- non-dominated sorting算法的matlab实现
- 匈牙利算法的MatLab实现
- 蒙特卡罗算法的matlab实现
- KNN的matlab实现算法
- SIFT算法的MATLAB实现
- 遗传算法的matlab实现
- 遗传算法的matlab实现
- DES算法的matlab实现
- SIFT算法的Matlab实现
- KNN算法的matlab实现
- OMP算法的matlab实现
- 遗传算法的matlab实现
- 遗传算法的matlab实现
- RVM算法的matlab实现
- gmapping算法的MATLAB实现
- fcm算法的MATLAB实现
- Matlab的图像细化算法(详细实现)
- 一个 Dense SIFT 算法的 matlab 实现
- 数据结构和算法 C/C++ Java 和 C# 版 - (2)线性表 精准表述 实现
- SQL*PLUS命令
- path变量备份
- 10个字符串做排序
- LruCache算法
- non-dominated sorting算法的matlab实现
- kkpager-master 这个分页插件的用法
- xcode7.1 cordova 打包的工程 报错 error--> cordova/CDVViewController.h
- [2019]:数列有序
- Leetcode #23 Merge k Sorted Lists
- [2020]:绝对值排序
- 使用mysql yum包安装mysql5.5
- C# 制作软件启动画面
- [IOS]绑定事件时,为何看不到具体的UIControlEvents对象,只有事件委托?