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

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

?? ga.m

?? wang xiao ping 版遺傳算法
?? 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       - the final population 
%   bPop         - a trace of the best population
%   traceInfo    - a matrix of best and means of the ga for each generation
%
% Input Arguments:
%   bounds       - a matrix of upper and lower bounds on the variables
%   evalFN       - the name of the evaluation .m function
%   evalOps      - options to pass to the evaluation function ([NULL])
%   startPop     - a matrix of solutions that can be initialized
%                  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 probabilistly 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])
n=nargin;
if n<2 | n==6 | n==10 | n==12
  disp('Insufficient arguements') 
end
if n<3 %Default evalation opts.
  evalOps=[];
end
if n<5
  opts = [1e-6 1 0];
end
if isempty(opts)
  opts = [1e-6 1 0];
end
if 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 ';'];
  end
else %Are using a .m file
  if opts(2)==1 %Float ga
    e1str=['[c1(xZomeLength) c1]=' evalFN '(c1,[gen evalOps]);'];  
    e2str=['[c2(xZomeLength) c2]=' evalFN '(c2,[gen evalOps]);'];  
  else %Binary ga
    e1str=['x=b2f(endPop(j,:),bounds,bits);[v x]=' evalFN ...
	'(x,[gen evalOps]); endPop(j,:)=[f2b(x,bounds,bits) v];'];  
  end
end
if n<6 %Default termination information
  termOps=[100];
  termFN='maxGenTerm';
end
if 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];
  end
end
if 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];
  end
end
if n<9 %Default select opts only i.e. roullete wheel.
  selectOps=[];
end
if n<8 %Default select info
  selectFN=['normGeomSelect'];
  selectOps=[0.08];
end
if n<6 %Default termination information
  termOps=[100];
  termFN='maxGenTerm';
end
if n<4 %No starting population passed given
  startPop=[];
end
if isempty(startPop) %Generate a population at random
  %startPop=zeros(80,size(bounds,1)+1);
  startPop=initialize(80,bounds,evalFN,evalOps,opts(1:2));
end
if opts(2)==0 %binary
  bits=calcbits(bounds,opts(1));
end
xOverFNs=parse(xOverFNs);
mutFNs=parse(mutFNs);
xZomeLength  = size(startPop,2); 	
%Length of the xzome=numVars+fittness
numVar       = xZomeLength-1; 		
%Number of variables
popSize      = size(startPop,1); 	
%Number of individuals in the pop
endPop       = zeros(popSize,xZomeLength); 
%A secondary population matrix
c1           = zeros(1,xZomeLength); 	%An individual
c2           = zeros(1,xZomeLength); 	%An individual
numXOvers    = size(xOverFNs,1); 	%Number of Crossover operators
numMuts      = size(mutFNs,1); 		%Number of Mutation operators
epsilon      = opts(1);                 %Threshold for two fittness to differ
oval         = max(startPop(:,xZomeLength)); %Best value in start pop
bFoundIn     = 1; 			%Number of times best has changed
done         = 0;                       %Done with simulated evolution
gen          = 1; 			%Current Generation Number
collectTrace = (nargout>3); 		%Should we collect info every gen
floatGA      = opts(2)==1;              %Probabilistic application of ops
display      = 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
  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 = rand*(popSize-1)+1; 	%Pick a parent
	b = 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 = 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 worst
end
[bval,bindx] = max(startPop(:,xZomeLength));
if display 
  fprintf(1,'\n%d %f\n',gen,bval);	  
end
x=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,:)];
end
if collectTrace
  traceInfo(gen,1)=gen; 		%current generation
  traceInfo(gen,2)=startPop(bindx,xZomeLength); %Best fittness
  traceInfo(gen,3)=mean(startPop(:,xZomeLength)); %Avg fittness
end

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91黄色激情网站| 成人av免费网站| 福利一区二区在线| 欧美日韩国产一区二区三区地区| 日韩三级高清在线| 亚洲精品国产品国语在线app| 麻豆精品视频在线观看视频| www.欧美亚洲| 久久久久久久久久久久久夜| 五月激情综合网| av影院午夜一区| 久久久久久97三级| 蜜臀av一区二区在线免费观看| 91麻豆免费看| 亚洲天堂2014| 岛国精品在线观看| 26uuu欧美| 老司机免费视频一区二区三区| 欧洲色大大久久| 亚洲视频免费看| 成人成人成人在线视频| 久久看人人爽人人| 另类小说色综合网站| 678五月天丁香亚洲综合网| 亚洲免费看黄网站| 91网上在线视频| 亚洲日本在线天堂| 91原创在线视频| 亚洲伦理在线精品| 欧美一区二区三区电影| 亚洲黄色小说网站| 一本久久a久久精品亚洲| 18成人在线观看| 99久久婷婷国产精品综合| 中文字幕一区二区三区视频| 国产高清无密码一区二区三区| 久久久一区二区| 国产成人精品免费| 亚洲欧洲另类国产综合| 99re6这里只有精品视频在线观看| 欧美国产综合色视频| 成人性生交大片免费看在线播放| 国产精品午夜电影| 91蜜桃视频在线| 亚洲电影视频在线| 欧美精品久久99| 久久精品国产亚洲a| 精品精品欲导航| 国产成人av电影| 亚洲欧美成人一区二区三区| 欧美三级资源在线| 日本成人在线一区| 久久久久久久久久久久久夜| 国产精品亚洲成人| 亚洲欧美日韩国产中文在线| 欧美视频在线一区二区三区| 香蕉加勒比综合久久| 日韩欧美国产精品| 粉嫩13p一区二区三区| 一区二区三区四区亚洲| 6080午夜不卡| 91在线码无精品| 日韩高清不卡一区二区三区| 久久九九久久九九| 欧美系列亚洲系列| 黑人巨大精品欧美一区| 亚洲免费观看高清完整版在线观看熊| 欧美日韩在线观看一区二区| 黄网站免费久久| 亚洲视频在线观看一区| 欧美一区二区视频在线观看 | 一区二区三区四区精品在线视频| 欧美色国产精品| 国产美女精品在线| 洋洋av久久久久久久一区| 日韩欧美亚洲国产精品字幕久久久| 国产不卡视频在线观看| 香蕉久久一区二区不卡无毒影院 | 亚洲精品免费播放| 日韩精品一区国产麻豆| 床上的激情91.| 免费高清视频精品| 亚洲激情图片一区| 欧美国产一区二区| 日韩视频免费直播| 欧美亚洲禁片免费| 成人精品鲁一区一区二区| 日本大胆欧美人术艺术动态| 亚洲同性gay激情无套| 久久久国产午夜精品| 欧美精品久久99| 欧美色手机在线观看| 成人h动漫精品一区二区| 久久成人久久爱| 日韩和欧美的一区| 亚洲曰韩产成在线| 成人欧美一区二区三区| 国产日韩欧美高清在线| 日韩欧美一区二区视频| 欧美精品久久久久久久多人混战| 在线免费观看成人短视频| 国产成人av一区二区三区在线 | 午夜不卡av在线| 亚洲综合成人在线| 亚洲精品精品亚洲| 亚洲色图制服丝袜| 中文字幕在线观看不卡| 欧美国产亚洲另类动漫| 国产欧美精品区一区二区三区 | 床上的激情91.| 国内成人自拍视频| 国产一区欧美二区| 激情五月激情综合网| 激情综合一区二区三区| 久久99精品久久久| 精品一区精品二区高清| 久久99精品国产麻豆不卡| 久久精品国产99国产精品| 美女性感视频久久| 国内久久婷婷综合| 国产精品456| 国产99久久久久| 成人黄色777网| 成人avav影音| 91黄色免费版| 日韩女优制服丝袜电影| 欧美v日韩v国产v| 久久精品亚洲一区二区三区浴池 | 成人性生交大片免费| 丰满亚洲少妇av| 91影院在线观看| 欧美视频在线观看一区| 欧美欧美欧美欧美首页| 日韩欧美国产一区在线观看| 久久综合狠狠综合久久综合88| 久久蜜桃av一区二区天堂| 久久久精品一品道一区| 日韩一区在线播放| 天天综合天天做天天综合| 久久国内精品视频| 不卡高清视频专区| 欧美日韩免费视频| 久久亚洲捆绑美女| 中文字幕日韩欧美一区二区三区| 夜夜嗨av一区二区三区网页| 蜜桃91丨九色丨蝌蚪91桃色| 福利视频网站一区二区三区| 精品视频一区 二区 三区| 精品国产123| 亚洲男人的天堂一区二区| 午夜电影一区二区三区| 国产 欧美在线| 欧美日韩国产高清一区| 久久久欧美精品sm网站| 亚洲精品日韩综合观看成人91| 另类专区欧美蜜桃臀第一页| 91亚洲精华国产精华精华液| 欧美一区二区私人影院日本| 亚洲欧洲性图库| 麻豆精品一区二区| 色老汉av一区二区三区| 精品国产三级电影在线观看| 亚洲精品第一国产综合野| 久久成人麻豆午夜电影| 日本道免费精品一区二区三区| 日韩欧美在线1卡| 亚洲一区二区三区四区五区中文 | 国产色综合久久| 亚洲曰韩产成在线| 成人性生交大合| 精品国产乱码91久久久久久网站| 亚洲自拍另类综合| 成人高清免费在线播放| 欧美mv日韩mv| 天天色天天操综合| 91九色02白丝porn| 国产精品系列在线| 国产高清精品网站| 欧美一区二区三区视频在线观看 | 国产精品传媒入口麻豆| 奇米亚洲午夜久久精品| 欧洲av一区二区嗯嗯嗯啊| 国产精品欧美综合在线| 国产一区在线看| 日韩免费一区二区三区在线播放| 一区二区三区四区在线免费观看| av成人免费在线| 久久久久久久av麻豆果冻| 精品一区二区三区视频 | 国内外成人在线| 日韩欧美国产综合| 男女视频一区二区| 在线播放欧美女士性生活| 亚洲一区二区3| 欧美在线观看一二区| 亚洲精品美腿丝袜| 欧美体内she精视频| 亚洲午夜影视影院在线观看| 在线观看av一区二区| 一区二区三区毛片|