⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tournament_selection.m

📁 对多目标优化算法NSGA-II算法的改进
💻 M
字号:
function f = tournament_selection(pop,pool_size,tour_size)
    [popsize variables] = size(pop);
    rank = variables - 1;
    crowding_distance = variables;
    for i = 1 : pool_size
        for j = 1 : tour_size
            candidate(j) = round((popsize - 1)*rand) + 1;
            if (j > 1)
                while (~isempty(find(candidate(1 : j - 1) == candidate(j))))
                    candidate(j) = round((popsize - 1)*rand) + 1;
                end
            end
        end
        for j = 1 : tour_size
            rank_objectives(j) = pop(candidate(j),rank);
            crowding_distance_objectives(j) = pop(candidate(j),crowding_distance);
        end
        min_candidate = find(rank_objectives == min(rank_objectives));
        if (length(min_candidate) > 1)
            max_candidate = find(crowding_distance_objectives(min_candidate) == max(crowding_distance_objectives(min_candidate)));
            f(i,:) = pop(candidate(min_candidate(max_candidate(1))),:);
        else
            f(i,:) = pop(candidate(min_candidate(1)),:);
        end
    end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -