delta.m

来自「遗传算法的源程序」· M 代码 · 共 16 行

M
16
字号
function[change] = delta(ct,mt,y,b)
% The delta function is the non-uniform distributions used by the nonUniform
% mutations.  This function returns a change based on the current gen, the
% max gen and the amount of possible deviation.
%
% function[change] = delta(ct,mt,y,b)
% ct - current generation
% mt - maximum generation
% y  - maximum amount of change, i.e. distance from parameter value to bounds
% b  - shape parameter
r=ct/mt;
if(r>1)
  r=.99;
  % disp(sprintf('max gen %d < current gen %d setting ratio = 1',mt,ct));
end
change = y*(rand*(1-r))^b;

⌨️ 快捷键说明

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