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

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

?? create.cc

?? 用C++編寫的遺傳算法
?? CC
字號:
// create.cc/* -------------------------------------------------------------------gpc++ - The Genetic Programming KernelThis program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 1, or (at your option)any later version.This program is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.Copyright 1993, 1994 Adam P. Fraser and 1996, 1997 Thomas WeinbrennerFor comments, improvements, additions (or even money) contact:Thomas WeinbrennerGrauensteinstr. 2635789 LaimbachGermanyE-mail: thomasw@emk.e-technik.th-darmstadt.deWWW:    http://www.emk.e-technik.th-darmstadt/~thomasw  or (Address may be out of date)Adam Fraser, Postgraduate Section, Dept of Elec & Elec Eng,Maxwell Building, University Of Salford, Salford, M5 4WT, United Kingdom.E-mail: a.fraser@eee.salford.ac.ukTel:    (UK) 061 745 5000 x3633Fax:    (UK) 061 745 5999------------------------------------------------------------------- */#include "gp.h"// Number of trials to create a proper GPconst int creationAttempts=50;// Creation of the populationvoid GPPopulation::create (){#if GPINTERNALCHECK  // Check whether the user has done a good job and setup the node  // sets correctly.  if (adfNs->containerSize()<1)    GPExitSystem ("Population::create", 		  "ADF Node set contains no node sets");  for (int tree=0; tree<adfNs->containerSize(); tree++)    {      GPNodeSet* ns=adfNs->NthNodeSet (tree);      if (!ns)	GPExitSystem ("Population::create", "Node set not defined");      if (ns->containerSize()==0)	GPExitSystem ("Population::create", "Node set contains no nodes");      for (int i=0; i<ns->containerSize(); i++)	if (!ns->Nth (i))	  GPExitSystem ("Population::create", "Node in set not defined");    }#endif  const int minTreeDepth=2;  int treedepth=2;   GP* newObj;  // At this point, the population container is still empty.  Space  // must be reserved for all the genetic programs.  reserveSpace (GPVar.PopulationSize);  // loop through the whole population  for (int i=0; i<containerSize (); i++)    {      // set up done boolean checks whether we have been around the      // next do ..while loop      int Done = 0;      do	{	  // Check that we haven't done this more than a few times.	  // If so, increase tree depth.  Obviously, it's difficult to	  // create a proper tree of that depth	  if (Done>=creationAttempts/4 	      && treedepth<GPVar.MaximumDepthForCreation)	    treedepth++;	  // Allocate a new GP object with the correct number of	  // subtrees (ADFs+1).  The number of subtrees is called up	  // from one of the ADF container sets.  A virtual function	  // is used to create the object, so it may well be a users	  // class GP we are creating here.	  newObj=createGP (adfNs->containerSize());	  // Basically a switch statement is used to decide which type	  // of GP creation is wanted	  switch (GPVar.CreationType)	    {	    case GPRampedHalf:	      // if odd create ramped grow else ramped variable	      if (i%2)		newObj->create (GPGrow, treedepth, *adfNs);	      else		newObj->create (GPVariable, treedepth, *adfNs);	      break;	    case GPRampedVariable:	      newObj->create (GPVariable, treedepth, *adfNs);	      break;	    case GPRampedGrow:	      newObj->create (GPGrow, treedepth, *adfNs);	      break;	    case GPGrow:	      newObj->create(GPGrow, GPVar.MaximumDepthForCreation, 			     *adfNs);	      break;	    case GPVariable:	      newObj->create(GPVariable, GPVar.MaximumDepthForCreation, 			     *adfNs);	      break;	    default:#if GPINTERNALCHECK	      GPExitSystem ("Population::create", "Wrong creation type");#endif	      break;	    }	  // Now leave the object in the care of the container class.	  // If there is already one object at that place, it will be	  // deleted.  No more worries about memory allocations!	  // What a drag it was before...	  put (i, *newObj);	  // Set up boolean done to show we have been around do{}while	  // loop before.	  Done++;	}        // Check for a "good" GP.  This could lead to an infinite loop,      // but the process is stopped after some attempts to create a      // proper GP.      while (!checkForValidCreation (*newObj) && Done < creationAttempts);      // Now increase treedepth      if (++treedepth>GPVar.MaximumDepthForCreation) 	treedepth=minTreeDepth;    }  // Evaluate each member of the population.  This must be done  // anyway, so why not here?  evaluate ();  // Calculate statistics of the new generation  calculateStatistics ();}// Compares each member of the population with a GP up to that member// of the population.  Used by checkForValidCreation().  Returns 0, if// two equal members are foundint GPPopulation::checkForDiversity (GP& gp){  for (int n=0; n<containerSize(); n++)    {      GP* cmp=NthGP (n);      // If we reach the same GP at this point, stop      if (cmp==&gp)	break;      // Compare two GPs together and return 0 if the same if not      // continue in loop      if (cmp->compare (gp)==0)	return 0;    }  // If we get to here then all GPs must be different and we still  // have 100% diversity in the population  return 1;}// What this routine has to do is to check whether the newly created// GP is a "good" one or not.  As default, it is checked here for// ultimate diversity as it checks that each GP is different to every// other created so far, but the user might as well think different// about what is a good GP or not.  It won't lead to an infinite loop// if the routine rejects every GP it gets, but will certainly slow// down creation process.  Return 1 if good, 0 if we should give it// another try.  Remember the compare function returns a 0 if it finds// an identical GP.int GPPopulation::checkForValidCreation (GP& gpo){  return checkForDiversity (gpo)!=0;}// This block of code creates a GP. GP::Create is called within// GPPopulation::create with the correct creation type and depth.// Notes: This code makes a function the first node.  This is in line// with Koza's LISP code and does make the trees more interesting but// it is not necessary.  It makes this code a little shorter, as the// decision whether to choose a function or a terminal is not done// here, but only in GPGene::create().void GP::create (enum GPCreationType ctype, int allowableDepth, 		 GPAdfNodeSet& adfNs){#if GPINTERNALCHECK  // Check argument  if (ctype!=GPGrow && ctype!=GPVariable)    GPExitSystem ("GP::create",		  "Argument ctype must be GPGrow or GPVariable");#endif  // As the first node is always a function that is created here in  // this routine, decrease allowableDepth  allowableDepth--;  // loop through each adf  for (int adf=0; adf<containerSize(); adf++)    {      // Set the node set pointer to the correct node set (most      // interesting work is when these are different for each ADF)      GPNodeSet& ns=*adfNs.NthNodeSet (adf);      // Choose a function from function set which complies with      // Genetic Programming book or code.  Create a new gene with that      // function.      GPNode &tempfunc=ns.chooseFunction ();      GPGene& g=*createGene (tempfunc);      // Create tree structure      g.create (ctype, allowableDepth, ns);      // Now we put the child into the container.  Nice, isn't it?      put (adf, g);    }  // Calculate length and depth  calcLength ();  calcDepth ();}// Grow GPs according to the given parametersvoid GPGene::create (enum GPCreationType ctype, int allowableDepth, 		     GPNodeSet& ns){  // Loop through the whole function arguments and create new  // offsprings (the function parameters).  Remember: There is already  // a Gene, namely the object this routine is called for by  // GP::create(), and it is a function.  for (int n=0; n<containerSize(); n++)    {      // Now decide whether the offspring should be a function or a      // terminal.  If there is no more allowable depth, choose a      // terminal in any case.      int chooseTerm;      if (ctype==GPGrow) 	chooseTerm=0;      else 	// 50/50% chance of getting a function or a terminal	chooseTerm=GPrand () % 2;      if (allowableDepth<=1)	chooseTerm=1;      // Choose function or terminal      GPNode* newNode;      if (chooseTerm)	newNode=&ns.chooseTerminal();      else	newNode=&ns.chooseFunction();      // Create a new gene with the chosen node and place the new gene      // into the container      GPGene& g=*createChild (*newNode);      put (n, g);            // If the node was a function, call function recursively with      // decreased allowable depth      if (!chooseTerm)	g.create (ctype, allowableDepth-1, ns);    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美成人三级电影在线| 久久一区二区三区国产精品| 日本成人在线一区| 韩国一区二区三区| 日本韩国精品在线| 欧美r级在线观看| 肉肉av福利一精品导航| 91在线观看成人| 久久亚洲二区三区| 免费久久精品视频| 欧美精品乱码久久久久久 | 色视频一区二区| 久久九九久久九九| 美脚の诱脚舐め脚责91| 欧美在线不卡视频| 日韩美女视频一区二区| 精品一区二区三区免费毛片爱| 在线视频你懂得一区| 中日韩av电影| 国产成人av福利| 久久婷婷色综合| 久久国产精品免费| 欧美一区二区三区在线视频| 亚洲一级在线观看| 色就色 综合激情| 亚洲美女一区二区三区| 91尤物视频在线观看| 国产精品麻豆久久久| 国产91丝袜在线观看| 国产亚洲制服色| 国产成人免费视频精品含羞草妖精 | 国产精品久久毛片a| 成人性生交大片免费看在线播放 | 综合在线观看色| 色婷婷久久久亚洲一区二区三区| 国产精品不卡视频| 91猫先生在线| 亚洲一级不卡视频| 91精品国产综合久久婷婷香蕉| 五月婷婷激情综合| 欧美一区二视频| 国产在线一区二区综合免费视频| 精品剧情在线观看| 国产suv精品一区二区883| 国产精品久久久久久久久免费桃花 | 欧美一区二区网站| 久久狠狠亚洲综合| 国产亚洲精品久| 一本到不卡精品视频在线观看| 夜夜夜精品看看| 欧美美女喷水视频| 激情久久久久久久久久久久久久久久| 久久亚洲免费视频| 91亚洲永久精品| 无吗不卡中文字幕| 久久综合九色综合久久久精品综合 | 国产精品欧美久久久久一区二区 | 成人午夜激情影院| 一区二区日韩电影| 欧美一区二区人人喊爽| 韩国成人福利片在线播放| 中文字幕欧美国产| 欧美色男人天堂| 国产一区二区三区黄视频 | 久久久亚洲精华液精华液精华液| 成人av在线资源网| 视频在线在亚洲| 中文字幕高清一区| 欧美久久一区二区| 国产91在线|亚洲| 天天做天天摸天天爽国产一区| 久久人人爽人人爽| 欧美日韩一区视频| 成人自拍视频在线| 日韩—二三区免费观看av| 久久精品在这里| 欧美另类z0zxhd电影| 国产+成+人+亚洲欧洲自线| 一区二区不卡在线视频 午夜欧美不卡在| 欧美二区三区91| 懂色av噜噜一区二区三区av| 亚洲第一av色| 中文字幕一区在线观看视频| 日韩精品一区二区三区swag| 色综合网站在线| 狠狠色丁香久久婷婷综合_中| 伊人一区二区三区| 国产性天天综合网| 欧美一级欧美一级在线播放| 色综合久久久久| 国产69精品久久久久777| 美女任你摸久久| 亚洲高清免费视频| 亚洲色图第一区| 欧美国产乱子伦| 亚洲精品一区二区三区影院| 在线成人av网站| 欧美调教femdomvk| 成人av午夜电影| 国产成人在线色| 国产成人在线色| 国产一级精品在线| 久久成人综合网| 美女脱光内衣内裤视频久久影院| 亚洲一二三区在线观看| 亚洲日本电影在线| 国产欧美一区二区在线观看| 日韩三级av在线播放| 91精品国产欧美日韩| 欧美精品久久一区| 91精品久久久久久久99蜜桃 | 图片区小说区区亚洲影院| 亚洲精品亚洲人成人网在线播放| 中文字幕在线免费不卡| 国产亚洲人成网站| 国产日韩亚洲欧美综合| xfplay精品久久| 久久精品日产第一区二区三区高清版| 欧美一区二区二区| 日韩免费观看高清完整版| 欧美一区二区三区四区五区| 欧美一区二区三区在线电影| 6080午夜不卡| 精品国产电影一区二区| 久久综合九色综合欧美就去吻| 久久综合成人精品亚洲另类欧美| 精品播放一区二区| 国产亚洲精品精华液| 最新不卡av在线| 五月婷婷色综合| 久久国产精品第一页| 懂色av噜噜一区二区三区av| 成人国产在线观看| 在线欧美日韩国产| 91精品国产免费久久综合| 欧美精品一区二| 成人免费在线视频| 亚洲一区二区三区视频在线| 免费成人在线观看| 成人性生交大片免费看中文| 91黄色免费版| 日韩精品一区二区三区视频播放 | 成人动漫视频在线| 在线观看成人小视频| 日韩欧美一二三四区| 国产欧美一区二区三区鸳鸯浴| 国产精品高潮久久久久无| 亚洲超丰满肉感bbw| 国内精品在线播放| 色综合久久久久综合体桃花网| 日韩一区二区三区视频在线观看| 久久精品视频免费| 亚洲va中文字幕| 国产成人在线视频播放| 欧美色综合影院| 久久久99精品久久| 亚洲一区二区三区激情| 国产精品一色哟哟哟| 欧美在线观看一二区| 久久影音资源网| 亚洲bt欧美bt精品| 99精品在线免费| 日韩一级完整毛片| 一区二区在线免费观看| 国产在线视频一区二区三区| 欧美日韩一区小说| 中文字幕一区二区三区乱码在线 | 香蕉久久一区二区不卡无毒影院| 国产一区二区三区四区在线观看| 欧洲人成人精品| 国产精品热久久久久夜色精品三区| 日韩中文字幕不卡| 91麻豆免费在线观看| 久久久久久久久久久久电影 | 国产激情一区二区三区| 欧美日韩一区三区| 日韩毛片精品高清免费| 国产福利电影一区二区三区| 蜜臀精品一区二区三区在线观看| 国产剧情一区二区三区| 欧美日韩国产在线播放网站| 亚洲视频在线一区| a美女胸又www黄视频久久| 欧美成人官网二区| 日韩中文字幕一区二区三区| 一本久久综合亚洲鲁鲁五月天| 欧美精品一区二区三区蜜桃| 日韩高清在线一区| 欧美乱熟臀69xxxxxx| 亚洲午夜视频在线| 色欧美乱欧美15图片| 中文字幕亚洲综合久久菠萝蜜| 国产精品一二三四五| 2021国产精品久久精品| 久久国产人妖系列| 精品国偷自产国产一区| 狠狠久久亚洲欧美| 精品国产乱码久久久久久1区2区| 免费久久99精品国产| 91精品国产综合久久小美女|