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

📄 g_roulette_wheel.m

📁 real genetic algorithm matlab code
💻 M
字号:
%%%%% function g_roulette_wheel %%%%%
function [mating_pool]=g_roulette_wheel(Population,N,selection_probability);
cdf(1)=selection_probability(1);
for i=2:N;
    cdf(i)=cdf(i-1)+selection_probability(i);
end
for i=1:N;
    r=rand;
    for j=1:N
        if r<=cdf(j)
            mating_pool(i,:)=Population(j,:);
            break;
        end
    end
end
return;

⌨️ 快捷键说明

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