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

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

?? ex7.c

?? 遺傳算法的源程序例子
?? C
字號(hào):
/* ----------------------------------------------------------------------------  ex7.C  mbwall 19jan95  Copyright 1995-1996  Massachusetts Institute of Technology DESCRIPTION:   This example functions the same way as example 3, but this example showshow to use some of the other member functions in the GA library.  We also doa few more fancy things with the genome (ie use the read/write methods).---------------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <iostream.h>#include <fstream.h>#include <ga/ga.h>float objective(GAGenome &);intmain(int argc, char *argv[]){  cout << "Example 7\n\n";  cout << "This program reads in a data file then runs a steady-state GA \n";  cout << "whose objective function tries to match the pattern of bits that\n";  cout << "are in the data file.\n\n";// 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 ii=1; ii<argc; ii++) {    if(strcmp(argv[ii++],"seed") == 0) {      GARandomSeed((unsigned int)atoi(argv[ii]));    }  }// Set the default values of the parameters.  int i,j;  GAParameterList params;  GASteadyStateGA::registerDefaultParameters(params);  params.set(gaNpopulationSize, 50);    // number of individuals in population  params.set(gaNpCrossover, 0.8);       // likelihood of doing crossover  params.set(gaNpMutation, 0.001);	// probability of mutation  params.set(gaNnGenerations, 200);	// number of generations  params.set(gaNscoreFrequency, 20);	// how often to record scores  params.set(gaNflushFrequency, 50);    // how often to flush scores to file  params.set(gaNscoreFilename, "bog.dat");  params.parse(argc, argv, gaFalse);  char datafile[128] = "smiley.txt";  char parmfile[128] = "";// Parse the command line for arguments.  We look for two possible arguments// (after the parameter list has grabbed everything it recognizes).  One is the// name of a data file from which to read, the other is the name of a // parameters file from which to read.  Notice that any parameters in the // parameters file will override the defaults above AND any entered on the// command line.  for(i=1; i<argc; i++){    if(strcmp("dfile", argv[i]) == 0){      if(++i >= argc){        cerr << argv[0] << ": the data file option needs a filename.\n";        exit(1);      }      else{	sprintf(datafile, argv[i]);        continue;      }    }    else if(strcmp("pfile", argv[i]) == 0){      if(++i >= argc){        cerr << argv[0] << ": the parameters file option needs a filename.\n";        exit(1);      }      else{	sprintf(parmfile, argv[i]);	params.read(parmfile);        continue;      }    }    else if(strcmp("seed", argv[i]) == 0){      if(++i < argc) continue;      continue;    }    else {      cerr << argv[0] << ":  unrecognized arguement: " << argv[i] << "\n\n";      cerr << "valid arguements include GAlib arguments plus:\n";      cerr << "  dfile\tdata file from which to read (" << datafile << ")\n";      cerr << "  pfile\tparameters file (" << parmfile << ")\n\n";      cerr << "default parameters are:\n" << params << "\n\n";      exit(1);    }  }// Read in the pattern from the specified file.  File format is pretty simple:// two integers that give the height then width of the matrix, then the matrix// of 1's and 0's (with whitespace inbetween).//   Here we use a binary string genome to store the desired pattern.  This// shows how you can read in directly from a stream into a genome.  (This can // be useful in a population initializer when you want to bias your population)  ifstream inStream(datafile, ios :: in);  if(!inStream){    cerr << "Cannot open " << datafile << " for input.\n";    exit(1);  }  int height, width;  inStream >> height >> width;  GA2DBinaryStringGenome target(width, height);  inStream >> target;  inStream.close();// Print out the pattern to be sure we got the right one.  cout << "input pattern:\n";  for(j=0; j<height; j++){    for(i=0; i<width; i++)      cout << (target.gene(i,j) == 1 ? '*' : ' ') << " ";    cout << "\n";  }  cout << "\n"; cout.flush();// Now create the first genome and the GA.  When we create the genome, we give// it not only the objective function but also 'user data'.  In this case, the// user data is a pointer to our target pattern.  From a C++ point of view it// would be better to derive a new genome class with its own data, but here we// just want a quick-and-dirty implementation, so we use the user-data.  GA2DBinaryStringGenome genome(width, height, objective, (void *)&target);  GASteadyStateGA ga(genome);// When you use a GA with overlapping populations, the default score// frequency (how often the best of generation score is recorded) defaults// to 100.  We use the parameters member function to change this value (along// with all of the other parameters we set above).  You can also change the // score frequency using the scoreFrequency member function of the GA.  Each of// the parameters can be set individually if you like.//   Here we just use the values that were set in the parameter list.  ga.parameters(params);// The default selection method is RouletteWheel.  Here we set the selection// method to TournamentSelection.  GATournamentSelector selector;  ga.selector(selector);// The following member functions override the values that were set using the// parameter list.  They are commented out here so that you can see how they // would be used.// We can control the amount of overlap from generation to generation using the// pReplacement member function.  If we specify a value of 1 (100%) then the// entire population is replaced each generation.  Notice that the percentage// must be high enough to have at least one individual produced in each // generation.  If not, the GA will post a warning message.//  ga.pReplacement(0.3);// Often we use the number of generations as the criterion for terminating the// GA run.  Here we override that and tell the GA to use convergence as a // termination criterion.  Note that you can pass ANY function as the stopping// criterion (as long as it has the correct signature).//   Notice that the values we set here for p- and n-convergence override those// that we set in the parameters object.  ga.terminator(GAGeneticAlgorithm::TerminateUponConvergence);//  ga.pConvergence(0.99);	        // converge to within 1%//  ga.nConvergence(100);		// within the last 100 generations// Evolve the GA 'by hand'.  When you use this method, be sure to initialize// the GA before you start to evolve it.  You can print out the status of the// current population by using the ga.population() member function.  This is// also how you would print the status of the GA to disk along the way (rather// than waiting to the end then printing the scores, for example).  ga.initialize();  while(!ga.done()){    ++ga;  }  ga.flushScores();// Now that the GA is finished, we set our default genome to equal the contents// of the best genome that the GA found.  Then we print it out.  genome = ga.statistics().bestIndividual();  cout << "the ga generated:\n";  for(j=0; j<height; j++){    for(i=0; i<width; i++)      cout << (genome.gene(i,j) == 1 ? '*' : ' ') << " ";    cout << "\n";  }  cout << "\n"; cout.flush();  cout << "best of generation data are in '" << ga.scoreFilename() << "'\n";  return 0;} // This objective function just tries to match the genome to the pattern in the// user data.floatobjective(GAGenome & c){  GA2DBinaryStringGenome & genome = (GA2DBinaryStringGenome &)c;  GA2DBinaryStringGenome * pattern =     (GA2DBinaryStringGenome *)c.userData();  float value=0.0;  for(int i=0; i<genome.width(); i++)    for(int j=0; j<genome.height(); j++)      value += (float)(genome.gene(i,j) == pattern->gene(i,j));  return(value);}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
麻豆成人91精品二区三区| 亚洲v日本v欧美v久久精品| 亚洲精品免费播放| 免费高清视频精品| 色综合中文字幕| 久久久99精品久久| 午夜日韩在线观看| 91女神在线视频| 久久久午夜精品| 麻豆精品国产91久久久久久| 91蝌蚪porny成人天涯| 国产日韩欧美不卡| 久久国产婷婷国产香蕉| 欧美挠脚心视频网站| 中文字幕一区三区| 懂色av一区二区夜夜嗨| 欧美大片免费久久精品三p| 亚洲国产裸拍裸体视频在线观看乱了 | 91丨九色porny丨蝌蚪| 久久综合久久综合九色| 美女在线一区二区| 欧美老年两性高潮| 午夜精品一区二区三区免费视频 | 国产精品亚洲视频| 一区二区三区在线视频观看58| 久久99精品国产.久久久久久| 欧美系列亚洲系列| 亚洲久草在线视频| 91首页免费视频| 国产精品短视频| 波多野结衣视频一区| 国产精品水嫩水嫩| 国产98色在线|日韩| 国产欧美日韩久久| 波多野结衣在线一区| 欧美国产日韩一二三区| 风间由美性色一区二区三区| 国产日韩欧美a| 成人精品视频一区| 综合色天天鬼久久鬼色| 91美女福利视频| 亚洲一区在线观看网站| 欧美日韩高清不卡| 蜜桃精品视频在线| 国产喂奶挤奶一区二区三区| 福利一区福利二区| 亚洲美女区一区| 在线不卡中文字幕播放| 美女在线视频一区| 国产精品无码永久免费888| 91片在线免费观看| 五月婷婷综合在线| 久久久久国产精品人| hitomi一区二区三区精品| 一区二区三区免费网站| 欧美一区二区三区性视频| 国产一区二区三区在线看麻豆 | 欧美日本一区二区| 精品亚洲成a人在线观看| 亚洲国产精品成人综合| 欧美主播一区二区三区| 久久精品国产秦先生| 国产精品福利一区二区三区| 欧美色图12p| 国产精品一区二区无线| 一区二区免费在线播放| 欧美mv和日韩mv的网站| 99国产精品99久久久久久| 日韩电影在线一区二区三区| 国产午夜精品理论片a级大结局| 欧美亚洲一区二区在线| 国产一区二区在线影院| 午夜伊人狠狠久久| 欧美国产丝袜视频| 日韩一区国产二区欧美三区| 国产成人亚洲综合色影视| 亚洲综合一区二区三区| 久久久国产精品麻豆| 欧美色爱综合网| 不卡的av在线| 精品制服美女丁香| 亚洲成人动漫在线观看| 91福利社在线观看| 亚洲少妇最新在线视频| 国内精品嫩模私拍在线| 欧美日韩一区成人| 粉嫩嫩av羞羞动漫久久久| 日日摸夜夜添夜夜添亚洲女人| 中文一区一区三区高中清不卡| 制服丝袜成人动漫| 色哟哟欧美精品| 高清不卡一区二区| 久久国产精品第一页| 婷婷综合五月天| 亚洲欧美另类久久久精品2019| 久久久天堂av| 精品国产一区二区三区久久久蜜月| 91理论电影在线观看| 国产91精品一区二区麻豆亚洲| 人人精品人人爱| 午夜在线成人av| 亚洲一线二线三线视频| 伊人婷婷欧美激情| 国产精品成人免费| 中文字幕欧美区| 国产欧美日韩不卡| 日韩午夜激情av| 成人三级在线视频| 午夜av一区二区三区| 亚洲在线中文字幕| 一区二区三区四区蜜桃| 亚洲精品视频在线观看网站| 国产精品第13页| 国产精品成人一区二区三区夜夜夜| 中文字幕精品三区| 亚洲国产精华液网站w| 国产精品久久久久久久午夜片| 国产精品丝袜久久久久久app| 中文av一区二区| 亚洲人吸女人奶水| 一区二区三区.www| 亚洲国产成人av好男人在线观看| 亚洲一区二区三区视频在线播放 | 日韩avvvv在线播放| 天涯成人国产亚洲精品一区av| 亚洲国产日韩一级| 美腿丝袜在线亚洲一区| 麻豆一区二区在线| 国模冰冰炮一区二区| 国产精品一区二区久久精品爱涩| 国产99久久久久| 91美女蜜桃在线| 91精品久久久久久蜜臀| 精品国产乱码久久久久久久久| 久久精品男人的天堂| 中文字幕一区二区视频| 亚洲最色的网站| 男男视频亚洲欧美| 丁香啪啪综合成人亚洲小说| 99久久精品免费| 欧美熟乱第一页| 日韩美女天天操| 国产精品女同互慰在线看| 亚洲一区二区三区影院| 久久99精品国产麻豆婷婷洗澡| 国产河南妇女毛片精品久久久 | 91精品国产91综合久久蜜臀| 精品国产乱码91久久久久久网站| 国产精品丝袜久久久久久app| 亚洲二区在线视频| 国产福利一区二区三区视频在线| 色素色在线综合| 精品国产自在久精品国产| 亚洲日本va午夜在线电影| 日本欧美久久久久免费播放网| 粉嫩一区二区三区在线看| 欧美三级中文字幕| 日本一区二区三区高清不卡| 亚洲午夜成aⅴ人片| 国产麻豆视频一区| 欧美怡红院视频| 久久精品免视看| 日韩高清欧美激情| 91影院在线观看| 久久综合九色综合欧美98| 夜夜嗨av一区二区三区网页| 国产麻豆一精品一av一免费| 欧美中文字幕久久| 国产精品传媒在线| 国产美女一区二区三区| 欧美一区二区在线播放| 日韩伦理av电影| 国产高清不卡二三区| 91精品国产综合久久香蕉的特点 | 韩国精品久久久| 欧美在线你懂的| 中日韩免费视频中文字幕| 九九在线精品视频| 在线成人免费视频| 午夜精品久久久久久久99樱桃 | 久久国产麻豆精品| 51精品国自产在线| 亚洲一区二区三区精品在线| 成人激情午夜影院| 亚洲国产电影在线观看| 国产精品一区二区在线观看不卡 | 亚洲一区二区av在线| 99久久精品一区| 国产精品看片你懂得| 国产精品99久久久久久有的能看| 日韩欧美视频一区| 男女性色大片免费观看一区二区 | 欧美一区二区三区在线| 日韩高清不卡一区二区| 欧美性xxxxxxxx| 亚洲午夜精品17c| 8x福利精品第一导航| 日韩精品成人一区二区三区| 欧美日韩卡一卡二| 日韩高清一区在线|