亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ga.m

?? 主要用于遺傳算法的簡單應用,有利于初學者應用MATLAB軟件.
?? M
字號:
function [x,endPop,bPop,traceInfo] = ga(bounds,evalFN,evalOps,startPop,opts,...termFN,termOps,selectFN,selectOps,xOverFNs,xOverOps,mutFNs,mutOps)% GA run a genetic algorithm% function [x,endPop,bPop,traceInfo]=ga(bounds,evalFN,evalOps,startPop,opts,%                                       termFN,termOps,selectFN,selectOps,%                                       xOverFNs,xOverOps,mutFNs,mutOps)%                                % Output Arguments:%   x            - the best solution found during the course of the run%   endPop       - 最終種群%   bPop         - a trace of the best population%   traceInfo    - a matrix of best and means of the ga for each generation%% Input Arguments:%   bounds       - 變量的上界和下界矩陣%   evalFN       - 適應度函數的名稱%   evalOps      - options to pass to the evaluation function ([NULL])%   startPop     - 由初始化函數得到的初始種群%                  from initialize.m%   opts         - [epsilon prob_ops display] change required to consider two %                  solutions different, prob_ops 0 if you want to apply the%                  genetic operators probabilisticly to each solution, 1 if%                  you are supplying a deterministic number of operator%                  applications and display is 1 to output progress 0 for%                  quiet. ([1e-6 1 0])%   termFN       - name of the .m termination function (['maxGenTerm'])%   termOps      - options string to be passed to the termination function%                  ([100]).%   selectFN     - name of the .m selection function (['normGeomSelect'])%   selectOpts   - options string to be passed to select after%                  select(pop,#,opts) ([0.08])%   xOverFNS     - a string containing blank seperated names of Xover.m%                  files (['arithXover heuristicXover simpleXover']) %   xOverOps     - A matrix of options to pass to Xover.m files with the%                  first column being the number of that xOver to perform%                  similiarly for mutation ([2 0;2 3;2 0])%   mutFNs       - a string containing blank seperated names of mutation.m %                  files (['boundaryMutation multiNonUnifMutation ...%                           nonUnifMutation unifMutation'])%   mutOps       - A matrix of options to pass to Xover.m files with the%                  first column being the number of that xOver to perform%                  similiarly for mutation ([4 0 0;6 100 3;4 100 3;4 0 0])% 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.%%$Log: ga.m,v $%Revision 1.10  1996/02/02  15:03:00  jjoine% Fixed the ordering of imput arguments in the comments to match% the actual order in the ga function.%%Revision 1.9  1995/08/28  20:01:07  chouck% Updated initialization parameters, updated mutation parameters to reflect% b being the third option to the nonuniform mutations%%Revision 1.8  1995/08/10  12:59:49  jjoine%Started Logfile to keep track of revisions%n=nargin;if n<2 | n==6 | n==10 | n==12  disp('Insufficient arguements') endif n<3 %Default evalation opts.  evalOps=[];endif n<5  opts = [1e-6 1 0];endif isempty(opts)  opts = [1e-6 1 0];endif any(evalFN<48) %Not using a .m file  if opts(2)==1 %Float ga    e1str=['x=c1; c1(xZomeLength)=', evalFN ';'];      e2str=['x=c2; c2(xZomeLength)=', evalFN ';'];    else %Binary ga    e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',...	evalFN ';'];  endelse %Are using a .m file  if opts(2)==1 %Float ga    e1str=['[c1 c1(xZomeLength)]=' evalFN '(c1,[gen evalOps]);'];      e2str=['[c2 c2(xZomeLength)]=' evalFN '(c2,[gen evalOps]);'];    else %Binary ga    e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' evalFN ...	'(x,[gen evalOps]); endPop(j,:)=[f2b(x,bounds,bits) v];'];    endendif n<6 %Default termination information  termOps=[100];  termFN='maxGenTerm';endif n<12 %Default muatation information  if opts(2)==1 %Float GA  mutFNs=['boundaryMutation multiNonUnifMutation nonUnifMutation unifMutation'];    mutOps=[4 0 0;6 termOps(1) 3;4 termOps(1) 3;4 0 0];  else %Binary GA    mutFNs=['binaryMutation'];    mutOps=[0.05];  endendif n<10 %Default crossover information  if opts(2)==1 %Float GA    xOverFNs=['arithXover heuristicXover simpleXover'];    xOverOps=[2 0;2 3;2 0];  else %Binary GA    xOverFNs=['simpleXover'];    xOverOps=[0.6];  endendif n<9 %Default select opts only i.e. roullete wheel.  selectOps=[];endif n<8 %Default select info  selectFN=['normGeomSelect'];  selectOps=[0.08];endif n<6 %Default termination information  termOps=[100];  termFN='maxGenTerm';endif n<4 %No starting population passed given  startPop=[];endif isempty(startPop) %Generate a population at random  %startPop=zeros(80,size(bounds,1)+1);  startPop=initializega(80,bounds,evalFN,evalOps,opts(1:2));endif opts(2)==0 %binary  bits=calcbits(bounds,opts(1));endxOverFNs=parse(xOverFNs);mutFNs=parse(mutFNs);xZomeLength  = size(startPop,2); 	%Length of the xzome=numVars+fittnessnumVar       = xZomeLength-1; 		%Number of variablespopSize      = size(startPop,1); 	%Number of individuals in the popendPop       = zeros(popSize,xZomeLength); %A secondary population matrixc1           = zeros(1,xZomeLength); 	%An individualc2           = zeros(1,xZomeLength); 	%An individualnumXOvers    = size(xOverFNs,1); 	%Number of Crossover operatorsnumMuts      = size(mutFNs,1); 		%Number of Mutation operatorsepsilon      = opts(1);                 %Threshold for two fittness to differoval         = max(startPop(:,xZomeLength)); %Best value in start popbFoundIn     = 1; 			%Number of times best has changeddone         = 0;                       %Done with simulated evolutiongen          = 1; 			%Current Generation NumbercollectTrace = (nargout>3); 		%Should we collect info every genfloatGA      = opts(2)==1;              %Probabilistic application of opsdisplay      = opts(3);                 %Display progress while(~done)  %Elitist Model  [bval,bindx] = max(startPop(:,xZomeLength)); %Best of current pop  best =  startPop(bindx,:);  if collectTrace    traceInfo(gen,1)=gen; 		          %current generation    traceInfo(gen,2)=startPop(bindx,xZomeLength);       %Best fittness    traceInfo(gen,3)=mean(startPop(:,xZomeLength));     %Avg fittness    traceInfo(gen,4)=std(startPop(:,xZomeLength));   end    if ( (abs(bval - oval)>epsilon) | (gen==1)) %If we have a new best sol    if display      fprintf(1,'\n%d %f\n',gen,bval);          %Update the display    end    if floatGA      bPop(bFoundIn,:)=[gen startPop(bindx,:)]; %Update bPop Matrix    else      bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)...	  startPop(bindx,xZomeLength)];    end    bFoundIn=bFoundIn+1;                      %Update number of changes    oval=bval;                                %Update the best val  else    if display      fprintf(1,'%d ',gen);	              %Otherwise just update num gen    end  end    endPop = feval(selectFN,startPop,[gen selectOps]); %Select    if floatGA %Running with the model where the parameters are numbers of ops    for i=1:numXOvers,      for j=1:xOverOps(i,1),	a = round(rand*(popSize-1)+1); 	%Pick a parent	b = round(rand*(popSize-1)+1); 	%Pick another parent	xN=deblank(xOverFNs(i,:)); 	%Get the name of crossover function	[c1 c2] = feval(xN,endPop(a,:),endPop(b,:),bounds,[gen xOverOps(i,:)]);		if c1(1:numVar)==endPop(a,(1:numVar)) %Make sure we created a new 	  c1(xZomeLength)=endPop(a,xZomeLength); %solution before evaluating	elseif c1(1:numVar)==endPop(b,(1:numVar))	  c1(xZomeLength)=endPop(b,xZomeLength);	else 	  %[c1(xZomeLength) c1] = feval(evalFN,c1,[gen evalOps]);	  eval(e1str);	end	if c2(1:numVar)==endPop(a,(1:numVar))	  c2(xZomeLength)=endPop(a,xZomeLength);	elseif c2(1:numVar)==endPop(b,(1:numVar))	  c2(xZomeLength)=endPop(b,xZomeLength);	else 	  %[c2(xZomeLength) c2] = feval(evalFN,c2,[gen evalOps]);	  eval(e2str);	end      		endPop(a,:)=c1;	endPop(b,:)=c2;      end    end      for i=1:numMuts,      for j=1:mutOps(i,1),	a = round(rand*(popSize-1)+1);	c1 = feval(deblank(mutFNs(i,:)),endPop(a,:),bounds,[gen mutOps(i,:)]);	if c1(1:numVar)==endPop(a,(1:numVar)) 	  c1(xZomeLength)=endPop(a,xZomeLength);	else	  %[c1(xZomeLength) c1] = feval(evalFN,c1,[gen evalOps]);	  eval(e1str);	end	endPop(a,:)=c1;      end    end      else %We are running a probabilistic model of genetic operators    for i=1:numXOvers,      xN=deblank(xOverFNs(i,:)); 	%Get the name of crossover function      cp=find(rand(popSize,1)<xOverOps(i,1)==1);      if rem(size(cp,1),2) cp=cp(1:(size(cp,1)-1)); end      cp=reshape(cp,size(cp,1)/2,2);      for j=1:size(cp,1)	a=cp(j,1); b=cp(j,2); 	[endPop(a,:) endPop(b,:)] = feval(xN,endPop(a,:),endPop(b,:),...	  bounds,[gen xOverOps(i,:)]);      end    end    for i=1:numMuts      mN=deblank(mutFNs(i,:));      for j=1:popSize	endPop(j,:) = feval(mN,endPop(j,:),bounds,[gen mutOps(i,:)]);	eval(e1str);      end    end  end    gen=gen+1;  done=feval(termFN,[gen termOps],bPop,endPop); %See if the ga is done  startPop=endPop; 			%Swap the populations    [bval,bindx] = min(startPop(:,xZomeLength)); %Keep the best solution  startPop(bindx,:) = best; 		%replace it with the worstend[bval,bindx] = max(startPop(:,xZomeLength));if display   fprintf(1,'\n%d %f\n',gen,bval);	  endx=startPop(bindx,:);if opts(2)==0 %binary  x=b2f(x,bounds,bits);  bPop(bFoundIn,:)=[gen b2f(startPop(bindx,1:numVar),bounds,bits)...      startPop(bindx,xZomeLength)];else  bPop(bFoundIn,:)=[gen startPop(bindx,:)];endif collectTrace  traceInfo(gen,1)=gen; 		%current generation  traceInfo(gen,2)=startPop(bindx,xZomeLength); %Best fittness  traceInfo(gen,3)=mean(startPop(:,xZomeLength)); %Avg fittnessend

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产色一区二区| 婷婷国产v国产偷v亚洲高清| 久久夜色精品国产噜噜av | 亚洲国产婷婷综合在线精品| 18成人在线视频| 国产精品福利电影一区二区三区四区| 国产色产综合色产在线视频| 久久久精品黄色| 中文字幕久久午夜不卡| 国产精品乱码一区二三区小蝌蚪| 日本一区二区三区在线观看| 国产精品久久久久久久久免费樱桃| 国产精品嫩草久久久久| 亚洲欧美在线另类| 一区二区在线观看视频| 亚洲第一主播视频| 青草国产精品久久久久久| 久久精品国产精品亚洲精品| 极品少妇xxxx精品少妇偷拍| 国产精品综合一区二区| 国产成人av一区二区三区在线 | 日韩欧美国产午夜精品| 日韩精品一区二区三区中文不卡| 精品免费视频一区二区| 日本一区二区久久| 亚洲欧美日韩系列| 一区二区三区91| 蜜臀国产一区二区三区在线播放 | 欧美不卡视频一区| 国产欧美一区二区三区鸳鸯浴 | 欧美高清在线一区二区| 一区二区三区自拍| 日韩不卡在线观看日韩不卡视频| 精品影院一区二区久久久| 国产成人啪午夜精品网站男同| 色偷偷久久人人79超碰人人澡 | 18欧美亚洲精品| 首页亚洲欧美制服丝腿| 国产精品一区在线观看乱码 | 亚洲精品成人悠悠色影视| 亚洲一区二区四区蜜桃| 蜜臀av一区二区| 不卡的av电影| 91精品国产全国免费观看| 久久久美女艺术照精彩视频福利播放| 国产精品国产馆在线真实露脸| 午夜精品一区二区三区电影天堂| 国产精品正在播放| 欧美日韩精品一区二区在线播放| 亚洲精品一线二线三线| 一区二区高清免费观看影视大全| 久久99精品久久久| 色吧成人激情小说| 久久丝袜美腿综合| 亚洲福中文字幕伊人影院| 国产乱码字幕精品高清av | 国产精品国产三级国产| 日本aⅴ亚洲精品中文乱码| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 成人av在线网站| 欧美一卡二卡在线| 亚洲欧美日韩久久| 国产成人av电影免费在线观看| 欧美日韩一区不卡| 国产精品成人一区二区三区夜夜夜| 日本怡春院一区二区| 91福利在线播放| 国产亚洲欧美中文| 麻豆国产精品官网| 欧美日韩国产区一| 中文字幕乱码亚洲精品一区| 美女一区二区在线观看| 欧美日韩三级一区| 成人欧美一区二区三区| 国产成人精品免费| 欧美va亚洲va香蕉在线| 日韩不卡免费视频| 欧美在线视频日韩| 国产精品国产三级国产普通话三级 | 欧美成人三级电影在线| 亚洲国产成人porn| 色女孩综合影院| 亚洲欧洲av另类| 成人精品国产一区二区4080| 久久一留热品黄| 久久99国产精品免费| 91精品久久久久久久91蜜桃| 亚洲电影激情视频网站| 色哟哟一区二区在线观看| 国产精品天干天干在线综合| 国产一区二区福利视频| 精品日本一线二线三线不卡 | 欧美乱熟臀69xxxxxx| 亚洲精品伦理在线| 99精品国产视频| 国产精品久久影院| 大美女一区二区三区| 国产亚洲综合性久久久影院| 国内精品免费**视频| 精品国产乱码久久久久久影片| 秋霞午夜av一区二区三区| 欧美精三区欧美精三区| 亚洲高清视频中文字幕| 欧美理论片在线| 天堂蜜桃91精品| 91麻豆精品国产91久久久使用方法| 亚洲国产精品视频| 欧美疯狂性受xxxxx喷水图片| 91美女片黄在线观看| 亚洲激情五月婷婷| 欧美亚洲动漫另类| 五月综合激情网| 欧美一区国产二区| 久久91精品国产91久久小草| 精品国一区二区三区| 国产乱码精品一区二区三区av | 欧美在线视频日韩| 日韩综合在线视频| 日韩视频在线你懂得| 韩国成人在线视频| 国产精品你懂的| 欧美午夜视频网站| 麻豆极品一区二区三区| 久久久久综合网| 99在线热播精品免费| 亚洲高清视频在线| 欧美大尺度电影在线| 国产成人精品免费| 亚洲精品久久嫩草网站秘色| 欧美久久久影院| 国产一区二区三区在线观看免费视频 | 欧美一区二区三区小说| 经典三级在线一区| 中文字幕高清不卡| 欧日韩精品视频| 久久精品国产99国产| 亚洲国产成人午夜在线一区| 91亚洲精品久久久蜜桃网站| 五月天激情小说综合| 久久亚洲一级片| 在线观看中文字幕不卡| 裸体健美xxxx欧美裸体表演| 国产日韩欧美在线一区| 91成人看片片| 狠狠网亚洲精品| 亚洲色图.com| 日韩欧美激情四射| 97久久精品人人做人人爽50路| 亚洲高清视频中文字幕| 精品一区二区三区免费播放 | 狠狠色综合播放一区二区| 中文字幕中文字幕一区二区| 欧美剧在线免费观看网站| 国产精品一区二区在线观看不卡 | 日av在线不卡| 中文字幕一区二区三区av | 日本伊人色综合网| 国产精品久久久久影院| 5月丁香婷婷综合| caoporn国产一区二区| 美女在线一区二区| 亚洲婷婷在线视频| 26uuu精品一区二区三区四区在线| 91久久精品一区二区三区| 国产精品系列在线播放| 亚洲h动漫在线| 国产精品久久久久久久久动漫 | 午夜免费久久看| 国产精品麻豆网站| 欧美大片一区二区| 欧美亚洲综合网| 99久久综合国产精品| 精品亚洲porn| 亚洲不卡av一区二区三区| 精品久久久久av影院| 欧美日韩精品专区| 色视频欧美一区二区三区| 国产成人免费在线视频| 久久精品国产一区二区三| 亚洲电影在线免费观看| 成人欧美一区二区三区黑人麻豆| 26uuu另类欧美| 欧美一级免费大片| 91蝌蚪国产九色| 国产69精品久久777的优势| 五月激情六月综合| 欧美高清在线精品一区| 99久久久久久| 樱花影视一区二区| 欧美电影免费观看高清完整版在线| 五月天一区二区三区| 精品国产乱码久久久久久图片| 亚洲午夜电影在线观看| 91美女片黄在线| 日本sm残虐另类| 精品国产凹凸成av人网站| www.亚洲色图.com| 亚洲一二三级电影| 日韩精品一区国产麻豆| 成人爽a毛片一区二区免费|