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

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

?? ga_select.c

?? http://gaul.sourceforge.net/ 這里大部分人討論的是在Matlab里實現GA的toolbox.以上為一個GA的C語言的軟件包.如果你想利用GA做優化算法,非常有用.而且有
?? C
?? 第 1 頁 / 共 3 頁
字號:
/**********************************************************************  ga_select.c **********************************************************************  ga_select - Genetic algorithm selection operators.  Copyright ?2000-2004, Stewart Adcock <stewart@linux-domain.com>  All rights reserved.  The latest version of this program should be available at:  http://gaul.sourceforge.net/  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.  Alternatively, if your project  is incompatible with the GPL, I will probably agree to requests  for permission to use the terms of any other license.  This program is distributed in the hope that it will be useful, but  WITHOUT ANY WARRANTY WHATSOEVER.  A full copy of the GNU General Public License should be in the file  "COPYING" provided with this distribution; if not, see:  http://www.gnu.org/ **********************************************************************  Synopsis:     Routines for performing GA selection operations.		This selection routines return TRUE if the selection		procedure has run to completion, otherwise they return		FALSE.  They may potentially return NULL for the		selected entities.  This is valid behaviour and doesn't		necessarily indicate that the selection producedure is		complete.		On the first call to these routines in a given		generation, pop->select_state is gauranteed to be set		to zero.  These routines are then free to modify this		value, for example, to store the number of selections		performed in this generation.		The ga_select_one_xxx() functions are intended for		asexual selections.		The ga_select_two_xxx() functions are intended for		sexual selections.  Checking whether the mother and		father are different entities is optional.		The calling code is welcome to not use any of these		functions.		These functions return a pointer to the entity instead		of an id because, potentially, the entities may come		from a different population.		It may be important to use the value held in the		pop->orig_size field instead of the pop->size field		because the population size is liable to increase		between calls to these functions!  (Although, of course,		you are free to use whichever value you like in		user-defined functions.)  To do:	Reimplement stochastic universal selection etc. using this callback mechanism.		Reimplement probability ranges: mutation_prob = mutation_max - (mutation_max-mutation_min)*i/pop->orig_size; **********************************************************************/#include "gaul/ga_core.h"/**********************************************************************  gaul_select_stats()  synopsis:     Determine mean and standard deviation (and some other                potentially useful junk) of the fitness scores.  parameters:	population *pop  return:	TRUE  last updated: 30/04/01 **********************************************************************/static boolean gaul_select_stats( population *pop,                             double *average, double *stddev, double *sum )  {  int           i;                      /* Loop over all entities. */  double        fsum=0.0, fsumsq=0.0;   /* Sum and sum squared. */#if 0/* * Checks not needed for this static function unless used by * external code... which it isn't. */  if (!pop) die("Null pointer to population structure passed.");  if (pop->size < 1) die("Pointer to empty population structure passed.");#endif  for (i=0; i<pop->orig_size; i++)    {    fsum += pop->entity_iarray[i]->fitness;    fsumsq += SQU(pop->entity_iarray[i]->fitness);    }  *sum = fsum;  *average = fsum / pop->orig_size;  *stddev = (fsumsq - fsum*fsum/pop->orig_size)/pop->orig_size;  return TRUE;  }/**********************************************************************  gaul_select_sum_fitness()  synopsis:	Determine sum of entity fitnesses.  parameters:	population *pop  return:	double sum  last updated: 11 Jun 2002 **********************************************************************/static double gaul_select_sum_fitness( population *pop )  {  int           i;		/* Loop over all entities. */  double        sum=0.0;	/* Sum and sum squared. */  for (i=0; i<pop->orig_size; i++)    {    sum += pop->entity_iarray[i]->fitness;    }  return sum;  }/**********************************************************************  gaul_select_sum_sq_fitness()  synopsis:	Determine sum of squared entity fitnesses.  parameters:	population *pop  return:	double sum  last updated: 23 Mar 2004 **********************************************************************/static double gaul_select_sum_sq_fitness( population *pop )  {  int           i;		/* Loop over all entities. */  double        sum=0.0;	/* Sum and sum squared. */  for (i=0; i<pop->orig_size; i++)    {    sum += ( pop->entity_iarray[i]->fitness * pop->entity_iarray[i]->fitness );    }  return sum;  }/**********************************************************************  ga_select_one_random()  synopsis:	Select a single random entity.  Selection stops when		(population size)*(mutation ratio)=(number selected)  parameters:  return:	  last updated: 30/04/01 **********************************************************************/boolean ga_select_one_random(population *pop, entity **mother)  {  if (!pop) die("Null pointer to population structure passed.");  if (pop->orig_size < 1)    {    *mother = NULL;    return TRUE;    }  *mother = pop->entity_iarray[random_int(pop->orig_size)];  pop->select_state++;  return pop->select_state>(pop->orig_size*pop->mutation_ratio);  }/**********************************************************************  ga_select_two_random()  synopsis:	Select a pair of random entities.  Selection stops when		(population size)*(crossover ratio)=(number selected)  parameters:  return:	  last updated: 30/04/01 **********************************************************************/boolean ga_select_two_random(population *pop, entity **mother, entity **father)  {  if (!pop) die("Null pointer to population structure passed.");  if (pop->orig_size < 2)    {    *mother = NULL;    *father = NULL;    return TRUE;    }  *mother = pop->entity_iarray[random_int(pop->orig_size)];  do     {    *father = pop->entity_iarray[random_int(pop->orig_size)];    } while (*mother == *father);  pop->select_state++;  return pop->select_state>(pop->orig_size*pop->crossover_ratio);  }/**********************************************************************  ga_select_one_every()  synopsis:	Select every entity.  parameters:  return:	  last updated: 23/04/01 **********************************************************************/boolean ga_select_one_every(population *pop, entity **mother)  {  if (!pop) die("Null pointer to population structure passed.");  *mother = NULL;  if ( pop->orig_size <= pop->select_state )    {    return TRUE;    }  *mother = pop->entity_iarray[pop->select_state];  pop->select_state++;  return FALSE;  }/**********************************************************************  ga_select_two_every()  synopsis:	Select every possible pair of parents.  parameters:  return:	  last updated: 23/04/01 **********************************************************************/boolean ga_select_two_every(population *pop, entity **mother, entity **father)  {  if (!pop) die("Null pointer to population structure passed.");  *mother = NULL;  *father = NULL;  if ( SQU(pop->orig_size) <= pop->select_state )    {    return TRUE;    }  *mother = pop->entity_iarray[pop->select_state%pop->orig_size];  *father = pop->entity_iarray[pop->select_state/pop->orig_size];  pop->select_state++;  return FALSE;  }/**********************************************************************  ga_select_one_randomrank()  synopsis:	Select a single entity by my rank-based method.  parameters:  return:	  last updated: 23/04/01 **********************************************************************/boolean ga_select_one_randomrank(population *pop, entity **mother)  {  if (!pop) die("Null pointer to population structure passed.");  pop->select_state++;  *mother = NULL;  if ( pop->orig_size < pop->select_state )    {    return TRUE;    }  if ( random_boolean_prob(pop->mutation_ratio) )    {    *mother = pop->entity_iarray[random_int(pop->select_state)];    }  return FALSE;  }/**********************************************************************  ga_select_two_randomrank()  synopsis:	Select a pair of entities by my rank-based method.		Basically, I loop through all entities, and each is		paired with a random, fitter, partner.  parameters:  return:	  last updated: 23/04/01 **********************************************************************/boolean ga_select_two_randomrank(population *pop, entity **mother, entity **father)  {  if (!pop) die("Null pointer to population structure passed.");  pop->select_state++;  *mother = NULL;  *father = NULL;  if ( pop->orig_size < pop->select_state )    {    return TRUE;    }  if ( random_boolean_prob(pop->crossover_ratio) )    {    *mother = pop->entity_iarray[random_int(pop->select_state)];    *father = pop->entity_iarray[pop->select_state];    }  return FALSE;  }/**********************************************************************  ga_select_one_bestof3()  synopsis:	Kind of tournament selection.  Choose three random		entities, return the best as the selection.  Selection		stops when		(population size)*(mutation ratio)=(number selected)  parameters:  return:	  last updated: 25 May 2004 **********************************************************************/boolean ga_select_one_bestof3(population *pop, entity **mother)  {  entity	*mother2, *mother3;	/* Random competitors. */  if (!pop) die("Null pointer to population structure passed.");  if (pop->orig_size < 1)    {    *mother = NULL;    return TRUE;    }  *mother = pop->entity_iarray[random_int(pop->orig_size)];  mother2 = pop->entity_iarray[random_int(pop->orig_size)];  mother3 = pop->entity_iarray[random_int(pop->orig_size)];  if (mother2->fitness > (*mother)->fitness)    *mother = mother2;  if (mother3->fitness > (*mother)->fitness)    *mother = mother3;  pop->select_state++;  return pop->select_state>(pop->orig_size*pop->mutation_ratio);  }/**********************************************************************  ga_select_two_bestof2()  synopsis:	Kind of tournament selection.  For each parent, choose		three random entities, return the best as the		selection.		The two parents will be different.  Selection		stops when		(population size)*(crossover ratio)=(number selected)  parameters:  return:	  last updated: 25 May 2004 **********************************************************************/boolean ga_select_two_bestof3(population *pop, entity **mother, entity **father)  {  entity	*challenger1, *challenger2;	/* Random competitors. */  if (!pop) die("Null pointer to population structure passed.");  if (pop->orig_size < 2)    {    *mother = NULL;    *father = NULL;    return TRUE;    }  *mother = pop->entity_iarray[random_int(pop->orig_size)];  challenger1 = pop->entity_iarray[random_int(pop->orig_size)];  challenger2 = pop->entity_iarray[random_int(pop->orig_size)];  if (challenger1->fitness > (*mother)->fitness)    *mother = challenger1;  if (challenger2->fitness > (*mother)->fitness)    *mother = challenger2;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品免费在线观看| 亚洲精品少妇30p| 成人午夜私人影院| 1000精品久久久久久久久| 91丨九色丨蝌蚪丨老版| 亚洲综合激情小说| 91精品国产麻豆| 国产麻豆欧美日韩一区| 国产精品久久久久久久久久久免费看 | 久久精品在线观看| 9i看片成人免费高清| 一区二区成人在线| 欧美一区二区不卡视频| 国产精品99久久久久久宅男| 亚洲视频免费在线观看| 欧美日韩高清一区| 国产一区二区三区免费看| 亚洲欧洲成人精品av97| 欧美日韩高清在线| 国产剧情一区二区| 伊人开心综合网| 欧美一区二区女人| heyzo一本久久综合| 午夜精品久久久久久久久久| 久久综合久久综合久久| 99久久国产免费看| 男女激情视频一区| 中文字幕欧美日本乱码一线二线| 色老头久久综合| 精品写真视频在线观看| 亚洲视频一区在线| 欧美一区二区三区四区视频| 成人av免费在线观看| 婷婷丁香久久五月婷婷| 国产欧美日韩另类一区| 欧美日韩中字一区| 国产91精品一区二区麻豆网站| 玉足女爽爽91| 国产亚洲一区二区三区| 欧美性大战久久久久久久| 国产一区高清在线| 亚洲成av人在线观看| 国产亚洲精品bt天堂精选| 欧美亚洲一区三区| 国产不卡高清在线观看视频| 五月天一区二区三区| 亚洲国产精品成人久久综合一区| 欧美老人xxxx18| 成人国产精品免费| 开心九九激情九九欧美日韩精美视频电影 | 午夜精品一区二区三区免费视频| 久久蜜桃av一区精品变态类天堂| 欧美视频三区在线播放| 国产成人免费在线观看不卡| 日日夜夜精品视频免费| 中文字幕在线不卡国产视频| 日韩免费观看高清完整版在线观看| 色哟哟国产精品| 国产精品1区2区| 日韩激情av在线| 亚洲精品va在线观看| 中文字幕欧美区| 欧美mv日韩mv国产网站app| 欧美日韩久久久| 色综合天天综合网天天狠天天| 国产乱妇无码大片在线观看| 日韩国产欧美一区二区三区| 一区二区三区在线看| 欧美国产一区二区在线观看| 日韩视频一区二区在线观看| 欧美三级蜜桃2在线观看| 不卡视频在线观看| 国产精品99久久久久久久女警| 日韩av电影免费观看高清完整版在线观看| 亚洲男人的天堂av| 中文字幕免费不卡在线| 精品国偷自产国产一区| 欧美一级日韩一级| 欧美日韩免费在线视频| 在线欧美日韩国产| 99久久久国产精品免费蜜臀| 国产夫妻精品视频| 国产又黄又大久久| 久久99精品国产麻豆不卡| 日本亚洲免费观看| 午夜影视日本亚洲欧洲精品| 亚洲综合区在线| 亚洲一区二区综合| 亚洲欧美另类久久久精品| 国产精品美女久久久久久久久 | 97久久精品人人做人人爽50路 | 国产69精品久久久久毛片| 国产精品资源网| 国产一区在线看| 精品一区二区成人精品| 精品一区二区免费看| 韩国视频一区二区| 久久aⅴ国产欧美74aaa| 看片的网站亚洲| 精品在线一区二区| 国产自产2019最新不卡| 韩日欧美一区二区三区| 国产一区二区三区免费在线观看| 国产一区高清在线| 国产成人夜色高潮福利影视| 国产风韵犹存在线视精品| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 日韩电影一二三区| 奇米888四色在线精品| 免费在线看成人av| 免费精品99久久国产综合精品| 蜜桃久久精品一区二区| 精东粉嫩av免费一区二区三区| 极品销魂美女一区二区三区| 国产一区二区三区在线观看免费视频| 韩国精品一区二区| 国产成人综合网| 99久久综合色| 欧美中文字幕不卡| 欧美日韩成人在线| 日韩一区二区三区视频| 精品日韩99亚洲| 国产视频一区不卡| 国产精品天干天干在线综合| 亚洲欧洲日产国码二区| 亚洲激情中文1区| 亚洲电影第三页| 美脚の诱脚舐め脚责91| 国产激情一区二区三区桃花岛亚洲| 丁香五精品蜜臀久久久久99网站| 成人av动漫在线| 欧美丝袜丝交足nylons图片| 91麻豆精品国产91久久久使用方法| 日韩女优毛片在线| 国产精品污www在线观看| 亚洲精品中文在线影院| 日本中文字幕一区二区视频| 精品一二三四在线| av亚洲精华国产精华精| 欧美日韩在线直播| 精品美女在线播放| 中文字幕一区二区三区不卡在线 | 国产精品影音先锋| 波多野结衣亚洲| 欧美日韩中文字幕一区二区| 欧美一区二区三区在线| 欧美极品美女视频| 亚洲国产中文字幕在线视频综合 | 色呦呦国产精品| 日韩一区二区三区电影| 中文字幕免费在线观看视频一区| 亚洲精品视频免费看| 久久国产精品色| 91香蕉视频污| 欧美美女激情18p| 久久综合色综合88| 亚洲另类一区二区| 蜜臀精品一区二区三区在线观看 | 久久先锋影音av鲁色资源| 亚洲天堂av老司机| 另类小说综合欧美亚洲| 日韩1区2区日韩1区2区| 麻豆中文一区二区| www.欧美.com| 欧美一区二区日韩一区二区| 国产精品毛片高清在线完整版| 亚洲gay无套男同| 成人性生交大片免费| 欧美日韩一区二区欧美激情| 久久久91精品国产一区二区三区| 亚洲一区二区三区四区在线观看| 精品一区二区三区的国产在线播放 | 欧美性生活一区| 久久久国产综合精品女国产盗摄| 亚洲一区二区在线免费观看视频| 精品一区二区三区欧美| 在线观看欧美精品| 精品sm在线观看| 亚洲一区二区精品视频| 国产风韵犹存在线视精品| 欧美日韩国产综合视频在线观看 | 在线播放日韩导航| 中文字幕一区二区三区蜜月| 日韩激情一区二区| 色综合天天性综合| 久久网这里都是精品| 亚洲成年人网站在线观看| 成人免费av资源| 日韩一区二区三区免费看| 一区2区3区在线看| 成人污视频在线观看| 日韩精品一区二区三区视频播放| 夜夜嗨av一区二区三区网页| 成人丝袜18视频在线观看| 欧美电影免费观看高清完整版在线| 一区二区三区欧美日| 波多野结衣中文字幕一区二区三区| 精品久久久久久久久久久久包黑料 | 2017欧美狠狠色| 日韩成人免费电影|