normal.m

来自「The Source of Genetic Programming develo」· M 代码 · 共 24 行

M
24
字号
function accept=normal(currentmean,state,params)
%NORMAL    Decides whether to accept a GPLAB individual into the population.
%   NORMAL(MEAN,STATE,PARAMS) returns true (acceptance) if the acceptance
%   of the individual improves the best average fitness obtained so far.
%   Returns false otherwise. It is not so easy to accept individuals under
%   these conditions, so the name is NORMAL (compare with light.m).
%   
%   Input arguments:
%      MEAN - average fitness obtained by accepting the individual (double)
%      STATE - the current state of the algorithm (struct)
%      PARAMS - the parameters of the algorithm (struct)
%   Output arguments:
%      ACCEPT - true if individual is accepted, false otherwise (boolean)
%
%   See also RESOURCES, LIGHT
%
%   Copyright (C) 2003-2007 Sara Silva (sara@dei.uc.pt)
%   This file is part of the GPLAB Toolbox

if ((currentmean<state.bestavgfitnesssofar) && (params.lowerisbetter)) || ((currentmean>state.bestavgfitnesssofar) && (~params.lowerisbetter))
    accept=1;
else
    accept=0;
end

⌨️ 快捷键说明

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