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

📄 normgeomselect.m

📁 在工业工程中,许多最优化问题性质十分复杂,很难用传统的优化方法来求解.自1960年以来,人们对求解这类难解问题日益增加.一种模仿生物自然进化过程的、被称为“进化算法(evolutionary algo
💻 M
字号:
function[newPop] = normGeomSelect(oldPop,options)% NormGeomSelect is a ranking selection function based on the normalized% geometric distribution.  %% function[newPop] = normGeomSelect(oldPop,options)% newPop  - the new population selected from the oldPop% oldPop  - the current population% options - options to normGeomSelect [gen probability_of_selecting_best]% Binary and Real-Valued Simulation Evolution for Matlab % Copyright (C) 1996 C.R. Houck, J.A. Joines, M.G. Kay %% C.R. Houck, J.Joines, and M.Kay. A genetic algorithm for function% optimization: A Matlab implementation. ACM Transactions on Mathmatical% Software, Submitted 1996.%% This program is free software; you can redistribute it and/or modify% it under the terms of the GNU General Public License as published by% the Free Software Foundation; either version 1, or (at your option)% any later version.%% This program is distributed in the hope that it will be useful,% but WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% GNU General Public License for more details. A copy of the GNU % General Public License can be obtained from the % Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.q=options(2); 				% Probability of selecting the beste = size(oldPop,2); 			% Length of xZome, i.e. numvars+fitn = size(oldPop,1); 			% Number of individuals in popnewPop = zeros(n,e); 			% Allocate space for return popfit = zeros(n,1); 			% Allocates space for prob of selectx=zeros(n,2); 			        % Sorted list of rank and idx(:,1) =[n:-1:1]'; 			% To know what element it was[y x(:,2)] = sort(oldPop(:,e)); 	% Get the index after a sortr = q/(1-(1-q)^n); 			% Normalize the distribution, q primefit(x(:,2))=r*(1-q).^(x(:,1)-1); 	% Generates Prob of selection fit = cumsum(fit); 			% Calculate the cumulative prob. funcrNums=sort(rand(n,1)); 			% Generate n sorted random numbersfitIn=1; newIn=1; 			% Initialize loop controlwhile newIn<=n 				% Get n new individuals  if(rNums(newIn)<fit(fitIn)) 		    newPop(newIn,:) = oldPop(fitIn,:); 	% Select the fitIn individual     newIn = newIn+1; 			% Looking for next new individual  else    fitIn = fitIn + 1; 			% Looking at next potential selection  endend

⌨️ 快捷键说明

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