亚洲欧美第一页_禁久久精品乱码_粉嫩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 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一区二区三区免费野_久草精品视频
午夜欧美大尺度福利影院在线看| 久久综合成人精品亚洲另类欧美| 极品少妇xxxx精品少妇| 日韩在线一二三区| 亚洲在线免费播放| 亚洲一区在线观看视频| 亚洲一区二区在线播放相泽| 亚洲欧美激情插 | av电影天堂一区二区在线观看| 精品一区二区三区免费毛片爱 | 亚洲国产精品欧美一二99| 亚洲精品免费一二三区| 一区二区三区小说| 亚洲图片有声小说| 青青草原综合久久大伊人精品| 蜜桃av噜噜一区二区三区小说| 韩日精品视频一区| 成人福利在线看| 欧美三级三级三级| 日韩欧美成人午夜| 亚洲国产精品国自产拍av| 亚洲视频狠狠干| 肉丝袜脚交视频一区二区| 美女一区二区视频| 99久久国产综合精品女不卡| 91电影在线观看| 精品对白一区国产伦| 亚洲视频香蕉人妖| 久草热8精品视频在线观看| 国产激情一区二区三区桃花岛亚洲| 成人国产免费视频| 在线成人av网站| 中文字幕中文字幕一区二区| 亚洲风情在线资源站| 精品在线一区二区三区| 色综合中文字幕| 精品福利视频一区二区三区| 亚洲另类中文字| 国产美女娇喘av呻吟久久| 一本到一区二区三区| 日韩一区二区三| 亚洲精品伦理在线| 国产成人日日夜夜| 91精品国产综合久久福利软件| 国产精品免费网站在线观看| 日韩一区精品视频| 91小宝寻花一区二区三区| 久久综合九色综合欧美98| 亚洲一级在线观看| 日韩一区二区三区在线观看 | 国产91富婆露脸刺激对白| 欧美在线视频你懂得| 国产欧美日韩在线| 麻豆91免费观看| 欧美在线你懂得| 亚洲欧美日韩中文字幕一区二区三区| 精品写真视频在线观看| 欧美日韩mp4| 一区二区三区四区蜜桃| 成人av在线看| 国产亚洲精品超碰| 国产一区二区伦理| 精品国产一区二区在线观看| 日韩经典中文字幕一区| 在线精品视频小说1| 国产精品福利一区| 成人一区二区三区| 欧美国产精品久久| 国产一区二区三区| 久久噜噜亚洲综合| 国产真实乱子伦精品视频| 精品国产乱码久久久久久久久 | 欧美大肚乱孕交hd孕妇| 日日摸夜夜添夜夜添精品视频| 欧美在线一区二区| 午夜视频久久久久久| 欧美日韩一区在线观看| 亚洲aaa精品| 欧美高清激情brazzers| 日本中文字幕一区二区视频| 在线成人免费观看| 国内精品免费**视频| 精品国产乱码久久久久久1区2区| 国产一区不卡视频| 国产亚洲综合av| bt7086福利一区国产| 亚洲人123区| 欧美三级三级三级爽爽爽| 日韩高清不卡一区二区| 精品99一区二区| 国产成人亚洲精品狼色在线| 国产精品久久久久久久久免费丝袜| av在线综合网| 亚洲综合激情网| 欧美一卡2卡3卡4卡| 激情深爱一区二区| 亚洲欧洲在线观看av| 欧美性色黄大片手机版| 麻豆极品一区二区三区| 亚洲国产精品成人久久综合一区| 91玉足脚交白嫩脚丫在线播放| 亚洲国产精品久久不卡毛片| 日韩欧美三级在线| 岛国精品在线播放| 亚洲国产另类av| 久久亚洲一区二区三区四区| 日韩一区二区精品| 风间由美中文字幕在线看视频国产欧美 | 91精品国产综合久久小美女| 久久99精品久久久久婷婷| 综合自拍亚洲综合图不卡区| 欧美熟乱第一页| 国产一区二区影院| 亚洲一区二区三区在线| 久久精品网站免费观看| 在线精品视频一区二区三四| 激情五月婷婷综合| 婷婷久久综合九色综合伊人色| 26uuu欧美日本| 精品1区2区3区| 波多野结衣亚洲| 国产一区二区三区国产| 亚洲一二三区在线观看| 中国av一区二区三区| 欧美xxxxxxxxx| 在线观看免费一区| 成人av在线影院| 国产一区视频在线看| 午夜精品久久久久久久久| 国产精品免费网站在线观看| 日韩美女一区二区三区| 欧美男男青年gay1069videost| 波多野结衣欧美| 国产一区二区成人久久免费影院| 日韩中文字幕区一区有砖一区 | 久久久99精品久久| 51精品国自产在线| 欧美亚洲一区三区| 91福利精品第一导航| 99久久精品久久久久久清纯| 国产精品一二三| 国精产品一区一区三区mba桃花| 天使萌一区二区三区免费观看| 一区二区欧美视频| 一区二区三区在线视频观看58| 国产精品高潮呻吟| 久久精品欧美一区二区三区不卡| 欧美一区二区美女| 日韩欧美aaaaaa| 精品美女一区二区三区| 日韩一区二区三区视频在线| 在线不卡中文字幕| 欧美一级欧美三级在线观看| 欧美精品日日鲁夜夜添| 欧美日韩一区成人| 91精品一区二区三区在线观看| 欧美精选午夜久久久乱码6080| 欧美美女一区二区| 欧美精品久久99| 日韩美女视频在线| 久久精品综合网| 综合欧美一区二区三区| 亚洲精品久久久蜜桃| 亚洲图片有声小说| 蜜臀av性久久久久蜜臀av麻豆| 不卡av在线免费观看| 91网页版在线| 在线免费不卡电影| 91精品国产一区二区三区蜜臀| 日韩精品一区二区三区四区| 精品久久久久99| 亚洲欧洲在线观看av| 一区二区三区在线观看动漫| 午夜精品久久久久久久久| 久久精品国产免费| 丰满亚洲少妇av| 91国在线观看| 欧美成人猛片aaaaaaa| 国产日韩精品久久久| 综合色天天鬼久久鬼色| 日韩—二三区免费观看av| 狠狠色丁香久久婷婷综合_中| 成人夜色视频网站在线观看| 欧美在线影院一区二区| 久久色视频免费观看| 中文字幕一区二区视频| 视频一区在线播放| 99久久精品一区二区| 91精品在线免费观看| 一色桃子久久精品亚洲| 秋霞影院一区二区| 99视频国产精品| 欧美xxx久久| 亚洲国产成人91porn| 国产成人在线网站| 欧美精品电影在线播放| 国产精品大尺度| 国产一区欧美一区| 在线不卡a资源高清| 亚洲美女少妇撒尿|