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

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

?? ga.m

?? 遺傳算法的源代碼下載,遺傳算法的源代碼下載
?? 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一区二区三区免费野_久草精品视频
欧美精品一区二区精品网| 欧美极品另类videosde| 亚洲欧美日韩中文播放| 国产高清在线观看免费不卡| 久久综合久久综合久久| 欧美亚洲综合久久| 成人的网站免费观看| 免费高清成人在线| 一级做a爱片久久| 欧美国产1区2区| 日韩久久精品一区| 欧美日韩国产经典色站一区二区三区| 成人精品小蝌蚪| 国产资源在线一区| 蜜桃久久精品一区二区| 亚洲国产一区视频| 一区二区三区美女| 亚洲色图在线视频| 国产精品毛片a∨一区二区三区| 欧美一激情一区二区三区| 欧美日韩在线三级| 欧美色综合天天久久综合精品| 97精品电影院| 91日韩在线专区| 成人av在线资源网| 不卡的av网站| 不卡一区在线观看| 成人国产精品免费观看动漫 | 国产欧美一区二区三区在线老狼| 7777精品伊人久久久大香线蕉完整版 | 欧美精品九九99久久| 不卡大黄网站免费看| 成人三级在线视频| 成人av在线看| 99这里都是精品| 99精品热视频| 色综合久久99| 欧美在线免费观看视频| 欧美在线观看18| 欧美日韩精品电影| 欧美日韩成人一区| 欧美一级高清片| 日韩欧美第一区| 精品福利一二区| 国产欧美日韩视频在线观看| 久久精品无码一区二区三区| 国产日韩欧美一区二区三区乱码 | 国产精品素人一区二区| 久久综合久色欧美综合狠狠| www久久精品| 国产精品乱人伦中文| 亚洲四区在线观看| 亚洲一卡二卡三卡四卡五卡| 石原莉奈在线亚洲二区| 久久精品国产成人一区二区三区| 国产一区视频导航| 成人免费观看av| 色婷婷激情综合| 777久久久精品| 久久久久综合网| 亚洲色图.com| 午夜成人免费视频| 国产精品综合av一区二区国产馆| 成人app网站| 欧美日韩精品一区二区天天拍小说| 91精品视频网| 国产精品色呦呦| 亚洲高清视频在线| 狠狠色伊人亚洲综合成人| 99久久伊人网影院| 欧美精品日日鲁夜夜添| 国产欧美日韩不卡免费| 亚洲欧美激情插| 亚洲自拍偷拍综合| 免费一级片91| 国产.欧美.日韩| 欧美日韩另类国产亚洲欧美一级| 精品动漫一区二区三区在线观看| 国产精品久99| 日本大胆欧美人术艺术动态| 国产98色在线|日韩| 欧美视频一区在线观看| 国产欧美日韩三区| 免费黄网站欧美| 91一区二区三区在线播放| 欧美电影免费观看高清完整版在| 中文字幕在线一区| 麻豆国产欧美一区二区三区| 99久久精品免费精品国产| 日韩情涩欧美日韩视频| 亚洲男人天堂一区| 国产精品一区二区免费不卡 | 欧美午夜电影在线播放| 欧美国产亚洲另类动漫| 日韩手机在线导航| 国产精品国产三级国产aⅴ入口| 亚洲高清免费在线| 成人听书哪个软件好| 欧美一区在线视频| 一卡二卡欧美日韩| 懂色av一区二区三区免费观看| 日韩午夜在线影院| 一区二区三区四区av| 岛国一区二区三区| 久久这里只精品最新地址| 亚洲444eee在线观看| 99久久综合狠狠综合久久| 久久久亚洲精品一区二区三区| 婷婷久久综合九色综合伊人色| 色婷婷久久久亚洲一区二区三区| 日本一区二区三区在线不卡 | a4yy欧美一区二区三区| 精品国产3级a| 久久成人av少妇免费| 欧美妇女性影城| 亚洲在线观看免费| 色94色欧美sute亚洲线路一ni| 中文字幕精品在线不卡| 国产麻豆精品在线| 久久亚洲精华国产精华液 | 中文一区二区在线观看 | 国产精品久久久久一区二区三区共| 日本vs亚洲vs韩国一区三区| 欧美性色黄大片手机版| 一区二区三区资源| 色哟哟在线观看一区二区三区| 1024成人网色www| 成人激情校园春色| 中文字幕乱码一区二区免费| 国产美女在线精品| 国产日韩视频一区二区三区| 国产东北露脸精品视频| 久久精品视频网| 国v精品久久久网| 中文字幕av一区 二区| 成人国产电影网| 亚洲欧洲日本在线| 日本高清不卡在线观看| 夜色激情一区二区| 欧美日韩国产bt| 日本亚洲电影天堂| 久久综合中文字幕| 成人18视频日本| 一区二区三区中文字幕精品精品| 色偷偷成人一区二区三区91| 亚洲精品国产品国语在线app| 在线亚洲高清视频| 日本伊人精品一区二区三区观看方式| 日韩视频免费观看高清完整版| 国产在线一区观看| 国产精品人人做人人爽人人添| 99久久久久免费精品国产 | www日韩大片| 丁香一区二区三区| 亚洲精选一二三| 91精品福利在线一区二区三区| 国产在线精品一区二区不卡了| 中文字幕电影一区| 欧美亚洲高清一区二区三区不卡| 亚洲bt欧美bt精品| 久久久久久一二三区| 一本一道波多野结衣一区二区| 婷婷综合久久一区二区三区| 久久久综合九色合综国产精品| 91无套直看片红桃| 免费在线视频一区| 中文字幕亚洲一区二区va在线| 欧美日韩极品在线观看一区| 国内成人免费视频| 亚洲裸体xxx| 91精品国产综合久久久久久久| wwwwww.欧美系列| 色婷婷精品大在线视频| 蜜桃av一区二区在线观看 | 亚洲天堂2016| 在线成人免费视频| 成人av在线播放网址| 视频一区二区三区在线| 亚洲国产精品v| 56国语精品自产拍在线观看| 成人午夜看片网址| 男女男精品视频网| 亚洲视频一区二区免费在线观看| 日韩一区二区三区视频| 不卡欧美aaaaa| 另类小说视频一区二区| 国产精品女主播av| 日韩免费一区二区| 色综合av在线| 国产91精品欧美| 欧美a级一区二区| 亚洲精品欧美激情| 国产视频一区在线观看| 日韩欧美在线1卡| 在线观看www91| gogo大胆日本视频一区| 久久精品国产亚洲一区二区三区| 一区二区三区四区亚洲| 国产精品网友自拍| 精品国偷自产国产一区|