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

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

?? paes.c

?? 多目標優化算法PAES的c語言源代碼,q希望對你有用.
?? C
?? 第 1 頁 / 共 2 頁
字號:
// (1+1)-PAES skeleton program code /*    Copyright (C) 2000, Joshua Knowles and David Corne   This program is free software; you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation; either version 2 of the License, or   (at your option) any later version.    This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.    The GNU General Public License is available at:      http://www.gnu.org/copyleft/gpl.html   or by writing to:         The Free Software Foundation, Inc.,         675 Mass Ave, Cambridge, MA 02139, USA.  *///// PAES is described in several refereed publications. All of them are available // for download from Joshua Knowles' website at The University of Reading:// http://www.reading.ac.uk/~ssr97jdk//// Please contact the authors if you have any comments, suggestions or questions// about this file or the Pareto Archived Evolution Strategy (PAES).// We are at:// j.d.knowles@reading.ac.uk  and  d.w.corne@reading.ac.uk ///********************************************************************************************************* * To compile : gcc paes.cc -o paes -lm                                                                  * * To run :                                                                                              *  *  ./paes [problem] [depth] [objectives] [genes] [alleles] [archive] [iterations] [minmax] [pm] [seed]  * *                                                                                                       * * where all parameters MUST be specified correctly (none are optional) following the instructions below:* *                                                                                                       * * [problem] - at present there are 3 problems included with this code. They are max, T1, and F5. See    * *             below for further details on each of these problems.                                      * * [depth] - this is the number of recursive subdivisions of the objective space carried out in order to * *           divide the objective space into a grid for the purposes of diversity maintenance. Values of * *           between 3 and 6 are useful, depending on number of objectives. //目標空間劃分...            *  * [objectives] - the number of objectives to the problem.                                               * * [genes] - the number of genes in the chromosome. (Only integer genes can be accepted).                * * [alleles] - the number of values that each gene can take. //等位基因                                  * * [archive] - the maximum number of solutions to be held in the nondominated solutions archive.         * * [iterations] - the program terminates after this number of iterations.  //循環次數                    * * [minmax] - set this to 0 (zero) for minimization problems, 1 for maximization problems.  //最小、最大 * * [pm] - the per gene mutation probability. Mutations always change the current allele. Any other       * *        viable allele is chosen, with uniform probability.   // 變異概率                               * * [seed] - any integer value, to be used as the program's random seed.                                  * *                                                                                                       * * Example command lines:                                                                                * * ./paes max 4 3 20 4 50 10000 1 0.05 3434324   - a valid command line for the max problem              * * ./paes T1 5 2 900 2 100 20000 0 0.002 6764421 - a valid command line for the T1 problem               * * ./paes F5 4 2 16 16 25 50000 0 0.06 764542    - a valid command line for the F5 problem               * *                                                                                                       * * The objective function for 3 multiobjective test functions is included in the code.                   * *                                                                                                       * * The first test function, "max", is a k-objective problem taking a chromosome of k+1 alleles per gene. * * It returns, for each objective, the fraction of the chromosome consisting of allele values            * * corresponding to the particular objective. i.e. objective 1 counts the number of 1's in the chromosome* * and returns this normalized wrt to the length of the chromosome. Similarly for objectives 2, 3, ...   * * Zeros in the chromosome do not contribute to any of the objectives. When using the max problem the    * * number of alleles must be set to the number of objectives + 1. The problem is a maximization problem  * * hence the parameter minmax must be set to 1.                                                          * *                                                                                                       * * The second objective function, "T1", has been taken from Eckart Zitzler's PhD thesis,                 * * Diss. ETH No. 13398 currently available from http://www.tik.ee.ethz.ch/~zitzler/                      * * The function is a simple 2-objective minimization                                                     *  * problem. The Pareto optimal front is given by 1-sqrt(x) with 1<=x<=0. The code has been written so    * * that a chromosome of 900 binary genes is expected, encoding for 30 real numbers between zero and 1.   * *                                                                                                       * * The third objective function, "F5", was described in "Joshua Knowles and David Corne, The Pareto      * * Archived Evolution Strategy: A New Baseline Algortihm for Multiobjective Optimisation, in Proceedings * * of the 1999 Congress on Evolutionary Computation (CEC99), pages 98-105, IEEE Service Centre".         * * It is a 2-objective problem which accepts a chromosome of k-genes each having k alleles. Briefly the  * * function counts the number of adjacent genes having consecutive alleles, reading the chromosome       * * forwards (objective 1) and backwards (objective 2). There are k distinct optima in objective space    * * but the disribution of these optima in parameter space is highly nonuniform i.e. there are many ways  * * of obtaining some of the optima (they are easy to find) and very few ways of finding others.          * * The problem is cast as a minimization problem. For a chromosome of 16 genes with 16 alleles the       * * problem is already very difficult.                                                                    * *                                                                                                       * * In the code presented here, maintenance of diversity is carried out in the objective space. i.e.      * * solutions which are genetically different but which give rise to the same objective values are not    * * allowed to co-exist in the archive. The grid used for maintaining diversity also takes into account   * * objective values only. Parameter-space, and genotypic measures of diversity may also be used with     * * PAES but they have not been included in this skeleton code.                                           *               *                                                                                                       * ********************************************************************************************************/ # include <stdlib.h># include <stdio.h># include <math.h># include <string.h># define MAX_GENES 1000  // change as necessary# define MAX_OBJ 10     // change as necessary # define MAX_POP 10     // change as necessary# define MAX_ARC 200    // change as necessary# define MAX_LOC 32768  // number of locations in grid (set for a three-objective problem using depth 5)# define LARGE 2000000000 // should be about the maximum size of an integer for your compiler FILE *fp;typedef struct solution{  int chrom[MAX_GENES];  double obj[MAX_OBJ];  int grid_loc;       //}sol;sol *c; // current solutionsol *m; // mutant solutionsol *arc; // archive of solutionsint compare_min(double *first, double *second, int n);int compare_max(double *first, double *second, int n);int equal(double *first, double *second, int n);void init();void print_genome(sol *s);void print_eval(sol *s);void evaluate(sol *s, char *problem);void max(sol *s);void T1(sol *s);void F5(sol *s);void add_to_archive(sol *s);void mutate(sol *s);int compare_to_archive(sol *s);void update_grid(sol *s);void archive_soln(sol *s);int find_loc(double *eval);double pm;  // mutation rate as a decimal probability per bit (zero probability of generating current allele, uniform probability of generating all other allele values. i.e. for binary chromosomes this is the "flip" mutation rate.) int seed, depth, genes, alleles, archive, objectives, iterations, minmax; // command line parameters int arclength=0; // current length of the archivedouble gl_offset[MAX_OBJ];   // the range, offset etc of the grid double gl_range[MAX_OBJ];double gl_largest[MAX_OBJ];int grid_pop[MAX_LOC];   // the array holding the population residing in each grid locationchar problem[50];int main(int argc, char *argv[]){  int i, j;  int result;  if (argc!=11)    {      printf("See paes.cc for command line parameters. Exiting.\n");      exit(-1);    }  //get command line parameters  sprintf(problem, "%s", argv[1]);  depth = atoi(argv[2]);  objectives = atoi(argv[3]);  genes = atoi(argv[4]);  alleles = atoi(argv[5]);  archive = atoi(argv[6]);  iterations = atoi(argv[7]);  minmax = atoi(argv[8]);  pm = atof(argv[9]);  seed = atoi(argv[10]);  srand(seed); // seed system random number generator  // begin (1+1)-PAES    init();  //  print_genome(c);    // Uncomment to check genome is correct   evaluate(c, problem);  //  print_eval(c);      // Uncomment to check objective values generated  //  getchar();    add_to_archive(c);    // begin main loop  for (i = 0; i < iterations; i++)    {      if (i%100==0)            // just print out the number of iterations done every 100
		  printf("%d\n", i);      *m = *c;   // copy the current solution       mutate(m);  // and mutate using the per-bit mutation rate specified by the command param pm      //   print_genome(m);      evaluate(m, problem);       //print_eval(m);      // print_genome(m);      //  printf("Comparing ");      //print_eval(c);       // printf("and ");      //print_eval(m);            //MINIMIZE MAXIMIZE      if (minmax==0)
		  result = compare_min(c->obj, m->obj, objectives);      else		  result = compare_max(c->obj, m->obj, objectives);      // printf("RESULT = %d\n", result);      // printf("arclength = %d\n", arclength);            if (result != 1)  // if mutant is not dominated by current (else discard it)	  {		  if (result ==-1)  // if mutant dominates current		  {			  //printf("m dominates c\n");			  update_grid(m);           //calculate grid location of mutant solution and renormalize archive if necessary			  archive_soln(m);          //update the archive by removing all dominated individuals			  *c = *m;                    // replace c with m		  }		  else if(result == 0)  // if mutant and current are nondominated wrt each other		  {			  result = compare_to_archive(m);			  if (result != -1)  // if mutant is not dominated by archive (else discard it)			  {				  update_grid(m);				  archive_soln(m);				  if((grid_pop[m->grid_loc] <= grid_pop[c->grid_loc])||(result==1)) // if mutant dominates the archive or 				  {                                                               // is in less crowded grid loc than c  					  *c = *m; // then replace c with m				  }			  }		  }      	  }       
	  /*  printf("\nArchive = \n");      for (j = 0; j < arclength; j++)      print_eval(&arc[j]);	  getchar();*/  }  printf("\nThe Archive is now... \n");  for (i = 0; i < arclength; i++)	  print_eval(&arc[i]); 
  /*  printf("\nThe genetic material in the archive is now... \n");   for (i = 0; i < arclength; i++)	 print_genome(&arc[i]);    */}int compare_to_archive(sol *s)  // compares a solution to every member of the archive. Returns -1 if 
                                //dominated by any member, 1 if dominates any member, and 0 otherwise{                            int i=0;                      //只要找到支配或被支配的就跳出  int result=0;  while((i<arclength)&&(result!=1)&&(result!=-1))  {	  //MINIMIZE MAXIMIZE      if (minmax==0)		  result = compare_min(m->obj, (&arc[i])->obj, objectives);      else		  result = compare_max(m->obj, (&arc[i])->obj, objectives);      i++;  }  return(result);}      void init()  {  int i;  int val;  // allocate memory for solutions  c = (sol *)malloc(MAX_POP*sizeof(sol));  m = (sol *)malloc(MAX_POP*sizeof(sol));  arc = (sol *)malloc(MAX_ARC*sizeof(sol));  if((!c)||(!m)||(!arc))  {      printf("Out of memory. Aborting.\n");      exit(-1);  }  // initialize c with a uniform distribution of values from 0 to alleles-1  for (i = 0; i < genes; i++)  {      val = (int)(alleles*(rand()/(RAND_MAX+1.0)));         c->chrom[i] = val;  }}void add_to_archive(sol *s){  arc[arclength] = *s;  arclength++;}void mutate(sol *s)  // apply mutation to chromosome s using per-gene mutation probability pm.  {  int i;  int var;  for (i = 0; i < genes; i++)   //對每一基因都變異  {      if ((rand()/(RAND_MAX+1.0))<pm)	  {		  var = 1+(int)((alleles-1)*(rand()/(RAND_MAX+1.0)));  // generate var between 1 and alleles-2 ...		  s->chrom[i]=(s->chrom[i]+var)%alleles;  // add var to allele value of current gene and mod.  	  }  }}void print_genome(sol *s){  int i;  for (i = 0; i < genes; i++)	  printf("%d ", s->chrom[i]);  printf("\n");    }void print_eval(sol *s){  int i;  for (i = 0; i < objectives; i++)	  printf("%lf ", s->obj[i]);  printf("\n");}void evaluate(sol *s, char *problem){  if (!strcmp(problem, "T1"))    {       T1(s);    // this is a function described in                 // Diss. ETH No. 13398 (Eckart Zitzler's PhD Thesis)                 // available from http://www.tik.ee.ethz.ch/~zitzler/    }  else if (!strcmp(problem, "max"))    {      max(s);    }  else if (!strcmp(problem, "F5"))    {      F5(s);    }  // else if (!strcmp(problem, "*&^%*%"))  // call your other evaluation functions from here  else    {      printf("Invalid argument for test problem given. Exiting.\n");      exit(-1);    }}void max(sol *s){  int i, j;  double sc[MAX_OBJ+1];  if (alleles != objectives+1)    {      printf("You've given invalid command line parameters for function max. Check paes.c for details. Exiting.\n");      exit(-1);    }  
  for (i = 0; i < objectives; i++)
    sc[i]=0;

  for (i = 0; i < genes; i++)    //目標1放1出現的次數...依次類推
    sc[s->chrom[i]]++; 
    for (i = 1; i <= objectives; i++)    {      sc[i] /= (double)genes;    //除于基因總數 比例      s->obj[i-1] = sc[i];    }}void T1(sol *s){  // test function T1 described in Eckart Zitzler's PhD thesis. See notes at top for further details   int i, j;  int mul;  double var[30];  double sum = 0;  double f1, f2, g, h;    if ((genes!=900)||(alleles!=2)||(objectives!=2))        {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产婷婷色一区二区三区四区 | 国产在线精品一区二区不卡了| 91视频国产观看| 国产精品久久久久一区二区三区共| 奇米色一区二区三区四区| 欧美日韩高清不卡| 亚洲国产乱码最新视频| 成人性生交大片免费| 国产亚洲人成网站| 狠狠狠色丁香婷婷综合激情| 精品久久一区二区三区| 久久国产精品无码网站| 欧美色倩网站大全免费| 日韩一区在线看| 国产成人欧美日韩在线电影| 国产亚洲精品资源在线26u| 国产精品一区二区三区四区| 久久久久久久久伊人| 丁香五精品蜜臀久久久久99网站 | 成人aaaa免费全部观看| 国产欧美一区二区在线观看| 日本韩国一区二区| 亚洲三级久久久| 欧美性三三影院| 日韩av高清在线观看| 精品国内二区三区| 国产一区二区三区在线观看免费视频 | 欧美日韩一二三区| 美国三级日本三级久久99| 欧美变态凌虐bdsm| 不卡av在线网| 香蕉影视欧美成人| 精品女同一区二区| 成人一区二区三区中文字幕| 国产农村妇女精品| 在线观看视频一区二区欧美日韩| 天天色天天操综合| 精品国精品国产| 成人avav在线| 男人的天堂久久精品| 国产亚洲成年网址在线观看| 在线亚洲精品福利网址导航| 九九国产精品视频| 亚洲美女免费在线| 精品国产区一区| 99久久综合精品| 热久久一区二区| 中文字幕一区二区三区四区不卡 | 国产一区二区福利| 亚洲乱码国产乱码精品精98午夜| 91精品在线免费观看| 国产成+人+日韩+欧美+亚洲| 亚洲成人综合网站| 日韩一二三区不卡| 日本精品一级二级| 国产成人精品一区二| 亚洲风情在线资源站| 国产精品丝袜91| 欧美高清性hdvideosex| 国精品**一区二区三区在线蜜桃| 亚洲一区二区三区精品在线| 欧美经典一区二区| 4438成人网| 91成人免费在线视频| 国产馆精品极品| 亚洲一区二区3| 一区在线观看视频| 久久久精品免费观看| 91精品国产全国免费观看| 91女神在线视频| 国产成人在线免费观看| 另类中文字幕网| 亚洲一区中文在线| 1000部国产精品成人观看| 久久亚洲一区二区三区明星换脸 | 日韩久久一区二区| 精品国产乱码久久久久久久久| 欧美日韩小视频| 色综合久久中文综合久久牛| 国产高清精品在线| 精品一区精品二区高清| 国产最新精品精品你懂的| 亚洲欧洲精品一区二区三区不卡| 日韩精品一区在线| 欧美一区二区视频在线观看| 欧美日韩国产综合久久| 成人av网站在线观看| 懂色av一区二区在线播放| 国产成a人亚洲精品| 国产麻豆精品95视频| 韩国av一区二区三区在线观看| 日本aⅴ精品一区二区三区| 天堂成人国产精品一区| 亚洲午夜一区二区三区| 亚洲曰韩产成在线| 亚洲综合视频在线观看| 国产精品国模大尺度视频| 国产亚洲制服色| 欧美激情在线观看视频免费| 欧美激情中文不卡| 国产精品丝袜在线| 久久综合久久久久88| 久久网这里都是精品| 国产性色一区二区| 国产精品久久毛片| 亚洲精品日韩专区silk| 这里只有精品99re| 色婷婷一区二区三区四区| 欧美精品日韩一本| 久久久久99精品一区| 亚洲欧美一区二区三区久本道91| 亚洲国产精品久久不卡毛片| 精品在线一区二区三区| 波波电影院一区二区三区| 欧美三级电影精品| 久久久久久久综合狠狠综合| 亚洲精品高清视频在线观看| 久久成人精品无人区| 成人av午夜影院| 欧美一区二区三区免费视频| 中文字幕制服丝袜一区二区三区| 亚洲mv大片欧洲mv大片精品| 国产69精品久久久久777| 欧美日韩中文另类| 欧美激情在线看| 五月婷婷色综合| 99精品国产一区二区三区不卡| 欧美精品亚洲二区| 国产精品久久久久久久久免费樱桃| 日韩精品亚洲一区二区三区免费| 成人影视亚洲图片在线| 日韩精品中文字幕在线一区| 一区二区三区国产精品| 国产精品亚洲成人| 日韩一级高清毛片| 亚洲一区二区在线观看视频| 成人黄页毛片网站| 日韩欧美一区二区在线视频| 亚洲自拍偷拍九九九| 国产麻豆成人传媒免费观看| 91精品国产乱| 亚洲国产综合视频在线观看| 成人动漫在线一区| 久久亚洲免费视频| 久国产精品韩国三级视频| 欧美三级电影精品| 亚洲精品美腿丝袜| 成人免费视频免费观看| 久久欧美一区二区| 免费一级欧美片在线观看| 欧美无乱码久久久免费午夜一区| 1000部国产精品成人观看| 成人午夜视频在线观看| 久久婷婷国产综合精品青草| 蜜臀精品久久久久久蜜臀| 欧美二区在线观看| 亚洲福利一二三区| 欧美伊人精品成人久久综合97| 亚洲三级免费电影| 色婷婷综合在线| 亚洲精品乱码久久久久久久久 | 国产欧美日韩精品在线| 国产乱码一区二区三区| 欧美精品一区视频| 韩国成人精品a∨在线观看| 日韩一区二区高清| 另类成人小视频在线| 日韩美女视频一区二区在线观看| 日韩专区一卡二卡| 日韩一级片在线播放| 美脚の诱脚舐め脚责91| 欧美一级精品大片| 黄色资源网久久资源365| 久久在线观看免费| 岛国一区二区三区| 亚洲丝袜自拍清纯另类| 在线视频一区二区免费| 亚洲福利视频一区| 日韩三级在线免费观看| 久久9热精品视频| 国产三级精品在线| 99re8在线精品视频免费播放| 亚洲欧美乱综合| 欧美日韩不卡一区二区| 日韩精品一二三四| 久久精品一区二区三区不卡牛牛| 成人白浆超碰人人人人| 自拍偷拍亚洲激情| 欧美视频你懂的| 麻豆国产精品一区二区三区| 久久尤物电影视频在线观看| 成人久久久精品乱码一区二区三区 | 久久久电影一区二区三区| 成人免费视频一区| 亚洲最新在线观看| 欧美一级高清片| 成+人+亚洲+综合天堂| 亚洲国产人成综合网站| 久久综合九色综合97婷婷女人| 成人爽a毛片一区二区免费|