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

📄 linearppp.m

📁 The Source of Genetic Programming developed in Matlab
💻 M
字号:
function ind=linearppp(ind,params)
%LINEARPPP    Applies linear parametric parsimony pressure to a GPLAB individual.
%   LINEARPPP(INDIVIDUAL,PARAMS) returns the fitness of an individual
%   after applying linear parametric parsimony pressure of the form
%   fitness = x * fitness + size (if lower fitness is better) or
%   fitness = x * fitness - size (otherwise).
%
%   Input arguments:
%      INDIVIDUAL - the individual whose fitness is to change (struct)
%      PARAMS - the running parameters of the algorithm (struct)
%   Output arguments:
%      INDIVIDUAL - the individual whose fitness was changed (1xN matrix)
%
%   See also CALCFITNESS
%
%   References:
%   Luke, S. and Panait, L. A Comparison of Bloat Control Methods for
%   Genetic Programming. Evolutionary Computation 14(3):309-344 (2006)
%
%   Copyright (C) 2003-2007 Sara Silva (sara@dei.uc.pt)
%   This file is part of the GPLAB Toolbox

% parameters of this tournament:
% (best cross-problem settings - see reference):
x=32;

if isempty(ind.nodes)
    ind.nodes=nodes(ind.tree);
end

if params.lowerisbetter
    ind.adjustedfitness=x*ind.fitness+ind.nodes;
else
    ind.adjustedfitness=x*ind.fitness-ind.nodes;
end

⌨️ 快捷键说明

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