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

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

?? genetic.m

?? 基本遺傳算法程序包
?? M
字號:
function [xopt,stats,options,bestf,fgen,lgen] = genetic(fun, ...          x0,options,vlb,vub,bits,P1,P2,P3,P4,P5,P6,P7P,P8,P9,P10)%GENETIC tries to maximize a function using a simple genetic algorithm.%	X=GENETIC('FUN',X0,OPTIONS,VLB,VUB) uses a simple (haploid) %       genetic algorithm to find a maximum of the fitness function %       FUN (usually an M-file: FUN.M).  The user may define all or%       part of an initial population X0 (or supply an empty argument%       in which case an initial population will be chosen randomly%       between the lower and upper bounds VLB and VUB.  Use OPTIONS%       to specify optional parameters such as population size and%       maximum number of generations produced.  Type HELP GOPTIONS%       for more information.%%       The default algorithm uses a fixed population size, OPTIONS(11),%       and no generational overlap.  Three genetic operations: %       reproduction, crossover, and mutation are performed during %       procreation.  The probability that an individual of the %       population will reproduce is proportional to its fitness.%       Individuals chosen for reproduction are mated at random.%       Mating produces two offspring (re: constant population size.)%       Crossover in mating occurs with probability Pc=OPTIONS(12)%       and the crossover index is randomly selected.  Each feature%       of the offspring can mutate independently with probability%       Pm=OPTIONS(13).  Default options are OPTIONS(11:13)=[30 1 0].%       The default maximum generations OPTIONS(14) is 100.%%	X=GENETIC('FUN',X0,OPTIONS,VLB,VUB,BITS) allows the user to %	define the number of BITS used to code non-binary parameters%	as binary strings.  Note: length(BITS) must equal length(VLB).%%	X=GENETIC('FUN',X0,OPTIONS,VLB,VUB,BITS,P1,P2,...) allows up %	to ten arguments, P1, P2, ... to be passed directly to FUN.%	F=FUN(X,P1,P2,...).%%	[X,STATS,OPTIONS,BESTF,FGEN,LGEN]=GENETIC(<ARGS>)%          STATS   - [max min mean std] for each generation%          OPTIONS - options used%          BESTF   - Fitness of indivadual X (i.e.: best fitness)%          FGEN    - first generation population%          LGEN    - last generation population%%       The algorithm implemented here is taken from Genetic%       Algorithms in Search, Optimization, and Machine Learning,%       David E. Goldberg, Addison-Wiley Publishing Company, Inc.,%       1989.%%	Copyright (c) 1993 by the MathWorks, Inc.%	Andrew Potvin 1-10-93.% OPT_STOP used by user to halt optimization prematurely% OPT_STEP will be true during the evaluation of the last individual's% cost function.  Often used to determine when to update graphics.global OPT_STOP OPT_STEPOPT_STOP = 0;% Argument and error checkingif nargin<4,   error('No population bounds given.')elseif (size(vlb,1)~=1) | (size(vub,1)~=1),   % Remark: this will change if algorithm accomodates matrix variables   error('VLB and VUB must be row vectors')elseif (size(vlb,2)~=size(vub,2)),   error('VLB and VUB must have the same number of columns.')elseif (size(vub,2)~=size(x0,2)) & (size(x0,1)>0),   error('X0 must all have the same number of columns as VLB and VUB.')elseif any(vlb>vub),   error('Some lower bounds greater than upper bounds')else   x0_row = size(x0,1);   for i=1:x0_row,      if any(x0(x0_row,:)<vlb) | any(x0(x0_row,:)>vub),         error('Some initial population not within bounds.')      end % if initial pop not within bounds   end % for initial popend % if nargin<4   if nargin<6,   bits = [];elseif (size(bits,1)~=1) | (size(bits,2)~=size(vlb,2)),   % Remark: this will change if algorithm accomodates matrix variables   error('BITS must have one row and length(VLB) columns')elseif any(bits~=round(bits)) | any(bits<1),   error('BITS must be a vector of integers >0')end % if nargin<6% Form string to call for function evaluationif ~( any(fun<48) | any(fun>122) | any((fun>90) & (fun<97)) | ...    any((fun>57) & (fun<65)) ),    % Only alphanumeric implies must be a function   evalstr = [fun '(x'];   for i=1:nargin-6,      evalstr = [evalstr,',P',int2str(i)];   end   evalstr = [evalstr, ')'];else   evalstr = fun;end% Determine all options% Remark: add another options index for type of termination criterionif size(options,1)>1,   error('OPTIONS must be a row vector')else   options = foptions(options);   if options(11)==0,      % Default size_pop      options(11) = 30;   end   if options(12)==0,      % Default Pc      options(12) = 1;   end   if options(14)==0,      % Default max_gen      options(14) = 100;   endendPRINTING = options(1);terminate = options(2);size_pop = options(11);Pc = options(12);Pm = options(13);max_gen  = options(14);% Ensure valid options: e.q. Pc,Pm,size_pop,max_gen>0, Pc,Pm<1if any([Pc Pm size_pop max_gen]<0) | any([Pc Pm]>1),   error('Some Pc,Pm,size_pop,max_gen<0 or Pc,Pm>1')end% Encode fitness (cost) function if necessaryENCODED = any(any(([vlb; vub; x0]~=0) & ([vlb; vub; x0]~=1))) |  ...          ~isempty(bits);if ENCODED,   [fgen,lchrom] = encode(x0,vlb,vub,bits);else   fgen = x0;   lchrom = size(vlb,2);end% Display warning if odd number in initial populationif rem(size_pop,2)==1,   disp('Warning: pop_size should be even.  Adding 1 to population.')   size_pop = size_pop +1;end% Form random initial population if not enough supplied by userif size(fgen,1)<size_pop,   fgen = [fgen; (rand(size_pop-size(fgen,1),lchrom)<0.5)];endxopt = vlb;bestf = -Inf;new_gen = fgen;% Header displayif PRINTING>=1,   if ENCODED,      disp('Cost function encoding as binary successful.')      disp('')      fgen = decode(fgen,vlb,vub,bits);   end   disp('                   Fitness statistics')   disp('Generation Maximum      Minimum         Mean    Std. dev.')end% Set up main loopSTOP_FLAG = 0;for generation = 1:max_gen+1,   options(10) = generation-1;   old_gen = new_gen;   % Get fitness of each string in population   % Decode first if necessary   if ENCODED,      x_pop = decode(old_gen,vlb,vub,bits);   else      x_pop = old_gen;   end   for i=1:size_pop,      x = x_pop(i,:);      if i==size_pop,         OPT_STEP = 1;      else         OPT_STEP = 0;      end      fitness(i) = eval(evalstr);   end   [max_fit,INDEX] = max(fitness);   stats = [stats; max_fit min(fitness) mean(fitness) std(fitness)];   if max_fit>bestf,      bestf = max_fit;      xopt = x_pop(INDEX(1),:);   else      % Remark: may want to regenerate to guarantee cost decrease      % Remark: be careful not to get stuck in infinite loop   end   % Display if necessary   % Remark: consider alternate printing options   if PRINTING>=1,      disp([sprintf('%5.0f %12.6g %12.6g ',generation-1, ...                     stats(generation,1),stats(generation,2)), ...            sprintf('%12.6g %12.6g  ',stats(generation,3), ...                    stats(generation,4))]);   end   % Check for termination   % Remark: add more termination options   if terminate>0,      if generation>5,         if ( (stats(generation,1)-stats(generation-5,1))/ ...               stats(generation,1)<terminate ) & ...            (stats(generation,1)>stats(generation-5,1)),            STOP_FLAG = 1;         end      elseif generation>1,         if ( (stats(generation,3)-stats(generation-1,3))/ ...               stats(generation,3)<terminate ) & ...            (stats(generation,3)>stats(generation-1,3)),            STOP_FLAG = 1;         end      end   end   if STOP_FLAG | OPT_STOP,      fprintf('\n')      if STOP_FLAG,         disp('Genetic algorithm converged.')         else         disp('Genetic algorithm terminated by user.')      end      return   end   % Reproduce   new_gen = reproduc(old_gen,fitness);   % Mate   new_gen = mate(new_gen);   % Crossover   new_gen = xover(new_gen,Pc);   % Mutate   new_gen = mutate(new_gen,Pm);   if ENCODED,      lgen = decode(new_gen,vlb,vub,bits);   else      lgen = new_gen;   endend % for max_gen% Maximum number of generations reached without terminationif PRINTING>=1,   fprintf('\n')   disp('Maximum number of generations reached without termination')   disp('criterion met.  Either increase maximum generations')   disp('or ease termination citerion.')end% end genetic

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产夫妻精品视频| 国产一区不卡视频| 亚洲日本成人在线观看| 国产欧美一区二区精品性色超碰| 精品99一区二区| 精品少妇一区二区| 精品国产a毛片| 久久精品亚洲国产奇米99| 久久久亚洲午夜电影| 中文在线一区二区| 中文字幕一区三区| 一区二区三区欧美日| 亚洲成人免费电影| 精品综合免费视频观看| 国v精品久久久网| 一本大道久久a久久精二百| 欧美视频在线不卡| 337p日本欧洲亚洲大胆精品| 国产欧美精品一区| 亚洲成a天堂v人片| 国产美女精品一区二区三区| 99久久精品99国产精品| 欧美吞精做爰啪啪高潮| 精品免费视频.| 中文字幕一区二区三区不卡在线| 亚洲精品大片www| 久久草av在线| 成人h版在线观看| 欧美疯狂性受xxxxx喷水图片| 欧美精品一区二区三区在线| 亚洲丝袜另类动漫二区| 美国毛片一区二区三区| 91论坛在线播放| 欧美成人r级一区二区三区| 亚洲欧美一区二区在线观看| 日韩精品国产欧美| 97久久超碰国产精品| 欧美tickling网站挠脚心| 自拍偷拍亚洲综合| 国内精品自线一区二区三区视频| 91影院在线免费观看| 精品久久久久久最新网址| 亚洲色图都市小说| 国产精品一区一区| 欧美另类变人与禽xxxxx| 国产精品人成在线观看免费| 日本特黄久久久高潮| 91看片淫黄大片一级在线观看| 精品噜噜噜噜久久久久久久久试看 | 久久蜜桃av一区精品变态类天堂| 久久青草欧美一区二区三区| 亚洲一级二级在线| 成人免费视频国产在线观看| 日韩一区二区高清| 亚洲国产精品一区二区www | 国产乱码精品一区二区三区五月婷| 色婷婷av一区二区三区软件| 国产婷婷色一区二区三区| 热久久一区二区| 欧美日本在线视频| 亚洲一区二区综合| 色美美综合视频| 成人免费在线播放视频| www.综合网.com| 国产精品色婷婷久久58| 国产精品原创巨作av| 欧美精品一区二区三| 久久精品国产第一区二区三区| 欧美老肥妇做.爰bbww| 亚洲午夜在线视频| 欧美日韩免费不卡视频一区二区三区| 亚洲精品亚洲人成人网在线播放| 成人国产精品免费观看视频| 欧美高清在线精品一区| 成人黄色小视频在线观看| 国产精品久久久久久久久晋中 | 国产.精品.日韩.另类.中文.在线.播放| 日韩一级高清毛片| 麻豆精品视频在线观看免费| 日韩欧美电影一区| 狠狠色丁香婷综合久久| 国产亚洲短视频| 国产91精品久久久久久久网曝门 | 免费在线观看日韩欧美| 91精品视频网| 激情欧美日韩一区二区| 久久久综合九色合综国产精品| 高清不卡一二三区| 亚洲日本在线天堂| 欧美日韩高清一区二区不卡| 另类专区欧美蜜桃臀第一页| 久久精品这里都是精品| 日本高清成人免费播放| 秋霞av亚洲一区二区三| 久久免费美女视频| 色婷婷av一区二区三区gif| 日本特黄久久久高潮| 亚洲精品一区二区三区蜜桃下载| 成人午夜视频免费看| 亚洲伊人伊色伊影伊综合网| 精品国产一区二区三区av性色| 国产福利91精品一区| 亚洲一区二区欧美| 日韩欧美电影一二三| 99国产精品久久久久| 奇米影视一区二区三区| 国产欧美久久久精品影院| 欧美色综合网站| 国产美女主播视频一区| 亚洲午夜久久久久久久久电影院 | caoporm超碰国产精品| 五月激情综合色| 国产精品久久久久影视| 欧美一区二区三区在线观看| 不卡av免费在线观看| 麻豆freexxxx性91精品| 亚洲视频一区在线| 久久嫩草精品久久久久| 欧美日韩国产首页| 99久久精品一区二区| 韩国毛片一区二区三区| 亚洲高清免费视频| 亚洲日本丝袜连裤袜办公室| 欧美精品一区二区三区四区| 欧美日韩免费不卡视频一区二区三区| 国产成人精品三级麻豆| 日韩不卡一区二区三区| 亚洲一区二区视频在线观看| 中文字幕久久午夜不卡| 在线不卡a资源高清| 91福利精品第一导航| 成人av片在线观看| 国产成人免费视频精品含羞草妖精| 日韩高清电影一区| 亚洲观看高清完整版在线观看| 亚洲欧洲精品成人久久奇米网| 久久精品一区二区| 久久综合久久99| 久久先锋资源网| 欧美成人乱码一区二区三区| 91精品国产综合久久久久| 欧美日韩精品一区视频| 欧美做爰猛烈大尺度电影无法无天| 99久久亚洲一区二区三区青草| 成人午夜碰碰视频| 97久久精品人人做人人爽50路| 成人黄色av网站在线| 99久久国产综合精品色伊| youjizz久久| 99精品视频一区| 色综合久久久久| 欧美在线小视频| 欧美日韩极品在线观看一区| 欧美视频在线一区二区三区 | 欧美日韩视频第一区| 欧美性生活久久| 欧美蜜桃一区二区三区| 欧美美女喷水视频| 欧美r级在线观看| 久久久久88色偷偷免费| 国产精品无码永久免费888| 中文一区二区在线观看| 自拍偷在线精品自拍偷无码专区| 最新欧美精品一区二区三区| 一区二区免费在线播放| 亚洲国产成人av网| 国模套图日韩精品一区二区 | 亚洲情趣在线观看| 亚洲一区免费视频| 蜜臀av国产精品久久久久| 国产精品一区三区| 91麻豆国产香蕉久久精品| 91.xcao| 国产日韩欧美精品一区| 亚洲精品伦理在线| 美女视频免费一区| 成人免费高清在线观看| 色综合激情久久| 欧美电影免费观看高清完整版在线| 久久色在线观看| 一区二区三区色| 激情综合一区二区三区| av爱爱亚洲一区| 制服.丝袜.亚洲.中文.综合| 国产欧美久久久精品影院| 亚洲成人综合网站| 国产成人免费在线| 欧美电影一区二区| 亚洲国产精品激情在线观看 | 国产传媒久久文化传媒| 色噜噜久久综合| wwwwww.欧美系列| 一区二区三区在线播放| 国产在线国偷精品免费看| 欧美性生活久久| 国产精品久久久久一区二区三区| 美国十次综合导航| 欧美性猛片xxxx免费看久爱| 国产精品嫩草99a| 久久av老司机精品网站导航|