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

📄 fps.m

📁 这是好用的源代码
💻 M
字号:
% function fps_num = fps(fit)
%
% This function uses Fitness Proportionate Reproduction (FPS) to select
% an individual for reproduction, mutation, or cross over. For use with
% tree_ga2.m
%

% Author             Date     Predecessor   Modification
% ======             ====     ===========   ============
% B.McKay M.Willis   25/5/95       -             -
%
% Function Calls: 
% ==============  
%    
% Last Modification: 25/5/95
% =================
%

function fps_num = fps(fit)

% Find the cumulative probability
prob=fit./sum(fit);
cum_prob=cumsum(prob);

% Select a random number between 0 and 1
r_num=rand(1);

I=find(cum_prob > r_num);
fps_num=I(1);

⌨️ 快捷键说明

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