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

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

?? ex19.c

?? 遺傳算法的源程序例子
?? C
字號:
/* ----------------------------------------------------------------------------  ex19.C  mbwall 5sep95  Copyright (c) 1995-1996  Massachusetts Institute of Technology DESCRIPTION:   This example runs all of the DeJong functions.  You can specify which function you want at the command line.  We use SigmaTruncation scaling to makecertain that negative objective scores won't be a problem for us.   The DeJong functions in this code were pinched from the eval.c file in thepga-2.8 genetic algorithm package (under the terms of the GNU General PublicLicense).---------------------------------------------------------------------------- */#include <stdio.h>#include <stdlib.h>#include <iostream.h>#include <fstream.h>#include <math.h>#include <ga/ga.h>double Gauss(double mean, double variance);float DeJong1(GAGenome &);float DeJong2(GAGenome &);float DeJong3(GAGenome &);float DeJong4(GAGenome &);float DeJong5(GAGenome &);GAGenome::Evaluator objective[5] = {DeJong1,DeJong2,DeJong3,DeJong4,DeJong5};intmain(int argc, char *argv[]){  cout << "Example 19\n\n";  cout << "This program runs the DeJong test problems.\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 ii=1; ii<argc; ii++) {    if(strcmp(argv[ii++],"seed") == 0) {      seed = atoi(argv[ii]);    }  }  GAParameterList params;  GASteadyStateGA::registerDefaultParameters(params);  params.set(gaNpopulationSize, 30);	// population size  params.set(gaNpCrossover, 0.9);	// probability of crossover  params.set(gaNpMutation, 0.001);	// probability of mutation  params.set(gaNnGenerations, 400);	// number of generations  params.set(gaNpReplacement, 0.25);	// how much of pop to replace each gen  params.set(gaNscoreFrequency, 10);	// how often to record scores  params.set(gaNflushFrequency, 50);	// how often to dump scores to file  params.set(gaNscoreFilename, "bog.dat");  params.parse(argc, argv, gaFalse);    // parse command line for GAlib args  int whichFunction = 0;  for(int i=1; i<argc; i++){    if(strcmp("function", argv[i]) == 0 || strcmp("f", argv[i]) == 0){      if(++i >= argc){        cerr << argv[0] << ": you must specify a function (1-5)\n";        exit(1);      }      else{	whichFunction = atoi(argv[i]) - 1;	if(whichFunction < 0 || whichFunction > 4){	  cerr << argv[0] << ": the function must be in the range [1,5]\n";	  exit(1);	}        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 standard GAlib arguments plus:\n";      cerr << "  f\twhich function to evaluate (all)\n";      cerr << "parameters are:\n\n" << params << "\n\n";      exit(1);    }  }// Create the phenotype map depending on which dejong function we are going// to be running.  GABin2DecPhenotype map;  switch(whichFunction){  case 0:    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    break;  case 1:    map.add(16, -2.048, 2.048);    map.add(16, -2.048, 2.048);    break;  case 2:    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    map.add(16, -5.12, 5.12);    break;  case 3:    {      for(int j=0; j<30; j++)	map.add(16, -1.28, 1.28);    }    break;  case 4:    map.add(16, -65.536, 65.536);    map.add(16, -65.536, 65.536);    break;  default:    map.add(16, 0, 0);    break;  }// Now create the sample genome and run the GA.  GABin2DecGenome genome(map, objective[whichFunction]);  GAStatistics stats;  GASteadyStateGA ga(genome);  ga.parameters(params);  GASigmaTruncationScaling scaling;  ga.scaling(scaling);  cout << "running DeJong function number " << (whichFunction + 1) << " ...\n";  ga.evolve(seed);  cout << "the ga generated:\n" << ga.statistics().bestIndividual() << "\n";  cout << "\nthe statistics for the run are:\n" << ga.statistics();  cout << "\nbest-of-generation data are in 'bog.dat'\n";  cout.flush();  return 0;} // DeJong's first function is://// f1(x1,x2,x3) = x1*x1 + x2*x2 + x3*x3//// where each x is in the range [-5.12,5.12]floatDeJong1(GAGenome & c){  GABin2DecGenome & genome = (GABin2DecGenome &)c;  float value=0;  value += genome.phenotype(0) * genome.phenotype(0);  value += genome.phenotype(1) * genome.phenotype(1);  value += genome.phenotype(2) * genome.phenotype(2);  return(value);}// DeJong's second function is://// f2(x1,x2) = 100 * (x1*x1 - x2)^2 + (1 - x1)^2//// where each x is in the range [-2.048,2.048]floatDeJong2(GAGenome & c){  GABin2DecGenome & genome = (GABin2DecGenome &)c;  float value=100.0;  value *= genome.phenotype(0) * genome.phenotype(0) - genome.phenotype(1);  value *= genome.phenotype(0) * genome.phenotype(0) - genome.phenotype(1);  value += (1 - genome.phenotype(0))*(1 - genome.phenotype(0));  return(value);}// DeJong's third function is://// f3(x1,x2,x3,x4,x5) = //      25 + floor(x1) + floor(x2) + floor(x3) + floor(x4) + floor(x5)//// where each x is in the range [-5.12,5.12]floatDeJong3(GAGenome & c){  GABin2DecGenome & genome = (GABin2DecGenome &)c;  float value=25.0;  value -= floor(genome.phenotype(0));  value -= floor(genome.phenotype(1));  value -= floor(genome.phenotype(2));  value -= floor(genome.phenotype(3));  value -= floor(genome.phenotype(4));  return(value);}// DeJong's fourth function is:////             30//            ___// f4(xi) =   \   { i * xi^4 + Gauss(0,1) }//            /__//            i=1//// where each x is in the range [-1.28,1.28]floatDeJong4(GAGenome & c){  GABin2DecGenome & genome = (GABin2DecGenome &)c;  float value = 0;  for(int i=0; i<30; i++){    float v = genome.phenotype(i);    v *= v;			// xi^2    v *= v;			// xi^4    v *= i;    v += Gauss(0,1);    value += v;  }  return(value);}// DeJong's fifth function is (Shekel's foxholes)://////               25                 1//               ___    ---------------------------// f5(x1,x2) =   \              2//               /__           ___ //               j=1      j +  \   (x[i] - a[i][j])^6//                             /__//                             i=1//// where each x is in the range [-65.536,65.536]//static int a[2][25] ={  {-32, -16, 0, 16, 32, -32, -16, 0, 16, 32, -32, -16, 0, 16, 32,   -32, -16, 0, 16, 32, -32, -16, 0, 16, 32        },  {-32, -32, -32, -32, -32, -16, -16, -16, -16, -16,   16, 16, 16, 16, 16, 32, 32, 32, 32, 32  }};floatDeJong5(GAGenome & c){  GABin2DecGenome & genome = (GABin2DecGenome &)c;  float lowtot,prod,total=0.002;  for(int j=0; j<25; j+=1) {    lowtot=1.0 + (double)j;    for(int i=0; i<2; i+=1) {      prod=1.0;      for(int power=0; power<6; power+=1)        prod*=genome.phenotype(i)-a[i][j];      lowtot+=prod;    }    total+=1.0/lowtot;  }  return(500.0 - (1.0/total));}// Return a number from gaussian distribution.  This code was pinched from the// GNU libg++ Normal.cc implementation of a normal distribution.  That is, in// turn, based on Simulation, Modelling & Analysis by Law & Kelton, pp259.//// My random number generator (actually just the system's) isn't as good as // that in the libg++, but this should be OK for this purpose.doubleGauss(double mean, double variance){  for(;;) {    double u1 = GARandomDouble();    double u2 = GARandomDouble();    double v1 = 2 * u1 - 1;    double v2 = 2 * u2 - 1;    double w = (v1 * v1) + (v2 * v2);    if (w <= 1) {      double y = sqrt( (-2 * log(w)) / w);      double x1 = v1 * y;//      double x2 = v2 * y;       // we don't use this one      return(x1 * sqrt(variance) + mean);    }  }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一二三在线| 成人av小说网| 精品久久人人做人人爱| 日韩vs国产vs欧美| 欧美一区二区久久久| 经典一区二区三区| 久久免费午夜影院| jlzzjlzz亚洲女人18| 一区二区三区欧美激情| 6080亚洲精品一区二区| 久久 天天综合| 国产精品视频在线看| 色88888久久久久久影院野外 | 欧美专区亚洲专区| 午夜久久久影院| 精品国产一区二区三区久久影院| 国产麻豆精品一区二区| 中文字幕一区二区三区视频| 欧美性xxxxxxxx| 国产一区二区三区电影在线观看| 亚洲欧洲成人av每日更新| 91国偷自产一区二区开放时间| 石原莉奈一区二区三区在线观看| 精品久久久久香蕉网| 91欧美一区二区| 麻豆精品国产传媒mv男同| 国产精品免费视频一区| 欧美日韩性生活| 国产精品123区| 图片区小说区国产精品视频| 久久精品综合网| 欧美午夜不卡在线观看免费| 国产高清不卡一区| 亚洲国产一区二区三区| 久久久精品黄色| 欧美高清视频在线高清观看mv色露露十八| 麻豆成人免费电影| 亚洲男人的天堂av| 日韩欧美成人激情| 一本色道久久加勒比精品| 久久91精品久久久久久秒播| 一区二区三区国产精品| 亚洲国产精品av| 欧美一区二区三区不卡| 一本大道久久a久久精二百| 精品写真视频在线观看| 亚洲电影视频在线| 国产欧美一区二区三区沐欲| 欧美一区二区啪啪| 精品污污网站免费看| av网站免费线看精品| 久久成人久久鬼色| 亚洲成人激情自拍| 亚洲欧美日韩国产一区二区三区 | 国产欧美日韩不卡免费| 制服.丝袜.亚洲.中文.综合| 91麻豆swag| 成人免费av资源| 国产精品小仙女| 黄一区二区三区| 青青草97国产精品免费观看 | 久久久99久久精品欧美| 67194成人在线观看| 欧美在线观看视频一区二区 | 欧美影视一区二区三区| 成人免费高清视频| 国产成人精品免费一区二区| 久久电影国产免费久久电影| 美女久久久精品| 美国毛片一区二区三区| 美女视频黄频大全不卡视频在线播放| 香蕉久久一区二区不卡无毒影院| 亚洲精品免费视频| 亚洲欧美日韩国产一区二区三区| 国产精品电影一区二区| 国产精品美女www爽爽爽| 久久久国产精华| 国产午夜精品一区二区三区四区| 久久婷婷一区二区三区| 国产性做久久久久久| 久久久久久久久蜜桃| 国产日本欧洲亚洲| 国产欧美一区二区精品秋霞影院| 国产日韩在线不卡| 17c精品麻豆一区二区免费| 中文字幕一区二区三区视频| 日韩一区中文字幕| 亚洲综合在线五月| 亚洲成年人网站在线观看| 日韩中文字幕av电影| 青青青伊人色综合久久| 狠狠狠色丁香婷婷综合激情| 大陆成人av片| 色悠悠久久综合| 在线播放中文一区| 精品成人一区二区三区| 国产欧美日韩视频一区二区| 亚洲欧美激情插| 五月婷婷另类国产| 精品亚洲porn| 91在线视频网址| 51久久夜色精品国产麻豆| 久久先锋影音av| 亚洲欧洲精品一区二区三区 | 在线精品视频一区二区| 欧美日韩精品一区二区三区蜜桃| 日韩精品综合一本久道在线视频| 国产欧美精品区一区二区三区| 综合久久久久综合| 日本不卡在线视频| 国产福利一区二区| 在线视频亚洲一区| 精品国产亚洲在线| 中文字幕一区二区三| 三级不卡在线观看| 大尺度一区二区| 欧美人与z0zoxxxx视频| 中文字幕精品一区二区精品绿巨人| 亚洲一区中文在线| 国产在线看一区| 在线观看成人小视频| 久久久蜜桃精品| 亚洲精品国产一区二区精华液 | 欧美无砖砖区免费| 久久久精品免费网站| 亚洲福利一二三区| 丁香六月综合激情| 日韩午夜激情免费电影| 亚洲欧洲综合另类| 韩国女主播成人在线| 欧美日韩国产小视频在线观看| 欧美激情综合五月色丁香 | 久久电影网站中文字幕| 日本久久一区二区三区| 久久久久久久久岛国免费| 日韩中文字幕亚洲一区二区va在线| 成人av小说网| 久久综合九色综合欧美就去吻| 亚洲国产视频直播| 91在线一区二区| 国产日韩欧美亚洲| 久久福利资源站| 欧美肥妇free| 亚洲一区二区三区在线播放| 成a人片国产精品| 久久久久一区二区三区四区| 日韩不卡手机在线v区| 色婷婷综合久久久久中文| 中文一区二区在线观看| 国产乱色国产精品免费视频| 91精品欧美综合在线观看最新| 夜夜亚洲天天久久| 不卡区在线中文字幕| 久久精品视频免费观看| 久久99精品视频| 精品少妇一区二区三区日产乱码 | 欧美日韩高清在线播放| 亚洲欧美另类小说| 99re6这里只有精品视频在线观看| 久久精品视频一区二区三区| 国产麻豆精品在线| 久久久久久综合| 国产一区二区伦理片| 欧美成人激情免费网| 麻豆精品一区二区av白丝在线| 欧美日本一道本在线视频| 亚洲高清不卡在线| 精品视频在线免费看| 视频在线观看国产精品| 欧美一区二视频| 日本成人中文字幕| 精品国产电影一区二区| 国产美女主播视频一区| 久久久久亚洲综合| 高潮精品一区videoshd| 国产精品国产馆在线真实露脸| av不卡一区二区三区| 亚洲美女淫视频| 欧美日韩一级黄| 免费成人美女在线观看.| 欧美成人a∨高清免费观看| 激情都市一区二区| 国产精品美女久久久久久久久久久| 99re免费视频精品全部| 亚洲福利视频一区| 日韩一级视频免费观看在线| 国产一区二区精品久久99| 中文字幕欧美三区| 在线观看日产精品| 日韩av高清在线观看| 2023国产一二三区日本精品2022| 国产精品77777竹菊影视小说| 国产精品网站一区| 欧美日韩中文精品| 九一九一国产精品| 亚洲视频 欧洲视频| 3d动漫精品啪啪一区二区竹菊| 精品在线免费视频| 自拍偷在线精品自拍偷无码专区| 欧美日韩在线直播|