亚洲欧美第一页_禁久久精品乱码_粉嫩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       - 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(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 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];'];  
  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一区二区三区免费野_久草精品视频
精品视频123区在线观看| 91福利在线免费观看| 日韩成人精品在线| 一区二区三区电影在线播| 国产精品系列在线| 国产女人aaa级久久久级| 国产日韩欧美高清在线| 国产午夜久久久久| 国产精品网友自拍| 亚洲欧洲av在线| 亚洲线精品一区二区三区| 亚洲一区二区三区四区五区中文| 亚洲精品成a人| 午夜精品视频一区| 美女性感视频久久| 国产在线看一区| 成人黄色小视频| 色先锋久久av资源部| 欧美影院精品一区| 欧美一卡二卡三卡| 国产欧美一区二区精品性色超碰 | 国产中文字幕一区| 国产成人综合精品三级| av男人天堂一区| 欧美日韩一区小说| 91麻豆精品国产自产在线 | 国产成人综合网| 97se亚洲国产综合自在线| 在线免费观看一区| 91精品在线一区二区| 久久亚洲欧美国产精品乐播| 国产精品久久久久久久久久免费看 | 成人黄色av电影| 91国产丝袜在线播放| 91精品国产综合久久久久| 国产视频一区不卡| 午夜精品久久一牛影视| 国产精品综合在线视频| 91福利区一区二区三区| 欧美mv日韩mv国产网站| **欧美大码日韩| 蜜桃视频在线观看一区| 99精品热视频| 26uuu色噜噜精品一区二区| 亚洲人精品一区| 麻豆精品国产91久久久久久| 色综合久久六月婷婷中文字幕| 欧美一级理论片| 亚洲人吸女人奶水| 国产乱色国产精品免费视频| 欧美日韩美少妇| 国产精品乱码人人做人人爱 | 午夜av电影一区| 成人少妇影院yyyy| 91麻豆精品国产| 亚洲乱码中文字幕| 丁香婷婷深情五月亚洲| 日韩一区二区三区免费看 | 韩国av一区二区| 欧美一区二区视频网站| 一区二区在线观看视频| 成人一区二区三区视频在线观看| 国产亚洲va综合人人澡精品| 日日夜夜免费精品| 色综合天天综合在线视频| 国产女人水真多18毛片18精品视频| 奇米777欧美一区二区| 在线这里只有精品| 亚洲视频综合在线| 99re亚洲国产精品| 综合久久给合久久狠狠狠97色 | 久久99久久99小草精品免视看| 欧日韩精品视频| 亚洲已满18点击进入久久| 波多野结衣的一区二区三区| 中文字幕不卡一区| 国产福利视频一区二区三区| 久久久久久久久久看片| 国产一区二区影院| 欧美哺乳videos| 国产乱淫av一区二区三区| 国产亚洲精品bt天堂精选| 高清不卡在线观看av| 亚洲欧洲美洲综合色网| 97se亚洲国产综合自在线不卡| 亚洲另类春色国产| 欧美在线free| 毛片不卡一区二区| 久久综合九色综合欧美亚洲| 成人午夜视频免费看| 中文字幕亚洲视频| 欧美性猛交xxxxxxxx| 日韩二区三区在线观看| 久久久久久久久97黄色工厂| 大陆成人av片| 亚洲一区二区三区精品在线| 日韩午夜在线播放| 国产精品一品二品| 亚洲乱码国产乱码精品精的特点| 欧美日韩在线三级| 麻豆国产精品一区二区三区 | 国产精品一区二区黑丝| 亚洲欧洲精品一区二区三区| 欧美视频一区二| 国产在线播放一区三区四| 国产精品国产三级国产aⅴ原创| 色偷偷久久一区二区三区| 午夜av一区二区三区| 2023国产精华国产精品| 色综合久久久久久久久| 日韩不卡免费视频| 亚洲国产高清在线| 欧美日韩不卡一区| 国产精品资源网站| 亚洲午夜久久久久久久久电影院| 精品日韩一区二区三区免费视频| 99riav久久精品riav| 久久疯狂做爰流白浆xx| 亚洲毛片av在线| 精品国产免费一区二区三区四区 | 正在播放亚洲一区| 成人动漫一区二区在线| 亚洲成人一区在线| 国产情人综合久久777777| 欧美精选午夜久久久乱码6080| 粉嫩aⅴ一区二区三区四区| 日本三级亚洲精品| 一区二区三区中文免费| 亚洲国产成人午夜在线一区| 欧美一级一区二区| 在线观看免费成人| 欧美一区二区视频在线观看2022 | 午夜精品一区二区三区电影天堂| 中文在线资源观看网站视频免费不卡 | 精品对白一区国产伦| 欧美三级韩国三级日本一级| 成人av中文字幕| 国内精品第一页| 蜜桃av噜噜一区| 石原莉奈在线亚洲三区| 一区二区在线免费| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 久久蜜桃av一区精品变态类天堂| 91精品国产美女浴室洗澡无遮挡| 在线视频综合导航| 成人h版在线观看| 成人午夜免费av| 懂色av中文一区二区三区 | 日本成人在线视频网站| 亚洲最大的成人av| 亚洲精品中文在线| 日韩理论在线观看| ...中文天堂在线一区| 国产精品色噜噜| 国产欧美一区二区精品忘忧草 | 精品日韩av一区二区| 日韩一卡二卡三卡四卡| 日韩欧美国产电影| 日韩午夜中文字幕| 亚洲精品在线三区| 久久网站热最新地址| 久久久久久夜精品精品免费| 国产色综合一区| 中文字幕av不卡| 亚洲男人的天堂在线观看| 亚洲视频综合在线| 亚洲高清不卡在线观看| 日韩影视精彩在线| 老色鬼精品视频在线观看播放| 久久精品国产精品青草| 久久国产尿小便嘘嘘| 大胆亚洲人体视频| 色婷婷一区二区| 3atv在线一区二区三区| 精品久久久久久久久久久院品网| 久久精品水蜜桃av综合天堂| 亚洲欧美电影院| 日本欧美久久久久免费播放网| 久久91精品国产91久久小草| 国产成人免费视频一区| 在线观看欧美精品| 精品国产百合女同互慰| 国产精品伦一区| 天天综合色天天综合色h| 国产盗摄女厕一区二区三区 | 亚洲成av人片在线| 老司机精品视频线观看86| 成人禁用看黄a在线| 欧美影院一区二区三区| 久久人人爽爽爽人久久久| 国产精品理论在线观看| 蜜臀精品久久久久久蜜臀| 不卡一二三区首页| 欧美一区二区三区视频免费| 国产精品天美传媒| 久久精品二区亚洲w码| 一本色道久久加勒比精品| 精品久久久久久久久久久久久久久 | 精品国产一区二区在线观看| 亚洲欧美日韩一区|