亚洲欧美第一页_禁久久精品乱码_粉嫩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 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]) 
%   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 3])
%   mutFNs       - a string containing blank seperated names of mutation.m 
%                  files ([nonUnifMutation])
%                           
%   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 100 3])




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(eevalFN<48) %Not using a .m file
  if opts(2)==1 %Float ga
    e1str=['x=c1; c1(xZomeLength)=', eevalFN ';'];  
    e2str=['x=c2; c2(xZomeLength)=', eevalFN ';'];  
  else %Binary ga
    e1str=['x=b2f(endPop(j,:),bounds,bits); endPop(j,xZomeLength)=',...
	eevalFN ';'];
  end
else %Are using a .m file
  if opts(2)==1 %Float ga
    e1str=['[c1 c1(xZomeLength)]=' eevalFN '(c1,[gen evalOps]);'];  
    e2str=['[c2 c2(xZomeLength)]=' eevalFN '(c2,[gen evalOps]);'];  
  else %Binary ga
    e1str=['x=b2f(endPop(j,:),bounds,bits);[x v]=' eevalFN ...
	'(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=initializega(80,bounds,evalFN,evalOps,opts(1:2));
  startPop=initializega(120,bounds,evalFN,evalOps,opts(1:2));
  startPop
  pause
end

if opts(2)==0 %binary
  bits=calcbits(bounds,opts(1));
end

nargin
n
selectFN=parse(selectFN)
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
nargin
numXOvers
numMuts
pause

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,:)
%  pause

  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
  
  endPop
  
  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,
        
numXOvers
pause
      xN=deblank(xOverFNs(i,:)); 	%Get the name of crossover function
xN  
      cp=find(rand(popSize,1)<xOverOps(i,1)==1);
xOverOps(i,1)
rand(popSize,1)
rand(popSize,1)<xOverOps(i,1)
rand(popSize,1)<xOverOps(i,1)==1

cp
      if rem(size(cp,1),2) cp=cp(1:(size(cp,1)-1)); end
      cp=reshape(cp,size(cp,1)/2,2);
cp      
      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,:));
mN      
      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,:);

x
startPop
pause
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精品福利视频| 欧美三区在线视频| 性久久久久久久久久久久| 欧美精品一区二区久久婷婷| 99这里都是精品| 精品一区二区三区香蕉蜜桃| 亚洲欧美自拍偷拍| 精品国产一区二区亚洲人成毛片| 在线观看一区二区视频| 国产成人免费在线观看| 麻豆成人久久精品二区三区红 | 在线欧美小视频| 国产一区二区不卡在线| 日本不卡一二三| 亚洲另类在线视频| 国产精品九色蝌蚪自拍| 久久婷婷久久一区二区三区| 欧美一区二区三区在线观看 | 美女在线视频一区| 亚洲一区自拍偷拍| 综合精品久久久| 久久精品亚洲一区二区三区浴池 | 在线播放视频一区| 欧美在线观看视频一区二区| 91啪九色porn原创视频在线观看| 国v精品久久久网| 国产一二三精品| 国模套图日韩精品一区二区 | 国产精品每日更新| 国产人伦精品一区二区| 欧美精品一区二区在线观看| 欧美一区二区三区视频免费播放 | 国产精品久久久久精k8| 久久午夜国产精品| 久久亚洲精精品中文字幕早川悠里 | 综合色中文字幕| 国产精品乱码一区二三区小蝌蚪| 久久精品在线观看| 国产亚洲欧洲997久久综合| 精品国产一区二区三区不卡| 日韩精品专区在线| 久久综合色综合88| 国产日韩影视精品| 国产精品人妖ts系列视频| 国产午夜精品一区二区三区嫩草| 久久精品亚洲国产奇米99| 精品盗摄一区二区三区| 亚洲精品一区二区三区精华液 | 欧美乱妇20p| 欧美一区二区三区精品| 日韩精品一区二区在线| 精品国产乱码久久久久久久| 久久久久国产免费免费| 国产欧美久久久精品影院| 国产精品免费aⅴ片在线观看| 中文字幕免费观看一区| 亚洲色图欧美激情| 亚洲www啪成人一区二区麻豆| 人人精品人人爱| 国产另类ts人妖一区二区| jlzzjlzz欧美大全| 欧美午夜精品久久久久久孕妇| 欧美日韩一级视频| 久久综合999| 亚洲欧洲av另类| 亚洲成av人影院在线观看网| 理论片日本一区| 成人午夜激情在线| 欧美性生活影院| 精品处破学生在线二十三| 欧美国产综合色视频| 亚洲最色的网站| 美女性感视频久久| 成人av综合在线| 欧美日韩亚洲国产综合| 久久综合色之久久综合| 一区二区三区在线高清| 麻豆精品蜜桃视频网站| 91麻豆精品在线观看| 欧美一区二区三区播放老司机| 中文字幕免费在线观看视频一区| 亚洲国产精品嫩草影院| 国产精品一区二区在线观看网站 | av一区二区三区| 欧美精品乱人伦久久久久久| 国产性色一区二区| 亚洲成av人片一区二区| 成人美女在线观看| 日韩欧美在线网站| 亚洲免费视频中文字幕| 韩国精品久久久| 欧洲色大大久久| 日本一区二区视频在线观看| 五月综合激情日本mⅴ| voyeur盗摄精品| 日韩精品一区二区三区在线播放| 亚洲理论在线观看| 国产一区欧美日韩| 在线电影一区二区三区| 1区2区3区精品视频| 精品一区二区三区香蕉蜜桃 | 国产激情精品久久久第一区二区 | 日韩欧美另类在线| 一区二区在线观看不卡| 成人午夜激情片| 欧美精品一区二区在线观看| 天堂一区二区在线| 91丝袜美腿高跟国产极品老师 | 亚洲成va人在线观看| 99久久精品一区| 国产婷婷色一区二区三区四区| 亚洲福利视频一区| 色94色欧美sute亚洲线路一久| 国产亚洲精品久| 精品一区二区精品| 欧美一区二区三区公司| 亚洲国产一区二区a毛片| 99久久精品国产导航| 日本一区二区综合亚洲| 国产成人精品网址| 久久久久国产成人精品亚洲午夜 | 国产精品77777| 欧美videos大乳护士334| 日韩专区中文字幕一区二区| 日本高清不卡视频| 亚洲免费看黄网站| 一本大道久久a久久精二百| 亚洲欧洲日韩av| 99精品久久只有精品| 国产精品欧美经典| 91久久免费观看| 亚洲香肠在线观看| 一道本成人在线| 一区av在线播放| 欧美网站大全在线观看| 亚洲电影视频在线| 欧美久久久一区| 午夜精品福利久久久| 777亚洲妇女| 日韩不卡在线观看日韩不卡视频| 欧美乱妇23p| 免费观看久久久4p| 欧美成人免费网站| 国产精品影视网| 中文字幕不卡在线播放| 成人毛片在线观看| 亚洲欧美日韩中文播放| 日本久久一区二区三区| 午夜久久福利影院| 日韩欧美精品在线视频| 国产一区二区三区黄视频| 国产精品日韩精品欧美在线| 色综合网色综合| 亚洲成人激情社区| 欧美成人一区二区三区片免费| 国产精品自在在线| 国产精品人妖ts系列视频| 91激情五月电影| 日韩国产欧美在线视频| 2021国产精品久久精品| 成人18精品视频| 亚洲影视在线播放| 日韩美女一区二区三区四区| 国产美女久久久久| 亚洲精品乱码久久久久久久久| 欧美日韩视频在线观看一区二区三区 | 麻豆久久久久久| 久久精品一区二区三区不卡牛牛 | 欧美一区二区三区精品| 国产精品资源网站| 一区二区三区加勒比av| 正在播放一区二区| 高清视频一区二区| 亚洲成人精品在线观看| 精品不卡在线视频| 99视频超级精品| 理论片日本一区| 亚洲视频一二三区| 精品乱人伦一区二区三区| 99久久综合精品| 免费成人av资源网| 樱花影视一区二区| 欧美电影免费观看高清完整版在 | 国产精品亲子伦对白| 欧美精品久久久久久久久老牛影院| 国精产品一区一区三区mba桃花| 亚洲免费观看高清完整版在线观看 | 日韩精品一区二区三区老鸭窝 | 精品视频1区2区| 国产一区二区在线观看免费| 亚洲激情图片小说视频| 久久久久久久久免费| 欧美丝袜第三区| 国产成人av电影在线观看| 丝袜诱惑亚洲看片| 亚洲欧美激情小说另类| 久久这里只有精品6| 欧美日韩精品系列| 91免费国产视频网站| 国产成人综合亚洲网站|