calcpopfitness.m
来自「遗传规划的matlab工具箱」· M 代码 · 共 30 行
M
30 行
function [pop,state]=calcpopfitness(pop,params,data,state)
%CALCPOPFITNESS Calculate fitness values for a GPLAB population.
% CALCPOPFITNESS(POPULATION,PARAMS,DATA,STATE) returns the
% population with the fitness values for all individuals.
%
% [POPULATION,STATE]=CALCPOPFITNESS(...) also returns the
% updated state of the algorithm.
%
% Input arguments:
% POPULATION - the current population of individuals (array)
% PARAMS - the running parameters of the algorithm (struct)
% DATA - the dataset on which to measure the fitness (struct)
% STATE - the current state of the algorithm (struct)
% Output arguments:
% POPULATION - the population updated with fitness (array)
% STATE - the updated state of the algorithm (struct)
%
% See also CALCFITNESS
%
% Copyright (C) 2003-2004 Sara Silva (sara@dei.uc.pt)
% Acknowledgements: SINTEF (hso@sintef.no,jtt@sintef.no,okl@sintef.no)
% This file is part of the GPLAB Toolbox
for i=1:length(pop)
if isempty(pop(i).fitness)
[pop(i).fitness,pop(i).result,state]=calcfitness(pop(i).str,params,data,state);
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?