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

📄 scaling.m

📁 matlab遗传算法工具箱
💻 M
字号:
% SCALING.m - linear fitness scaling%% This function implements a linear fitness scaling algorithm as described% by Goldberg in "Genetic Algorithms in Search, Optimization and Machine% Learning", Addison Wesley, 1989.  It use is not recommended when fitness% functions produce negative results as the scaling will become unreliable.% It is included in this version of the GA Toolbox only for the sake of% completeness.%% Syntax:	FitnV = scaling(ObjV, Smul)%% Input parameters:%%		Objv	- A vector containing the values of individuals%			  fitness.%%		Smul	- Optional scaling parameter (default 2).%% Output parameters:%%		FitnV	- A vector containing the individual fitnesses%			  for the current population.%			  %% Author: Andrew Chipperfield% Date: 24-Feb-94function FitnV = scaling( ObjV, Smul )if nargin == 1	Smul = 2 ;end[Nind, Nobj] = size( ObjV ) ;Oave = sum( ObjV ) / Nind ;Omin = min( ObjV ) ;Omax = max( ObjV ) ;if (Omin > ( Smul * Oave - Omax ) / ( Smul - 1.0 ))	delta = Omax - Oave 	a = ( Smul - 1.0 ) * Oave / delta 	b = Oave * ( Omax - Smul * Oave ) / delta else	delta = Oave - Omin ;	a = Oave / delta ;	b = -Omin * Oave / delta ;endFitnV = ObjV.*a + b ;

⌨️ 快捷键说明

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