How to do the non dominated sorting ?
9 ビュー (過去 30 日間)
古いコメントを表示
I have a matrix i want to do non dominated sorting of the matrix and want to give the rank of the each row ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/901500/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/901500/image.jpeg)
Based on the value of Column f1 and f2 i want to make a new column named rank .Here the condition is both f1 and f2 column values are minimum and at the end I want to get the result
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/901505/image.jpeg)
Thanks in Advance .
0 件のコメント
回答 (1 件)
Ronit
2023 年 7 月 5 日
Hi
You can use the nondominatedsort function from the Multi-Objective Optimization (MOO) Toolbox to perform non-dominated sorting on a matrix. Here's an example of how you can do it:
% Add the MOO Toolbox to your MATLAB path
addpath('');
% Perform non-dominated sorting
fronts = nondominatedsort(matrix);
% Calculate the rank of each row
rank = zeros(size(matrix, 1), 1);
for i = 1:numel(fronts)
rank(fronts{i}) = i;
end
% Display the rank of each row
disp(rank);
Make sure to add path of the MOO toolbox inside addpath(''); .
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Direct Search についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!