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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? ex8.cpp

?? 這是一個(gè)面向?qū)ο蟮腉A遺傳算法庫(kù)GAlib: A C++ Library of Genetic Algorithm Components)
?? CPP
字號(hào):
/* ----------------------------------------------------------------------------  ex8.C  mbwall 14jan95  Copyright 1995-1996  Massachusetts Institute of Technology DESCRIPTION:   Example program for the list genome.  This example containsthe code to run a genetic algorithm with a list genome.  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).  The objective function for this example returns both positive and negativevalues, depending on the genome it is evaluting.  So the example also shows howto use the sigma truncation scaling method to handle the mixed scores.---------------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <ga/ga.h>#include <ga/std_stream.h>#define cout STD_COUT#define ostream STD_OSTREAM// Objective function and initializer declarations.float objective(GAGenome &);void ListInitializer(GAGenome &);intmain(int argc, char *argv[]){  cout << "Example 8\n\n";  cout << "This program runs a steady-state GA whose objective function\n";  cout << "tries to maximize the size of the list and tries to make lists\n";  cout << "that contain the number 101 in the nodes.  The lists contain\n";  cout << "ints in the 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.  for(int i=1; i<argc; i++) {    if(strcmp(argv[i++],"seed") == 0)      GARandomSeed((unsigned int)atoi(argv[i]));  }// Create the initial genome for the genetic algorithm to use.  Set the// initializer and mutation before we make the genetic algorithm.  GAListGenome<int> genome(objective);  genome.initializer(ListInitializer);//  genome.mutator(GAListGenome<int>::SwapMutator);  genome.mutator(GAListGenome<int>::DestructiveMutator);// Now that we have a genome, we use it to create our GA.  After creating the// GA we set the parameters and tell the GA to use sigma truncation scaling// rather than the default (linear scaling).  Set the crossover to single// point crossover.  The genetic algorithm handles crossover since genomes// don't know about other genomes.  We could set the crossover on the genome// if we wanted - either way will work.  GASteadyStateGA ga(genome);  GASigmaTruncationScaling scale;  ga.scaling(scale);  ga.crossover(GAListGenome<int>::OnePointCrossover);// Set the default parameters we want to use, then check the command line for// other arguments that might modify these.  ga.set(gaNpopulationSize, 40);	// population size  ga.set(gaNpCrossover, 0.6);		// probability of crossover  ga.set(gaNpMutation, 0.05);		// probability of mutation  ga.set(gaNnGenerations, 50);		// number of generations  ga.set(gaNscoreFrequency, 1);		// how often to record scores  ga.set(gaNflushFrequency, 10);	// how often to dump scores to file  ga.set(gaNselectScores,		// which scores should we track?	 GAStatistics::Maximum|GAStatistics::Minimum|GAStatistics::Mean);  ga.set(gaNscoreFilename, "bog.dat");  ga.parameters(argc, argv);// Evolve the genetic algorithm then dump out the results of the run.  ga.evolve();  genome = ga.statistics().bestIndividual();//  cout << "the ga generated the list:\n" << genome << "\n";  cout << "the list contains " << genome.size() << " nodes\n";  cout << "the ga used the parameters:\n" << ga.parameters() << "\n";  return 0;} /* ----------------------------------------------------------------------------Objective function  There is no limit to the size of a list (only the memory you have on yourcomputer).  This objective function tries to build a list that contains thenumber 101 in all of its nodes.  If we don't put some control on this objectivethen the list will grow without bound.  So we dampen it a bit with a penalty for large size.  However, this will make the score go negative, so we must usea scaling object that allows negative objective scores.  We could get lists with no contents, so we have to check for that.  Just makesure that head has contents.  If it does, then the rest of the genome will.  When we access the node contents we have to dereference the member functions.For example, we do *chrom.head() not chrom.head().  This is because the memberfunctions return a pointer to the node's contents, not the actual contents.---------------------------------------------------------------------------- */floatobjective(GAGenome & c){  GAListGenome<int> & genome = (GAListGenome<int> &)c;  int count=0;  if(!genome.head()) return 0;  count = (*genome.head() == 101) ? 1 : 0; // move to head of the list  for(int i=1; i<genome.size(); i++)    count += (*genome.next() == 101) ? 1 : 0; // check each element of the list  return 5*count - genome.size();}/* ----------------------------------------------------------------------------Here is the initializer for our genomes.  It builds a list of n items of typeint.  Notice that we first destroy any list 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.---------------------------------------------------------------------------- */voidListInitializer(GAGenome & c){  GAListGenome<int> &child=(GAListGenome<int> &)c;  while(child.head()) child.destroy(); // destroy any pre-existing list  int n=75;  child.insert(100,GAListBASE::HEAD);  for(int i=0; i<n; i++)    child.insert(i+100);  for(int j=0; j<n; j++)    child.swap(GARandomInt(0,n-1), GARandomInt(0,n-1));}//   Here we specialize the write method for the List class.  This lets us see// exactly what we want (the default write method dumps out pointers to the// data rather than the data contents).//   This routine prints out the contents of each element of the list, // separated by a space.  It does not put a newline at the end of the list.//   Notice that you can specialize ANY function of a template class, but // some compilers are more finicky about how you do it than others.  For the// metrowerks compiler this specialization must come before the forced// instantiation.template<> intGAListGenome<int>::write(ostream & os) const{  int *cur, *head;  GAListIter<int> tmpiter(*this);  if((head=tmpiter.head()) != NULL) os << *head << " ";  for(cur=tmpiter.next(); cur && cur != head; cur=tmpiter.next())    os << *cur << " ";  return os.fail() ? 1 : 0;}// force instantiations for compilers that do not do auto instantiation// for some compilers (e.g. metrowerks) this must come after any// specializations or you will get 'multiply-defined errors when you compile.#if !defined(GALIB_USE_AUTO_INST)#include <ga/GAList.C>#include <ga/GAListGenome.C>GALIB_INSTANTIATION_PREFIX GAList<int>;GALIB_INSTANTIATION_PREFIX GAListGenome<int>;#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
人人狠狠综合久久亚洲| 国产综合色精品一区二区三区| 日韩视频免费观看高清完整版 | 日韩一区二区精品在线观看| 高清不卡一区二区在线| 亚洲成人av一区二区三区| 中文字幕国产精品一区二区| 在线成人午夜影院| 日本精品一区二区三区四区的功能| 麻豆精品一二三| 亚洲一区二区在线观看视频| 国产精品麻豆一区二区| 国产精品美女久久久久高潮 | 日韩三级精品电影久久久| 91丨porny丨国产入口| 国产九九视频一区二区三区| 三级久久三级久久| 亚洲一区二区三区在线播放| 欧美激情在线观看视频免费| 欧美tickle裸体挠脚心vk| 欧美高清视频一二三区 | 成人午夜伦理影院| 久久国产精品72免费观看| 天堂蜜桃91精品| 亚洲精品菠萝久久久久久久| 中文字幕一区二区三区不卡在线 | 欧美美女一区二区| 色综合久久六月婷婷中文字幕| 国产乱码精品一区二区三区忘忧草| 五月综合激情婷婷六月色窝| 亚洲一区影音先锋| 樱花草国产18久久久久| 亚洲天堂久久久久久久| 中文字幕精品一区二区三区精品| 欧美精品一区在线观看| 精品国产免费人成电影在线观看四季| 欧美一区二区三区啪啪| 91麻豆精品国产自产在线观看一区 | 在线亚洲免费视频| 欧美在线影院一区二区| 在线精品视频一区二区三四| 色成年激情久久综合| 日本精品裸体写真集在线观看| 91在线云播放| 在线一区二区三区四区| 欧美专区亚洲专区| 欧美久久久影院| 日韩欧美美女一区二区三区| 日韩精品专区在线影院重磅| 精品不卡在线视频| 国产日韩高清在线| 国产精品久久久久三级| 亚洲精品成人悠悠色影视| 亚洲一区在线播放| 日本欧美大码aⅴ在线播放| 青青草97国产精品免费观看无弹窗版 | 丰满少妇久久久久久久| av在线综合网| 欧美无乱码久久久免费午夜一区 | 青青青伊人色综合久久| 狠狠色伊人亚洲综合成人| 国产精品18久久久久久vr| 成人丝袜18视频在线观看| 95精品视频在线| 欧美人与禽zozo性伦| 精品日韩在线观看| 国产精品视频看| 久久精品国产亚洲一区二区三区| 韩国一区二区视频| 成人免费高清在线| 欧美视频中文一区二区三区在线观看| 欧美一区二区视频免费观看| 久久精品综合网| 亚洲精品美国一| 久久精品国产色蜜蜜麻豆| 懂色av中文一区二区三区| 91久久免费观看| 欧美成人a∨高清免费观看| 国产精品热久久久久夜色精品三区 | 欧美日韩国产一区二区三区地区| 91精品国产aⅴ一区二区| 国产欧美日韩另类视频免费观看| 亚洲欧美福利一区二区| 蜜臀av一区二区三区| 成人ar影院免费观看视频| 欧美日韩视频一区二区| 久久精品综合网| 午夜视频一区二区三区| 国产精品一区二区三区99| 在线免费观看视频一区| 久久久噜噜噜久久中文字幕色伊伊| 亚洲欧美日韩国产综合| 免费成人在线视频观看| aaa亚洲精品| 欧美va亚洲va香蕉在线 | 蜜桃av噜噜一区| 91国在线观看| 国产亚洲欧美色| 日韩电影在线一区| 99精品视频在线观看免费| 日韩精品自拍偷拍| 亚洲国产视频网站| 成人高清视频在线| 精品国产网站在线观看| 亚洲亚洲精品在线观看| 成人高清在线视频| 久久综合色婷婷| 日韩av中文字幕一区二区三区| 99久久777色| 久久美女艺术照精彩视频福利播放| 亚洲高清不卡在线观看| 99久久精品费精品国产一区二区| 久久日一线二线三线suv| 日本免费新一区视频| 欧美日韩一区二区三区在线| 一区二区中文视频| 国产91丝袜在线播放九色| 欧美成人高清电影在线| 亚洲va国产天堂va久久en| 色婷婷综合五月| 综合久久给合久久狠狠狠97色| 国产精品一区二区免费不卡| 日韩精品中文字幕在线不卡尤物| 视频一区中文字幕| 欧美视频一区二区| 亚洲一区二区在线观看视频 | 欧美三区免费完整视频在线观看| 亚洲少妇最新在线视频| 北条麻妃一区二区三区| 国产午夜亚洲精品不卡| 国产精品主播直播| 久久亚洲精品小早川怜子| 免费高清视频精品| 日韩美女一区二区三区四区| 日本午夜精品视频在线观看| 欧美肥妇bbw| 日韩高清不卡在线| 欧美一级欧美一级在线播放| 日韩av在线播放中文字幕| 欧美一卡二卡在线| 麻豆成人免费电影| 日韩av不卡在线观看| 91国偷自产一区二区三区成为亚洲经典| 久久久久久久久久看片| 麻豆国产欧美一区二区三区| 日韩一级片在线观看| 另类小说视频一区二区| 精品99久久久久久| 国产精品 日产精品 欧美精品| 国产日韩综合av| 成人免费视频视频在线观看免费| 国产精品美女久久久久久| av色综合久久天堂av综合| 日韩理论片中文av| 欧美性淫爽ww久久久久无| 日日欢夜夜爽一区| 2023国产一二三区日本精品2022| 国产一区亚洲一区| 中文字幕亚洲区| 欧美在线观看视频在线| 日韩成人伦理电影在线观看| 欧美成人a在线| 成人av动漫在线| 亚洲午夜精品网| 精品久久一区二区| av在线不卡免费看| 亚洲高清视频的网址| 精品国产免费久久| av成人免费在线观看| 亚洲成av人片在线| 久久综合九色综合欧美就去吻| youjizz国产精品| 午夜欧美大尺度福利影院在线看| 精品乱人伦小说| 91老司机福利 在线| 日本强好片久久久久久aaa| 国产欧美日韩三级| 欧美美女一区二区在线观看| 国产资源精品在线观看| 亚洲精品伦理在线| 精品黑人一区二区三区久久| 91啪亚洲精品| 精品一区二区综合| 一区二区三区欧美日韩| 精品1区2区在线观看| 日本福利一区二区| 国产精品一二三区在线| 亚洲国产精品一区二区www在线| 精品久久久久久久人人人人传媒 | 日韩电影在线一区二区三区| 欧美国产激情二区三区| 欧美喷水一区二区| 成人伦理片在线| 麻豆久久久久久| 亚洲午夜久久久久久久久电影网| 久久久亚洲午夜电影| 欧美剧情电影在线观看完整版免费励志电影 | 久久久国产精品不卡| 欧美三级电影在线看| 成人激情午夜影院|