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

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

?? ex6.c

?? 遺傳算法的源程序例子
?? C
字號:
/* ----------------------------------------------------------------------------  ex6.C  mbwall 14jan95  Copyright 1995-1996  Massachusetts Institute of Technology DESCRIPTION:   Example program for the tree and list genomes.  This example containsthe code to run a tree genome.  The list genome is almost the same - just change tree to list and modify the initialization methods.  This program illustrates how to specialize member functions of the template classes.  Here we specialize the default write() method so that we getthe contents of the nodes rather than the pointers to the node contents.  Youcan specialize most functions of a template class (as long as they are notinlined).---------------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <iostream.h>#include <fstream.h>#include <ga/ga.h>// The objective function is declared here and defined below.float objective(GAGenome &);// This is the declaration for the initialization operator for our trees.void TreeInitializer(GAGenome &);// This is a recursive function that will be used in the 'write' method for // our tree genomes.void WriteNode(ostream & os, GANode<int> * n);intmain(int argc, char *argv[]){  cout << "Example 6\n\n";  cout << "This example uses a SteadyState GA and Tree<int> genome.  It\n";  cout << "tries to maximize the size of the tree genomes that it\n";  cout << "contains.  The genomes contain ints in its nodes.\n\n";  cout.flush();// See if we've been given a seed to use (for testing purposes).  When you// specify a random seed, the evolution will be exactly the same each time// you use that seed number.  unsigned int seed = 0;  for(int i=1; i<argc; i++) {    if(strcmp(argv[i++],"seed") == 0) {      seed = atoi(argv[i]);    }  }// Set the default values of the parameters.  GAParameterList params;  GASteadyStateGA::registerDefaultParameters(params);  params.set(gaNpopulationSize, 30);  params.set(gaNpCrossover, 0.7);  params.set(gaNpMutation, 0.01);  params.set(gaNnGenerations, 100);  params.set(gaNscoreFilename, "bog.dat");  params.set(gaNscoreFrequency, 10); // record score every 10th generation  params.set(gaNflushFrequency, 10); // dump scores every 10th recorded score  params.parse(argc, argv, gaFalse); // Parse the command line for GAlib args.// Now create the GA and run it.  We first create a chromsome with the// operators we want.  Once we have the genome set up, create the genetic // algorithm, set the parameters, and let it go.  GATreeGenome<int> genome(objective);  genome.initializer(TreeInitializer);  genome.mutator(GATreeGenome<int>::SwapSubtreeMutator);  GASteadyStateGA ga(genome);  ga.parameters(params);  ga.evolve(seed);  genome = ga.statistics().bestIndividual();//  cout << "the ga generated this tree:\n" << genome << "\n";  cout << genome.size() << " nodes, " << genome.depth() << " levels deep.\n";  cout << "best of generation data are in '" << ga.scoreFilename() << "'\n";  return 0;} /* ----------------------------------------------------------------------------Objective function  All we do in this objective function is try to maximize the size of the tree.Just return the tree size.  This means that if you run this objective functionfor many generations you'll run out of memory!  There is no limit to tree orlist sizes built-in to the GA library.---------------------------------------------------------------------------- */floatobjective(GAGenome & c){  GATreeGenome<int> & genome = (GATreeGenome<int> &)c;  return genome.size();}/* ----------------------------------------------------------------------------Here is the initializer for our genomes.  It builds a tree of n items of typeint.  Notice that we first destroy any tree that is already in the genome before we do our initialization.  This is so that the genomes can be re-used.When you re-run a GA, it does not destroy the individuals in the population - it reuses them.  Thus, the initializer must make sure that the genome is cleaned up before it tries to initialize it.---------------------------------------------------------------------------- */voidTreeInitializer(GAGenome & c){  GATreeGenome<int> &child=(GATreeGenome<int> &)c;// destroy any pre-existing tree  child.root();  child.destroy();// Create a new tree with depth of 'depth' and each eldest node containing// 'n' children (the other siblings have none).  int depth=2, n=3, count=0;  child.insert(count++,GATreeBASE::ROOT);  for(int i=0; i<depth; i++){    child.eldest();    child.insert(count++);    for(int j=0; j<n; j++)      child.insert(count++,GATreeBASE::AFTER);  }}/* ----------------------------------------------------------------------------Tree genome method overrides-------------------------------------------------------------------------------  Here we override the built-in methods for the tree class.  We can do thisbecause the tree class is template-ized - when the compiler looks for aninstance of the tree class methods, it finds these so it won't generate aninstance from the templates.  You can do this with ANY method of a templateclass.  Here we do it only for the write method.  The default write operator prints out pointers to the contents of each node.Here we print out the actual contents of each node.  This assumes that the object in our node has the operator<< defined for it.---------------------------------------------------------------------------- */void WriteNode(ostream & os, GANode<int> * n){  if(!n) return;  GANodeBASE * node = (GANodeBASE *)n;  os.width(10);  os << ((GANode<int> *)node)->contents << " ";  os.width(10);   if(node->parent) os << ((GANode<int> *)node->parent)->contents << " ";  else os << "." << " ";  os.width(10);   if(node->child) os << ((GANode<int> *)node->child)->contents << " ";  else os << "." << " ";  os.width(10);  if(node->next) os << ((GANode<int> *)node->next)->contents << " ";  else os << "." << " ";  os.width(10);  if(node->prev) os << ((GANode<int> *)node->prev)->contents << "\n";  else os << ".\n";  WriteNode(os, (GANode<int> *)node->child);  for(GANodeBASE * tmp=node->next; tmp && tmp != node; tmp=tmp->next){    os.width(10);    os << ((GANode<int> *)tmp)->contents << " ";    os.width(10);    if(tmp->parent) os << ((GANode<int> *)tmp->parent)->contents << " ";    else os << "." << " ";    os.width(10);     if(tmp->child) os << ((GANode<int> *)tmp->child)->contents << " ";    else os << "." << " ";    os.width(10);     if(tmp->next) os << ((GANode<int> *)tmp->next)->contents << " ";    else os << "." << " ";    os.width(10);     if(tmp->prev) os << ((GANode<int> *)tmp->prev)->contents << "\n";    else os << ".\n";    WriteNode(os, (GANode<int> *)tmp->child);  }}intGATreeGenome<int>::write(ostream & os) const{  os << "      node     parent      child       next       prev\n";  WriteNode(os, (GANode<int> *)rt);  return os.fail() ? 1 : 0;}// If your compiler does not do automatic instantiation (e.g. g++ 2.6.8),// then define the NO_AUTO_INST directive.  The following includes force an// instantiation of the template class that we're going to use in the example.#ifdef NO_AUTO_INST#include <ga/GATree.C>#include <ga/GATreeGenome.C>#if defined(__GNUG__)template class GATree<int>;template class GATreeGenome<int>;#elseGATree<int>;GATreeGenome<int>;#endif#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人福利视频在线看| 91精品国产综合久久久久| 99热在这里有精品免费| 欧美日韩电影一区| 精品剧情在线观看| 亚洲主播在线播放| 国产一区二区调教| 在线不卡的av| 中文字幕一区二区在线观看 | 天使萌一区二区三区免费观看| 狠狠色综合播放一区二区| 欧美性受极品xxxx喷水| 亚洲国产精品精华液2区45| 热久久一区二区| 欧美三区在线观看| 亚洲欧洲成人av每日更新| 国产麻豆午夜三级精品| 在线播放欧美女士性生活| 亚洲男人的天堂av| 丁香一区二区三区| 日韩一区二区在线看| 午夜成人免费视频| 色就色 综合激情| 国产丝袜欧美中文另类| 韩国精品一区二区| 日韩欧美在线观看一区二区三区| 亚洲精品第1页| 成人免费视频播放| 久久精品人人爽人人爽| 免费精品99久久国产综合精品| 97se亚洲国产综合自在线不卡| 2欧美一区二区三区在线观看视频| 日韩av中文在线观看| 欧美日韩免费在线视频| 亚洲二区在线视频| 欧美日韩久久不卡| 午夜精品久久久久久久99水蜜桃| 欧美最新大片在线看| 夜夜操天天操亚洲| 欧美手机在线视频| 午夜视频一区二区三区| 欧美精品在线一区二区| 蜜臀a∨国产成人精品| 欧美xxxx在线观看| 久久国产人妖系列| 久久精品亚洲乱码伦伦中文| 福利一区在线观看| 国产精品久久久久久久久免费丝袜| 国产精品99久久久久久宅男| 欧美国产欧美综合| 91色视频在线| 亚洲一区二区三区视频在线| 欧美精品黑人性xxxx| 久久成人久久鬼色| 中文字幕av免费专区久久| 91美女片黄在线| 首页亚洲欧美制服丝腿| 26uuu精品一区二区在线观看| 岛国精品在线观看| 亚洲日本中文字幕区| 欧美日韩一区精品| 久久精品二区亚洲w码| 国产精品欧美极品| 一本大道久久a久久精品综合| 亚洲国产wwwccc36天堂| 欧美精品一区二区蜜臀亚洲| 不卡高清视频专区| 日本不卡视频一二三区| 成人免费一区二区三区视频 | 欧美疯狂做受xxxx富婆| 精品中文字幕一区二区小辣椒| 国产喂奶挤奶一区二区三区| 91女人视频在线观看| 日本最新不卡在线| 国产精品素人视频| 欧美美女网站色| 成人蜜臀av电影| 午夜精品福利在线| 国产婷婷一区二区| 欧美在线你懂得| 国产精品伊人色| 午夜视频在线观看一区二区| 日本一区二区三区dvd视频在线| 色综合久久精品| 国产精品一区二区无线| 亚洲一区在线观看免费观看电影高清 | 91小宝寻花一区二区三区| 日韩成人av影视| ...xxx性欧美| 久久精品男人的天堂| 欧美男人的天堂一二区| 成人性生交大片免费看视频在线 | 26uuu亚洲| 欧美一区午夜精品| 欧美性猛片xxxx免费看久爱| 国产精品69毛片高清亚洲| 奇米一区二区三区av| 亚洲精选在线视频| 日本一区二区高清| 日韩欧美一区二区免费| 欧美男生操女生| 欧美在线视频不卡| 91同城在线观看| 成人午夜电影网站| 国产真实乱偷精品视频免| 日日骚欧美日韩| 亚洲欧美激情插 | 精品国产网站在线观看| 在线电影一区二区三区| 欧美唯美清纯偷拍| 色女孩综合影院| 99久久国产免费看| 成人开心网精品视频| 国产精品一区二区你懂的| 久久精品国产精品亚洲红杏 | 制服丝袜一区二区三区| 91精品91久久久中77777| 国产精华液一区二区三区| 久久99精品久久久久久国产越南 | 黑人精品欧美一区二区蜜桃| 日本在线播放一区二区三区| 午夜视频一区二区三区| 日本欧美一区二区三区乱码| 视频一区二区中文字幕| 日韩在线一区二区| 秋霞电影网一区二区| 午夜成人免费视频| 青青草国产成人99久久| 麻豆国产精品视频| 久久国产剧场电影| 国产一区二区三区电影在线观看 | 成人av免费观看| 成人av动漫网站| 91日韩精品一区| 91福利视频在线| 欧美浪妇xxxx高跟鞋交| 日韩精品专区在线影院重磅| 日韩精品一区在线| 久久久影院官网| 亚洲视频一区二区免费在线观看| 亚洲麻豆国产自偷在线| 五月激情丁香一区二区三区| 六月丁香婷婷色狠狠久久| 国产一区高清在线| 972aa.com艺术欧美| 欧美日韩一区二区电影| 精品久久久久久无| 中文字幕在线一区免费| 午夜久久久久久电影| 久久国产精品露脸对白| 成人黄色在线网站| 欧美三级在线看| 精品人伦一区二区色婷婷| 欧美激情资源网| 亚洲综合色区另类av| 另类小说综合欧美亚洲| 高清成人免费视频| 在线观看视频一区| 久久一留热品黄| 亚洲一区二区欧美| 韩国av一区二区三区在线观看| av在线播放一区二区三区| 日韩限制级电影在线观看| 成人免费视频在线观看| 另类调教123区| 色哟哟精品一区| 精品国产电影一区二区| 亚洲国产精品一区二区www在线| 国产美女精品一区二区三区| 欧美日韩一区二区三区在线| 国产精品私人自拍| 看片的网站亚洲| 欧美亚洲国产一卡| 国产亚洲精久久久久久| 日韩经典一区二区| 色综合色狠狠综合色| 欧美v日韩v国产v| 亚洲综合激情另类小说区| 福利91精品一区二区三区| 欧美一区二区在线不卡| 一区二区在线观看免费| 国产成人av一区二区| 日韩精品专区在线影院观看| 午夜精品福利视频网站| 色综合天天做天天爱| 亚洲国产成人自拍| 精品一区二区三区av| 欧美一区二区视频免费观看| 一区二区高清在线| 9l国产精品久久久久麻豆| 精品播放一区二区| 秋霞午夜av一区二区三区| 欧美日韩高清一区二区三区| 亚洲欧美日韩电影| 99精品视频在线免费观看| 亚洲国产电影在线观看| 韩国v欧美v亚洲v日本v| 精品久久一区二区| 国内精品久久久久影院薰衣草| 欧美一区二区三区婷婷月色|