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

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

?? select~1.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 lint
static char selection_c_rcsid[]="$Id: selection.c,v 2.7 1993/05/29 22:59:21 gpc-avc Exp gpc-avc $";
#endif

/*
 *
 * $Log: selection.c,v $
 * Revision 2.7  1993/05/29  22:59:21  gpc-avc
 * use M_PI from math.h instead of PI from gpc.h
 *
 * Revision 2.6  1993/04/22  07:39:12  gpc-avc
 * Removed old log messages
 *
 * Revision 2.5  1993/04/14  04:50:16  gpc-avc
 * just a change of the revision number
 *
 *
 */

#include <stdio.h>
#include <malloc.h>
#include <errno.h>
#include <math.h>
#include "gpc.h"


#ifdef ANSI_FUNC

tree *find_tree(
  pop_struct 	*pop,
  int 		p,
  int 		demes,
  int 		nrows,
  int 		ncols,
  int		*worst,
  int		*best
  )
#else

tree *find_tree(pop,p,demes,nrows,ncols,worst,best)
  pop_struct	*pop;
  int		p;
  int 		demes;
  int 		nrows;
  int 		ncols;
  int		*worst;
  int		*best;
#endif
{
  if (demes) {
    return find_tree_using_demes(pop,p,nrows,ncols,worst,best);
  } else {
    switch (pop[p].selection_method) {
    case TOURNAMENT:
      return find_tree_using_tournament(pop,p,worst,best);
    case OVERSELECT:
      return 
	find_tree_using_fitnessprop(pop,p,random_float_with_overselect(pop,p));
    case FITNESSPROP:
      return find_tree_using_fitnessprop(pop,p,random_float(1.0));
    default:
      fprintf(stderr,"Invalid selection method %d\n",pop[p].selection_method);
      return (NULL);
    }
  }
}

#ifdef ANSI_FUNC

tree *find_tree_using_demes(
  pop_struct 	*pop,
  int 		p,
  int 		nrows,
  int 		ncols,
  int		*worst,
  int		*best
  )
#else

tree *find_tree_using_demes(pop,p,nrows,ncols,worst,best)
  pop_struct	*pop;
  int		p;
  int 		nrows;
  int 		ncols;
  int		*worst;
  int		*best;
#endif
{
  int   i,row,col;
  int	best_index, best_i, worst_index;

  /* Select tournament_K individuals */
  for (i = 0; i < pop[p].tournament_K; i++) {
    pop[p].tournament_index[i] =
      cannonical_select(pop,p,nrows,ncols);
#if DBDEMES == 1
    printf(" %d (LID=%d, SF=%f)\n", i, pop[p].tournament_index[i],
	   POP[p].standardized_fitness[pop[p].tournament_index[i]]);
#endif
  }

  /* Find fitest individual */
  best_index = worst_index = pop[p].tournament_index[best_i=0];
  for (i = 1; i < pop[p].tournament_K; i++) {
    if (POP[p].standardized_fitness[pop[p].tournament_index[i]] <
	POP[p].standardized_fitness[best_index]) {
      best_index = pop[p].tournament_index[i];
      best_i = i;
    }
    if (POP[p].standardized_fitness[pop[p].tournament_index[i]] >=
	POP[p].standardized_fitness[worst_index]) {
      worst_index = pop[p].tournament_index[i];
    }
  }
#if DBDEMES == 1
  printf(" %d WON (linear id=%d)\n", best_i, best_index);
#endif
  *best = best_index;
  *worst = worst_index;
  return POP[p].population[best_index];
}

#ifdef ANSI_FUNC
int cannonical_select (
  pop_struct 	*pop,
  int 		p,
  int 		nrows,
  int 		ncols
  )
#else
int cannonical_select(pop,p,nrows,ncols)
  pop_struct	*pop;
  int		p;
  int 		nrows;
  int 		ncols;
#endif
{
  float		azimuth, range, x, y;
  int		row,col,individual_id;

  azimuth = random_float(2.0*M_PI);
  range = gaussian_noise(0.0, pop[p].deme_search_radius_sigma);

  x = (0.5+(float)(pop[p].my_col)) + range * (float) cos((double)azimuth);
  y = (0.5+(float)(pop[p].my_row)) + range * (float) sin((double)azimuth);

  if (x<0.0) x+= (float) ncols;
  if (y<0.0) y+= (float) nrows;

  col = ((int) x)%ncols;
  row = ((int) y)%nrows;
  individual_id = random_int(pop[p].population_size);
#if DBDEMES == 1
  printf("select id %d from row %d col %d for tournament slot",
	 individual_id, row, col);
#endif
  return ((row*ncols) + col)*pop[p].population_size + individual_id;
}

#ifdef ANSI_FUNC
float random_float_with_overselect(
  pop_struct 	*pop,
  int 		p
  )
#else
float random_float_with_overselect(pop,p)
  pop_struct	*pop;
  int		p;
#endif
{
  float	boundary;

  if (pop[p].population_size < 1000) {
    fprintf(stderr,"population size %d is too small for overselection\n",
	    pop[p].population_size);
    exit(-1);
  }

  boundary = 320.0 / (float) (pop[p].population_size);
  if (random_float(1.0) < 0.8) {
    return random_float(1.0);
  } else {
    return (boundary + random_float(1.0-boundary));
  }
}

#ifdef ANSI_FUNC
tree *find_tree_using_tournament_2(
  pop_struct	*pop,
  int 		p
  )
#else
tree *find_tree_using_tournament_2(pop,p)
  pop_struct 	*pop;
  int		p;
#endif
{
  int	index1, index2;

  index1 = random_int(pop[p].population_size);
  index2 = random_int(pop[p].population_size);
  if (pop[p].standardized_fitness[index1] <
      pop[p].standardized_fitness[index2])
    return pop[p].population[index1];
  else
    return pop[p].population[index2];
}


#ifdef ANSI_FUNC

tree *find_tree_using_tournament(
  pop_struct 	*pop,
  int 		p,
  int		*worst,
  int		*best
  )
#else

tree *find_tree_using_tournament(pop,p,worst,best)
  pop_struct	*pop;
  int		p;
  int		*worst;
  int		*best;
#endif
{
  int   i;
  int	best_fitness_index;
  int	worst_fitness_index;

  /* Select tournament_K individuals */
  for (i = 0; i < pop[p].tournament_K; i++) {
    pop[p].tournament_index[i] = random_int(pop[p].population_size);
  }
  /* Find fitest individual */
  best_fitness_index = worst_fitness_index = pop[p].tournament_index[0];
  for (i = 1; i < pop[p].tournament_K; i++) {
    if (pop[p].standardized_fitness[pop[p].tournament_index[i]] <
	pop[p].standardized_fitness[best_fitness_index]) {
      best_fitness_index = pop[p].tournament_index[i];
    }
    if (pop[p].standardized_fitness[pop[p].tournament_index[i]] >=
	pop[p].standardized_fitness[worst_fitness_index]) {
      worst_fitness_index = pop[p].tournament_index[i];
    }
  }
  *best = best_fitness_index;
  *worst = worst_fitness_index;
  return pop[p].population[best_fitness_index];
}

#ifdef ANSI_FUNC
tree *find_tree_using_fitnessprop(
  pop_struct 	*pop,
  int 		p,
  float 	thresh
  )
#else
tree *find_tree_using_fitnessprop(pop, p, thresh)
  pop_struct	*pop;
  int		p;
  float		thresh;
#endif
{
  int	i;
  float	sum;
  int	worst_index;

  for (i=0, sum=0.0;
       ((i<pop[p].population_size) && (sum < thresh));
       sum += pop[p].normalized_fitness[pop[p].fitness_sort_index[i]], i++);
  return pop[p].population[pop[p].fitness_sort_index[i-1]];
}
nt		p;
  float		thresh;
#endif
{
  int	i;
  float	sum;
  int	worst_index;

  for (i=0, sum=0.0;
       ((i<pop[p].population_size) && (sum < thresh));
       sum += pop[p].normalized_fitness[pop[p].fitness_sort_index[i]], i++);
  return pop[p].population[pop[p].fitness_sort_index[i-1]];
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99久久精品情趣| 欧美久久久一区| 久久爱www久久做| 婷婷久久综合九色综合绿巨人 | 国产精品久久久久久久久免费丝袜 | 视频在线观看91| 亚洲精品亚洲人成人网| 亚洲精品免费视频| 成人欧美一区二区三区视频网页 | 中文字幕亚洲区| 成人欧美一区二区三区白人| 亚洲精品成人天堂一二三| 亚洲欧美成人一区二区三区| 亚洲一级二级三级在线免费观看| 亚洲精品日韩专区silk| 亚洲成av人片观看| 狠狠色丁香久久婷婷综合丁香| 国产一区二区免费在线| 91在线国产福利| 欧美军同video69gay| 久久这里只精品最新地址| 日本一区二区三区在线不卡| 亚洲一区二三区| 蜜桃av噜噜一区| 丰满放荡岳乱妇91ww| 91成人免费网站| 欧美电影免费观看高清完整版在 | 久久精品国产第一区二区三区| 久久精品99国产国产精| 99久久精品国产一区二区三区 | 亚洲精品高清在线| 日韩二区三区在线观看| 大胆亚洲人体视频| 欧美久久久久久久久久| 国产精品国产a级| 免费不卡在线视频| 91在线高清观看| 日韩精品一区在线| 亚洲精品国产无天堂网2021 | 亚洲在线一区二区三区| 国产一区二区调教| 91九色02白丝porn| 久久久国产精华| 日本亚洲欧美天堂免费| 欧美综合欧美视频| 国产精品国产三级国产普通话蜜臀| 奇米影视在线99精品| 一道本成人在线| 欧美国产精品v| 精品亚洲aⅴ乱码一区二区三区| 色久优优欧美色久优优| 国产精品久久综合| 国产伦精品一区二区三区在线观看| 一本色道**综合亚洲精品蜜桃冫 | 日韩一区二区电影网| 亚洲精品少妇30p| 99在线热播精品免费| 久久久国产综合精品女国产盗摄| 日本中文字幕一区| 在线观看www91| 亚洲自拍偷拍av| 色综合久久久网| 最新久久zyz资源站| 成人影视亚洲图片在线| 日韩免费观看2025年上映的电影| 日韩精品国产精品| 欧美久久久久久蜜桃| 午夜久久电影网| 欧美日韩亚洲综合在线| 一区二区三区四区乱视频| 粉嫩嫩av羞羞动漫久久久| 久久精品一区二区三区四区| 国内精品视频666| 久久久综合九色合综国产精品| 国产自产视频一区二区三区| 精品美女在线播放| 黑人精品欧美一区二区蜜桃| 欧美成人video| 精品一区二区在线看| 久久一二三国产| 福利电影一区二区三区| 国产精品视频麻豆| 91亚洲精品久久久蜜桃| 亚洲妇熟xx妇色黄| 欧美久久久久久蜜桃| 另类小说色综合网站| 久久久久久久久伊人| 不卡av免费在线观看| 亚洲一区二区三区四区五区黄| 欧美日韩综合一区| 日本在线播放一区二区三区| 久久久夜色精品亚洲| av电影天堂一区二区在线观看| 亚洲同性同志一二三专区| 欧美在线你懂的| 久久精品国产成人一区二区三区| 久久久国产精品麻豆| 色婷婷亚洲精品| 久久国内精品视频| 国产欧美日韩亚州综合| 色老综合老女人久久久| 丝瓜av网站精品一区二区| 亚洲精品一区在线观看| 91香蕉视频污在线| 男人操女人的视频在线观看欧美| 国产女主播一区| 精品视频在线视频| 国产精品一线二线三线精华| 亚洲男人的天堂一区二区| 日韩欧美一区二区三区在线| 99久久伊人网影院| 另类综合日韩欧美亚洲| 亚洲日本青草视频在线怡红院| 91麻豆精品国产自产在线观看一区| 国产成人高清视频| 爽好久久久欧美精品| 自拍偷拍国产亚洲| xnxx国产精品| 欧美日本在线一区| av亚洲产国偷v产偷v自拍| 免费的国产精品| 亚洲国产欧美另类丝袜| 国产精品水嫩水嫩| 日韩欧美国产高清| 欧美艳星brazzers| 99久久久国产精品免费蜜臀| 精品在线播放免费| 视频一区二区不卡| 亚洲美女精品一区| 国产精品国产三级国产a| 精品粉嫩aⅴ一区二区三区四区| 欧美色综合天天久久综合精品| 成熟亚洲日本毛茸茸凸凹| 久久精品二区亚洲w码| 三级精品在线观看| 亚洲影院久久精品| 亚洲美女免费视频| 亚洲女同ⅹxx女同tv| 国产精品系列在线| 日本一区二区三区在线不卡| 精品国产电影一区二区| 欧美大片在线观看| 日韩一级片网站| 91精品久久久久久久99蜜桃| 欧美三级乱人伦电影| 欧美午夜宅男影院| 欧美日韩国产综合一区二区三区| 色婷婷久久一区二区三区麻豆| 99re热这里只有精品视频| thepron国产精品| 不卡av免费在线观看| 99在线视频精品| 色婷婷综合五月| 欧美性色欧美a在线播放| 在线观看精品一区| 欧美性感一区二区三区| 欧美妇女性影城| 91精品国产色综合久久久蜜香臀| 欧美精品一二三| 日韩三级免费观看| 欧美xxx久久| 国产色婷婷亚洲99精品小说| 亚洲国产精品成人综合| 亚洲婷婷在线视频| 亚洲一区二区三区四区在线观看 | 久久久久9999亚洲精品| 国产欧美精品一区二区色综合朱莉 | 91精品国产美女浴室洗澡无遮挡| 91精品啪在线观看国产60岁| 精品久久久久久久一区二区蜜臀| 久久天堂av综合合色蜜桃网| 国产精品久久久久四虎| 亚洲自拍与偷拍| 狠狠色丁香久久婷婷综合丁香| 国产一区二区不卡| 色诱视频网站一区| 欧美一级免费观看| 国产偷国产偷精品高清尤物| 亚洲理论在线观看| 激情综合网av| av不卡免费电影| 欧美一区二区三区喷汁尤物| 国产精品理论片| 午夜视频在线观看一区二区三区| 国产剧情av麻豆香蕉精品| 在线视频欧美区| 欧美精品一区二区三区视频| 亚洲视频在线一区观看| 免费看精品久久片| 91视频在线看| 欧美精品一区二区三区在线 | 蜜乳av一区二区| 成人激情动漫在线观看| 欧美精品三级日韩久久| 中文字幕在线不卡一区二区三区| 天天影视涩香欲综合网| 波多野结衣视频一区| 日韩欧美国产精品一区| 亚洲成av人片在线观看| 99v久久综合狠狠综合久久|