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

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

?? populations.c

?? 一個完整的C語言遺傳程序包
?? C
字號:
/*SGPC: Simple Genetic Programming in C(c) 1993 by Walter Alden Tackett and Aviram Carmi  This code and documentation is copyrighted and is not in the public domain. All rights reserved.   - This notice may not be removed or altered.  - You may not try to make money by distributing the package or by using the   process that the code creates.  - You may not distribute modified versions without clearly documenting your   changes and notifying the principal author.  - The origin of this software must not be misrepresented, either by   explicit claim or by omission.  Since few users ever read sources,   credits must appear in the documentation.  - Altered versions must be plainly marked as such, and must not be   misrepresented as being the original software.  Since few users ever read   sources, credits must appear in the documentation.  - The authors are not responsible for the consequences of use of this    software, no matter how awful, even if they arise from flaws in it. If you make changes to the code, or have suggestions for changes,let us know!  (gpc@ipld01.hac.com)*/#ifndef lintstatic char populations_c_rcsid[]="$Id: populations.c,v 2.8 1993/04/22 07:39:12 gpc-avc Exp gpc-avc $";#endif/* * * $Log: populations.c,v $ * Revision 2.8  1993/04/22  07:39:12  gpc-avc * Removed old log messages * * Revision 2.7  1993/04/14  04:59:00  gpc-avc * Fixed bug of not initializing fraction inside the for loop * * */#include <stdio.h>#include <malloc.h>#include <errno.h>#include <values.h>#include "gpc.h"#ifdef ANSI_FUNCVOID allocate_populations(  int		numpops,  pop_struct	*pop  )#elseVOID allocate_populations(numpops,pop)  int 		numpops;  pop_struct	*pop;#endif{  int	p;  for (p=0; p<numpops; p++) {    pop[p].standardized_fitness =      (float *) malloc(pop[p].population_size*sizeof(float));    pop[p].adjusted_fitness = (float *) malloc(pop[p].population_size*sizeof(float));    pop[p].normalized_fitness =      (float *) malloc(pop[p].population_size*sizeof(float));    pop[p].fitness_sort_index = (int *) malloc(pop[p].population_size*sizeof(int));    pop[p].tournament_index = (int *) malloc(pop[p].tournament_K*sizeof(int));    pop[p].population = (tree **) malloc(pop[p].population_size*sizeof(tree *));    pop[p].new_population = (tree **) malloc(pop[p].population_size*sizeof(tree *));    pop[p].best_of_generation = (tree *) NULL;     pop[p].best_of_run = (tree *) NULL;    pop[p].best_of_gen_fitness = (MAXFLOAT);    pop[p].best_of_run_fitness = (MAXFLOAT);  }}#ifdef ANSI_FUNCVOID setup_deme_grid(  int 		numpops,  int		demerows,  int		demecols,	         pop_struct 	*pop,  pop_struct    ***grid  )#elseVOID setup_deme_grid(numpops,demerows,demecols,pop,grid)  int 		numpops;  int		demerows;  int		demecols;  pop_struct 	*pop;  pop_struct    ***grid;#endif{  int	r, c;  int	i, p, nperdeme;  for (p=0;p<numpops;p++) {    nperdeme = (pop[p].population_size/(demerows*demecols));    for (r=0,i=0; r<demerows;r++) {      for (c=0;c<demecols;c++,i+=nperdeme) {	grid[r][c][p].my_row = r;	grid[r][c][p].my_col = c;	grid[r][c][p].population_size = nperdeme;	grid[r][c][p].steady_state = pop[p].steady_state;	grid[r][c][p].load_from_file = pop[p].load_from_file;	grid[r][c][p].max_depth_for_new_trees =	  pop[p].max_depth_for_new_trees;	grid[r][c][p].max_depth_after_crossover =	  pop[p].max_depth_after_crossover;	grid[r][c][p].max_mutant_depth = pop[p].max_mutant_depth;	grid[r][c][p].grow_method = pop[p].grow_method;	grid[r][c][p].selection_method = pop[p].selection_method;	grid[r][c][p].tournament_K = pop[p].tournament_K;	grid[r][c][p].deme_search_radius_sigma =	  pop[p].deme_search_radius_sigma;	grid[r][c][p].tournament_index =	  (int *) malloc(pop[p].tournament_K*sizeof(int));	grid[r][c][p].crossover_func_pt_fraction =	  pop[p].crossover_func_pt_fraction;	grid[r][c][p].crossover_any_pt_fraction =	  pop[p].crossover_any_pt_fraction;	grid[r][c][p].fitness_prop_repro_fraction =	  pop[p].fitness_prop_repro_fraction;	grid[r][c][p].parsimony_factor = pop[p].parsimony_factor;	grid[r][c][p].standardized_fitness =	  &(pop[p].standardized_fitness[i]);	grid[r][c][p].adjusted_fitness =	  &(pop[p].adjusted_fitness[i]);	grid[r][c][p].normalized_fitness =	  &(pop[p].normalized_fitness[i]);	grid[r][c][p].fitness_sort_index =	  &(pop[p].fitness_sort_index[i]);	grid[r][c][p].population = &(pop[p].population[i]);	grid[r][c][p].new_population =	  &(pop[p].new_population[i]);	grid[r][c][p].best_of_generation = (tree *) NULL;	grid[r][c][p].best_of_run = (tree *) NULL;	grid[r][c][p].best_of_run_gen = -1;	grid[r][c][p].best_of_gen_fitness = -1.0;	grid[r][c][p].best_of_run_fitness = -1.0;	grid[r][c][p].function_table = pop[p].function_table; 	grid[r][c][p].terminal_table = pop[p].terminal_table;	grid[r][c][p].function_table_size = pop[p].function_table_size;	grid[r][c][p].terminal_table_size = pop[p].terminal_table_size;      }    }  }}#ifdef ANSI_FUNCVOID initialize_populations(  int		numpops,  pop_struct	*pop  )#elseVOID initialize_populations(numpops,pop)  int		numpops;  pop_struct	*pop;#endif{  int	p;  int	i;  int	min_depth_for_new_trees = 1;  int 	full_cycle;  int 	grow;  int	size;  FILE	*f;  tree	*temp;  for (p=0; p<numpops; p++) {    full_cycle = 0;    for (i=0; i<pop[p].population_size; i++) {      switch (pop[p].grow_method) {      case FULL:	size = pop[p].max_depth_for_new_trees;	grow = 1;	break;      case GROW:	size = pop[p].max_depth_for_new_trees;	grow = 0;	break;      case RAMPED:	size = (min_depth_for_new_trees +		(i % (pop[p].max_depth_for_new_trees-min_depth_for_new_trees)));	if (pop[p].max_depth_for_new_trees != min_depth_for_new_trees)	  if (!(i % (pop[p].max_depth_for_new_trees-min_depth_for_new_trees)))	    full_cycle = (!full_cycle);	grow = (full_cycle);	break;      default:	fprintf(stderr,"Error in initialize_populations(): Method %d must be %d %d or %d\n",		pop[p].grow_method, FULL, GROW, RAMPED);      }      pop[p].population[i] = create_random_tree(pop, p, size, 1, grow);    }    /* replace the first members of population with those to be read       from a file, if filename is not null */    if (pop[p].load_from_file[0] != '\0') {      f = fopen(pop[p].load_from_file,"r");      for (i=0; (((int)(temp=read_tree(pop,p,f))) != EOF) &&	   (i<pop[p].population_size); i++) {	free_tree(pop[p].population[i]);	pop[p].population[i] = temp;      }    }  }}#ifdef ANSI_FUNCVOID breed_new_population(  pop_struct	*pop,  int 		p,  int 		demes,  int 		nrows,  int 		ncols,  int		steady_state			    )#elseVOID breed_new_population(pop,p,demes,nrows,ncols,steady_state)  pop_struct *pop;  int		p;  int 		demes;  int 		nrows;  int 		ncols;  int		steady_state;#endif{  int	i, j, incr;  float fraction = 0.0;  tree	*parent1, *parent2, *offspring1, *offspring2, *pptr;  int	worst_index1, worst_index2, best_index1, best_index2;#if DBSS == 1    if (demes) {      printf(" Steady state breeding in deme (%d,%d) \n",	     pop[p].my_row, pop[p].my_col);    }#endif  if (steady_state && ((pop[p].selection_method == OVERSELECT) ||		      (pop[p].selection_method == FITNESSPROP))) {    printf("SORRY: steady_state population requires either DEMES or \n \            selection_method = TOURNAMENT");    exit (1);  }  for (i = 0, fraction = random_float(1.0);        i < pop[p].population_size;       i += incr, fraction = random_float(1.0)) {    parent1 = find_tree(pop,p,demes,nrows,ncols,&worst_index1,&best_index1);    while (steady_state && (POP[p].population[worst_index1] == parent1))      parent1 = find_tree(pop,p,demes,nrows,ncols,&worst_index1,&best_index1);#if DBSS == 1    printf("Parent 1: selected POP[%d] to breed. Fitness = %f\n \            \tselected POP[%d] to replace. Fitness = %f\n",	   best_index1, POP[p].standardized_fitness[best_index1],	   worst_index1, POP[p].standardized_fitness[worst_index1]);#endif    if ((i < (pop[p].population_size-1)) &&	(fraction <	 (pop[p].crossover_func_pt_fraction+pop[p].crossover_any_pt_fraction))) {      parent2 = find_tree(pop,p,demes,nrows,ncols,&worst_index2,&best_index2);      while (steady_state && ((worst_index1 == worst_index2) ||			      (POP[p].population[worst_index2] == parent2) ||			      (POP[p].population[worst_index2] == parent1) ||			      (POP[p].population[worst_index1] == parent2)))	parent2 = find_tree(pop,p,demes,nrows,ncols,&worst_index2,&best_index2);#if DBSS == 1      printf("Parent 2: selected POP[%d] to breed. Fitness = %f\n \            \tselected POP[%d] to replace. Fitness = %f\n",	     best_index2, POP[p].standardized_fitness[best_index2],	     worst_index2, POP[p].standardized_fitness[worst_index2]);#endif      if (fraction < pop[p].crossover_func_pt_fraction) {	crossover_at_func_pt(pop, parent1, parent2, &offspring1, &offspring2);      } else {	crossover_at_any_pt(pop, parent1, parent2, &offspring1, &offspring2);      }      if (steady_state) {	free_tree(POP[p].population[worst_index1]);	free_tree(POP[p].population[worst_index2]);	POP[p].population[worst_index1] = offspring1;	POP[p].population[worst_index2] = offspring2;	POP[p].standardized_fitness[worst_index1] =	  evaluate_fitness_of_individual(POP,p,					 POP[p].population[worst_index1],					 worst_index1) +          ((float) count_crossover_pts(POP[p].population[worst_index1]))*	    pop[p].parsimony_factor;	POP[p].standardized_fitness[worst_index2] =	  evaluate_fitness_of_individual(POP,p,					 POP[p].population[worst_index2],					 worst_index2) +          ((float) count_crossover_pts(POP[p].population[worst_index2]))*	    pop[p].parsimony_factor;      } else {	pop[p].new_population[i] = offspring1;	pop[p].new_population[i+1] = offspring2;      }      incr = 2;    } else if (fraction <	 (pop[p].crossover_func_pt_fraction	  + pop[p].crossover_any_pt_fraction	  + pop[p].fitness_prop_repro_fraction)) {      if (steady_state) {#if DBSS == 1	printf("performing straight copy of parent 1\n");#endif	free_tree(POP[p].population[worst_index1]);	POP[p].population[worst_index1] = copy_tree(parent1);	/* kind of a waste - you should really set fitess-prop-repro-frac	   to zero for the steady-state elitist model... */	POP[p].standardized_fitness[worst_index1] =	  evaluate_fitness_of_individual(POP,p,					 POP[p].population[worst_index1],					 worst_index1) +            ((float) count_crossover_pts(POP[p].population[worst_index1]))*	      pop[p].parsimony_factor;      } else {	pop[p].new_population[i] = copy_tree(parent1);      }      incr = 1;    } else {      if (steady_state) {#if DBSS == 1	printf("performing mutation of parent 1\n");#endif	free_tree(POP[p].population[worst_index1]);	POP[p].population[worst_index1] = mutate(pop,copy_tree(parent1));	POP[p].standardized_fitness[worst_index1] =	  evaluate_fitness_of_individual(POP,p,					 POP[p].population[worst_index1],					 worst_index1) +            ((float) count_crossover_pts(POP[p].population[worst_index1]))*	      pop[p].parsimony_factor;      } else {	pop[p].new_population[i] = mutate(pop,copy_tree(parent1));      }      incr = 1;    }  }}     #ifdef ANSI_FUNCVOID free_population(  pop_struct	*pop,  int 	p  )#elseVOID free_population(pop,p)  pop_struct	*pop;  int		p;#endif{  int	i;  for (i=0; i<pop[p].population_size; i++) {    free_tree(pop[p].population[i]);  }}#ifdef ANSI_FUNCVOID load_new_population(  pop_struct	*pop,  int p  )#elseVOID load_new_population(pop,p)  pop_struct	*pop;  int		p;#endif{  int	i;  for (i=0; i<pop[p].population_size; i++) {    pop[p].population[i] = pop[p].new_population[i];  }}               

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99视频一区二区| 亚洲毛片av在线| 精品一区二区免费| 欧美一级一区二区| 免费欧美高清视频| 久久免费视频一区| 国产一区中文字幕| 国产精品免费丝袜| 99re成人在线| 三级亚洲高清视频| 日韩欧美电影在线| 国产成人免费高清| 亚洲精品自拍动漫在线| 欧美日韩一区二区三区视频| 美腿丝袜亚洲综合| 又紧又大又爽精品一区二区| 色综合色狠狠天天综合色| 亚洲午夜精品在线| 久久久久国产精品厨房| 99精品视频中文字幕| 亚洲成人免费影院| 国产日韩精品久久久| 欧美亚洲综合久久| 成人app在线观看| 国产三级一区二区| 欧美写真视频网站| 成人app网站| 麻豆精品新av中文字幕| 亚洲欧美视频在线观看| 精品第一国产综合精品aⅴ| 在线免费精品视频| 成人不卡免费av| 国产东北露脸精品视频| 亚洲成人av资源| 亚洲精品高清视频在线观看| 2014亚洲片线观看视频免费| 欧美高清视频在线高清观看mv色露露十八| 国内成人免费视频| 精品在线免费视频| 毛片一区二区三区| 首页国产欧美久久| 香蕉加勒比综合久久| 亚洲欧美另类图片小说| 日本一区二区动态图| 中文字幕久久午夜不卡| 久久久精品国产99久久精品芒果| 制服丝袜一区二区三区| 欧美精品久久久久久久久老牛影院| 99精品国产一区二区三区不卡| 成人精品免费视频| 国产成人8x视频一区二区| 国产精品一二三区| k8久久久一区二区三区| 99视频一区二区| 欧美人狂配大交3d怪物一区| 欧美另类变人与禽xxxxx| 日韩欧美中文字幕一区| 欧美一区二区视频网站| 欧美va亚洲va| 亚洲日本在线视频观看| 亚洲成人综合在线| 亚洲另类中文字| 亚洲男人电影天堂| 一区二区在线观看av| 免费在线欧美视频| 精品制服美女久久| 99久久精品费精品国产一区二区| 91美女片黄在线| 精品1区2区在线观看| 中文字幕在线观看一区| 亚洲精品国产精品乱码不99 | 成人av集中营| 欧美丝袜自拍制服另类| 欧美日韩三级在线| 亚洲v中文字幕| 成人免费av在线| 91搞黄在线观看| 日本一区二区动态图| 国产麻豆精品视频| 99精品视频在线免费观看| 欧美一级黄色录像| 亚洲欧美福利一区二区| 婷婷成人综合网| 顶级嫩模精品视频在线看| 7777精品伊人久久久大香线蕉最新版| 国产欧美日本一区视频| 日韩在线卡一卡二| 91福利在线免费观看| 久久精品欧美一区二区三区不卡| 亚洲一区二区综合| 成人免费电影视频| 国产欧美日韩精品一区| 狠狠色狠狠色综合系列| 欧美一级精品在线| 蜜臀av性久久久久蜜臀aⅴ流畅| www.欧美亚洲| 亚洲欧美综合另类在线卡通| 国产一区二区三区av电影 | 国产精品资源站在线| 日韩女优制服丝袜电影| 日韩专区中文字幕一区二区| 91久久精品一区二区| 亚洲精品成人悠悠色影视| 成人激情校园春色| 亚洲精品视频一区二区| 成人不卡免费av| 亚洲欧美一区二区视频| 欧美日韩综合在线免费观看| 亚洲成年人影院| 精品国产免费久久| 国产91清纯白嫩初高中在线观看| 中文字幕第一区第二区| 精品亚洲免费视频| 综合电影一区二区三区| 欧美午夜精品一区二区蜜桃| 日韩高清中文字幕一区| 精品国产乱码久久久久久闺蜜 | 七七婷婷婷婷精品国产| 久久综合色天天久久综合图片| 国产精品一区二区三区99| 一区二区不卡在线播放 | 欧美电影在线免费观看| 国产成人午夜精品5599| 日韩精品电影一区亚洲| 亚洲国产电影在线观看| 日韩精品一区二区三区swag| 一本大道久久a久久综合婷婷| 图片区小说区国产精品视频| 精品免费视频.| 欧美色图激情小说| 欧美一区二区三区日韩视频| 91一区二区在线观看| 国产精品123| av高清久久久| av影院午夜一区| 石原莉奈一区二区三区在线观看| 亚洲欧洲精品成人久久奇米网| 日韩欧美国产系列| 日韩欧美中文字幕一区| 欧美成人精品福利| 欧美国产97人人爽人人喊| 欧美喷水一区二区| 91.麻豆视频| 日韩欧美一二三| 国产精品美女一区二区| 中文在线免费一区三区高中清不卡| 精品日韩欧美在线| 中文字幕av一区二区三区免费看| 国产精品私房写真福利视频| 久久亚洲影视婷婷| 亚洲国产成人精品视频| 亚洲国产va精品久久久不卡综合| 亚洲欧洲国产日韩| 亚洲精品乱码久久久久| 亚洲小说欧美激情另类| 日一区二区三区| 国产伦精品一区二区三区免费 | 精品福利在线导航| 久久久久久一二三区| 亚洲视频一区二区免费在线观看| 亚洲欧美日韩在线播放| 日韩在线播放一区二区| 成人免费视频国产在线观看| 91免费看`日韩一区二区| 色婷婷久久久综合中文字幕| 欧美日韩中文字幕一区二区| 日韩午夜激情免费电影| 国产亚洲精品超碰| 老汉av免费一区二区三区| 欧美色图在线观看| 国产精品污www在线观看| 中文字幕亚洲欧美在线不卡| 天天影视网天天综合色在线播放| 国产揄拍国内精品对白| 欧美三级电影一区| 一区免费观看视频| 久久精品国产色蜜蜜麻豆| 欧洲中文字幕精品| 国产欧美日韩另类一区| 亚洲成人精品一区二区| av影院午夜一区| 2020国产精品自拍| 日本成人在线电影网| 欧美日韩不卡在线| 夜夜精品视频一区二区| 日本高清免费不卡视频| 国产目拍亚洲精品99久久精品| 婷婷综合久久一区二区三区| jlzzjlzz欧美大全| 亚洲精品福利视频网站| 99久久精品一区二区| 久久久777精品电影网影网 | 中文字幕不卡在线| 狠狠狠色丁香婷婷综合久久五月| 欧美精品乱码久久久久久按摩| 一区二区中文视频| 激情久久久久久久久久久久久久久久| 欧美日韩视频在线第一区| 亚洲欧洲日本在线| 成人h精品动漫一区二区三区|