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

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

?? ga_optim.c

?? http://gaul.sourceforge.net/ 這里大部分人討論的是在Matlab里實現GA的toolbox.以上為一個GA的C語言的軟件包.如果你想利用GA做優化算法,非常有用.而且有
?? C
?? 第 1 頁 / 共 5 頁
字號:
/**********************************************************************  ga_optim.c **********************************************************************  ga_optim - Optimisation and evolution routines.  Copyright ?2000-2005, 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 optimisation and evolution.                Note that the temperatures in the simulated annealling                and MC functions do not exactly run from the initial                temperature to the final temperature.  They are offset                slightly so that sequential calls to these functions                will have a linear temperature change.  The SA and MC		code in this file is deprecated anyway - these routines		have been replaced with much more flexible alternatives		and will be removed in the near future.  To do:	Finish rewriting parallel versions, ga_evolution_mp() in particular.		Write ga_evolution_pvm().		Need to fix elitism/crowding stuff.		Remove much duplicated code.		OpenMOSIX fix.  See below.		gaul_adapt_and_evaluate_forked() and gaul_adapt_and_evaluate_threaded() are only parallelized for the case that no adaptation occurs. **********************************************************************/#include "gaul/ga_optim.h"/* * Here is a kludge. * * This constant, if defined, causes a 10 microsecond delay to be * inserted after each fork() call.  It shouldn't be needed, but * apparently on OpenMOSIX lots of processes started at the same * time cause all sorts of problems (mostly bus errors).  This * delay gives OpenMOSIX a chance to migrate some processes to * other nodes before this becomes a problem (hopefully). * * A long-term fix fix will be to check the return value from the * forked processes and repeat them if they died.  This may be * added... eventually. * * I don't think this is needed anymore for recent versions of * OpenMOSIX. */#define NEED_MOSIX_FORK_HACK 1#if HAVE_MPI == 1/* * Convenience wrappers around MPI functions: * * These are used in the *_mp() functions. */static int	rank=-1;				/* Current process's rank. */static int	size=0;					/* Total number of processes. */static int	namelen;				/* Length of processor name. */static char	node_name[MPI_MAX_PROCESSOR_NAME];	/* String containing processor name. *//* * MPI tags. */#define GA_TAG_SLAVE_NOTIFICATION	1001#define GA_TAG_BUFFER_LEN		1002#define GA_TAG_INSTRUCTION		1003#define GA_TAG_FITNESS			1004#define GA_TAG_CHROMOSOMES		1005/**********************************************************************  mpi_init()  synopsis:	Ensure that MPI is initialised and prepare some global		variables.  parameters:  return:	TRUE if master process, FALSE otherwise.  last updated:	23 Sep 2003 **********************************************************************/static void mpi_init(void)  {  if (rank==-1)    {/* * FIXME: Test for prior MPI_Init() call here. */    MPI_Comm_size(MPI_COMM_WORLD, &size);    MPI_Comm_rank(MPI_COMM_WORLD, &rank);    MPI_Get_processor_name(node_name, &namelen);    }  return;  }/**********************************************************************  mpi_ismaster()  synopsis:	Is this the master process?  parameters:  return:	TRUE if master process, FALSE otherwise.  last updated:	03 Feb 2003 **********************************************************************/static boolean mpi_ismaster(void)  {  return (rank==0);  }/**********************************************************************  mpi_get_num_processes()  synopsis:	Return the total number of MPI processes.  parameters:  return:	int	number of processes.  last updated:	03 Feb 2003 **********************************************************************/static int mpi_get_num_processes(void)  {  return (size);  }/**********************************************************************  mpi_get_rank()  synopsis:	Return the rank of this process.  parameters:  return:	int	rank  last updated:	03 Feb 2003**********************************************************************/static int mpi_get_rank(void)  {  return (rank);  }/**********************************************************************  mpi_get_next_rank()  synopsis:	Return the rank of the next node in a circular		topology.  parameters:  return:	int	rank  last updated:	03 Feb 2003 **********************************************************************/static int mpi_get_next_rank(void)  {  int	next=rank+1;		/* The rank of the next process */  if (next==size) next=0;	/* Last process sends to first process */  return (next);  }/**********************************************************************  mpi_get_prev_rank()  synopsis:	Return the rank of the previous node in a circular		topology.  parameters:  return:	int	rank  last updated:	03 Feb 2003 **********************************************************************/static int mpi_get_prev_rank(void)  {  int	prev=rank;		/* The rank of the previous process */  if (prev==0) prev=size;	/* First process sends to last process */  return (prev-1);  }/**********************************************************************  gaul_bond_slaves_mpi()  synopsis:	Register, set up and synchronise slave processes.  parameters:	population *pop  return:	none  last updated:	10 May 2004 **********************************************************************/static void gaul_bond_slaves_mpi(population *pop, int buffer_len, int buffer_max)  {  int		i;			/* Loop variable over slave processes. */  int		mpi_rank;		/* Rank of slave process. */  int		mpi_size;		/* Number of slave processes. */  MPI_Status	status;			/* MPI status structure. */  int		two_int[2];		/* Send buffer. */  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);  two_int[0] = buffer_len;  two_int[1] = buffer_max;/* * Listen for all slave processes. */  for (i=1; i<mpi_size; i++)    {    MPI_Recv(&mpi_rank, 1, MPI_INT, MPI_ANY_SOURCE, GA_TAG_SLAVE_NOTIFICATION, MPI_COMM_WORLD, &status);    /* FIXME: Check status here. *//* * Send slave the buffer length that it will require. */    MPI_Send(two_int, 2, MPI_INT, status.MPI_SOURCE, GA_TAG_BUFFER_LEN, MPI_COMM_WORLD);    }  return;  }/**********************************************************************  gaul_debond_slaves_mpi()  synopsis:	Release and synchronise slave processes.  parameters:	population *pop  return:	none  last updated:	10 May 2004 **********************************************************************/static void gaul_debond_slaves_mpi(population *pop)  {  int		i;			/* Loop variable over slave processes. */  int		instruction=1;		/* New population instruction. */  int		mpi_size;		/* Number of slave processes. */  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);/* * Send instructions to all slave processes. */  for (i=1; i<mpi_size; i++)    {/*    printf("DEBUG: Sending debond instruction to %d\n", i);*/    MPI_Send(&instruction, 1, MPI_INT, i, GA_TAG_INSTRUCTION, MPI_COMM_WORLD);    }  return;  }#endif/**********************************************************************  ga_attach_mpi_slave()  synopsis:	Slave MPI process routine.  parameters:	none  return:	none  last updated:	10 May 2004 **********************************************************************/void ga_attach_mpi_slave( population *pop )  {#if HAVE_MPI == 1  MPI_Status	status;			/* MPI status structure. */  int		single_int;		/* Receive buffer. */  byte		*buffer=NULL;		/* Receive buffer. */  byte		*chromo=NULL;		/* Chromosome. */  boolean	finished=FALSE;		/* Whether this slave is done. */  entity	*entity, *adult;	/* Received entity, adapted entity. */  int		buffer_len=0;		/* Length of buffer to receive. */  int		buffer_max=0;		/* Chromosome byte representation length. */  int		mpi_rank;		/* Rank of MPI process; should never be 0 here. */  int		two_int[2];		/* Send buffer. *//* * Rank zero process is master.  This handles evolution.  Other processes are slaves * which simply evaluate entities, and should be attached using ga_attach_slave(). */  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);  if (mpi_rank == 0) die("ga_attach_mpi_slave() called by process with rank=0.");/* * Send notification to master. *//*  printf("DEBUG: Process %d notifying master\n", mpi_rank);*/  MPI_Send(&mpi_rank, 1, MPI_INT, 0, GA_TAG_SLAVE_NOTIFICATION, MPI_COMM_WORLD);/* * Allocate chromosome transfer buffer. */  MPI_Recv(two_int, 2, MPI_INT, 0, GA_TAG_BUFFER_LEN, MPI_COMM_WORLD, &status);  buffer_len = two_int[0];  buffer_max = two_int[1];  buffer = s_malloc(buffer_len*sizeof(byte));/* printf("DEBUG: slave buffer len %d %d\n", buffer_len, buffer_max);*//* * Enter task loop. */  do    {/* * Recieve instruction packet. */    MPI_Recv(&single_int, 1, MPI_INT, 0, GA_TAG_INSTRUCTION, MPI_COMM_WORLD, &status);/*    printf("DEBUG: slave %d recieved instruction %d\n", mpi_rank, single_int);*/    switch (single_int)      {      case 0:        /* No more jobs. *//*        printf("DEBUG: slave %d recieved detach instruction.\n", mpi_rank);*/        finished=TRUE;        break;      case 1:        /* Prepare for calculations with a new population. *//* FIXME: Incomplete. */        MPI_Send(&mpi_rank, 1, MPI_INT, 0, GA_TAG_SLAVE_NOTIFICATION, MPI_COMM_WORLD);        MPI_Recv(two_int, 2, MPI_INT, 0, GA_TAG_BUFFER_LEN, MPI_COMM_WORLD, &status);        break;      case 2:        /* Evaluation required. */        entity = ga_get_free_entity(pop);        MPI_Recv(buffer, buffer_len, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);        pop->chromosome_from_bytes(pop, entity, buffer);        if ( pop->evaluate(pop, entity) == FALSE )          entity->fitness = GA_MIN_FITNESS;        MPI_Send(&(entity->fitness), 1, MPI_DOUBLE, 0, GA_TAG_FITNESS, MPI_COMM_WORLD);        ga_entity_dereference(pop, entity);        break;      case 3:        /* Baldwinian adaptation required. */        entity = ga_get_free_entity(pop);        MPI_Recv(buffer, buffer_len, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);        pop->chromosome_from_bytes(pop, entity, buffer);        adult = pop->adapt(pop, entity);        MPI_Send(&(adult->fitness), 1, MPI_DOUBLE, 0, GA_TAG_FITNESS, MPI_COMM_WORLD);        ga_entity_dereference(pop, entity);        ga_entity_dereference(pop, adult);        break;      case 4:        /* Lamarkian adaptation required. */        entity = ga_get_free_entity(pop);        MPI_Recv(buffer, buffer_len, MPI_CHAR, 0, MPI_ANY_TAG, MPI_COMM_WORLD, &status);        pop->chromosome_from_bytes(pop, entity, buffer);        adult = pop->adapt(pop, entity);        MPI_Send(&(adult->fitness), 1, MPI_DOUBLE, 0, GA_TAG_FITNESS, MPI_COMM_WORLD);        if (buffer_max==0)          {          pop->chromosome_to_bytes(pop, adult, &chromo, &buffer_max);          MPI_Send(chromo, buffer_len, MPI_CHAR, 0, GA_TAG_CHROMOSOMES, MPI_COMM_WORLD);          }        else          {          pop->chromosome_to_bytes(pop, adult, &buffer, &buffer_len);          MPI_Send(buffer, buffer_len, MPI_CHAR, 0, GA_TAG_CHROMOSOMES, MPI_COMM_WORLD);          }        ga_entity_dereference(pop, entity);        ga_entity_dereference(pop, adult);        break;      default:        dief("Unknown instruction type packet recieved (%d).", single_int);      }    } while (finished==FALSE);/* * Clean-up and exit. */  if (buffer != NULL)    s_free(buffer);#else  plog(LOG_WARNING, "Attempt to use parallel function without compiled support.");#endif  return;  }/**********************************************************************  ga_detach_mpi_slaves()  synopsis:	Allow all slave processes to continue past the		ga_attach_mpi_slave() routine.  parameters:	none  return:	none  last updated:	10 May 2004 **********************************************************************/void ga_detach_mpi_slaves(void)  {#if HAVE_MPI == 1  int		i;			/* Loop variable over slave processes. */  int		instruction=0;		/* Detach instruction. */  int		mpi_size;		/* Number of slave processes. */  int		mpi_rank;		/* Rank of MPI process; should never be 0 here. */  int		two_int[2]={0,0};	/* Send buffer. */  MPI_Status	status;			/* MPI status structure. */  MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);  MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);/* * Listen for all slave processes. * FIXME: This shouldn't be needed really. */  for (i=1; i<mpi_size; i++)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日产亚洲精品系列| 国产主播一区二区三区| 6080午夜不卡| 另类综合日韩欧美亚洲| 久久久久久9999| 99精品偷自拍| 天天做天天摸天天爽国产一区| 91精品国产综合久久久久久| 国产自产v一区二区三区c| 国产女人18毛片水真多成人如厕| www.性欧美| 亚洲h在线观看| xfplay精品久久| 91色乱码一区二区三区| 日日骚欧美日韩| 久久男人中文字幕资源站| 成人动漫中文字幕| 亚洲成人精品影院| 精品国产伦一区二区三区观看方式 | 亚洲欧洲一区二区三区| 欧美在线色视频| 精品在线播放午夜| 亚洲人成网站影音先锋播放| 欧美另类z0zxhd电影| 国产精品99久久久久久有的能看| 综合久久给合久久狠狠狠97色| 欧美日本一道本| 国产福利一区在线| 亚洲成人免费在线| 久久久99精品久久| 欧美最猛性xxxxx直播| 久久精品国产精品亚洲红杏| 亚洲视频一二三| 欧美一级片免费看| 成人福利视频网站| 日韩成人伦理电影在线观看| 欧美国产成人在线| 欧美精品日韩精品| 粉嫩av一区二区三区粉嫩| 亚洲成人高清在线| 国产女人水真多18毛片18精品视频| 欧美日韩视频专区在线播放| 国产成人免费在线| 五月综合激情日本mⅴ| 中文字幕精品一区二区三区精品| 欧美色图天堂网| 国产99久久久久| 日本成人在线网站| 亚洲欧美日韩中文字幕一区二区三区| 精品国产在天天线2019| 91国产免费看| 成人免费视频视频在线观看免费| 日韩在线a电影| 亚洲欧洲国产专区| 久久免费国产精品| 欧美剧情电影在线观看完整版免费励志电影 | 午夜精品久久一牛影视| 中国色在线观看另类| 在线成人av网站| 91免费观看在线| 国产成人亚洲综合a∨婷婷图片| 午夜天堂影视香蕉久久| 中文字幕在线视频一区| 精品国产一区二区在线观看| 欧美三级韩国三级日本三斤 | 91玉足脚交白嫩脚丫在线播放| 激情欧美一区二区| 婷婷综合在线观看| 亚洲欧美国产高清| 国产欧美一区二区精品性色 | 成人丝袜高跟foot| 精久久久久久久久久久| 亚洲1区2区3区视频| 亚洲手机成人高清视频| 国产亚洲一区二区三区在线观看| 欧美电影影音先锋| 在线观看不卡视频| 99精品国产热久久91蜜凸| 国产精品88888| 久久91精品久久久久久秒播| 天堂资源在线中文精品| 夜夜爽夜夜爽精品视频| 亚洲欧美在线高清| 亚洲国产精品ⅴa在线观看| 精品久久国产字幕高潮| 91精品国产综合久久久久久久久久| 欧美亚洲动漫另类| 日本伦理一区二区| 一本色道久久综合亚洲aⅴ蜜桃| 成人深夜福利app| 高清不卡一二三区| 国产精品一卡二| 国产精品一区二区三区网站| 国产一区二区三区四| 精品一区二区三区久久| 美国精品在线观看| 美女视频第一区二区三区免费观看网站| 亚洲h精品动漫在线观看| 亚洲国产中文字幕在线视频综合| 亚洲精品国产精华液| 一区二区三区欧美日| 尤物在线观看一区| 伊人开心综合网| 伊人色综合久久天天| 亚洲一区二区三区在线| 亚洲在线一区二区三区| 亚洲综合色在线| 污片在线观看一区二区 | 一区二区成人在线观看| 一区二区三区高清在线| 亚洲一线二线三线视频| 亚洲国产另类av| 无码av免费一区二区三区试看 | 一区二区三区自拍| 亚洲福利一二三区| 日韩黄色在线观看| 蜜臀va亚洲va欧美va天堂| 久久av资源站| 国产精品一区二区黑丝| 暴力调教一区二区三区| 91成人免费在线| 在线成人小视频| 欧美精品一区二区三区一线天视频 | 6080yy午夜一二三区久久| 欧美一卡二卡在线| 久久伊人中文字幕| 国产精品视频观看| 亚洲精品一二三| 视频一区二区三区中文字幕| 麻豆成人综合网| 国产精品66部| 色94色欧美sute亚洲线路一久| 欧美精品久久久久久久久老牛影院 | 欧美日本一区二区三区四区| 日韩情涩欧美日韩视频| 国产日韩欧美一区二区三区乱码 | 久久嫩草精品久久久久| 国产精品久久777777| 一卡二卡三卡日韩欧美| 日本亚洲视频在线| 国产成a人无v码亚洲福利| 91精品1区2区| 日韩欧美一区二区视频| 中文字幕免费观看一区| 亚洲永久免费av| 久久精品国产澳门| jizz一区二区| 337p亚洲精品色噜噜噜| 亚洲国产成人午夜在线一区| 亚洲一卡二卡三卡四卡无卡久久| 蜜臀精品久久久久久蜜臀 | 色八戒一区二区三区| 欧美一区二区三区性视频| 国产女主播在线一区二区| 亚洲国产欧美在线人成| 国产乱码精品一区二区三| 在线亚洲一区观看| 欧美成人免费网站| ●精品国产综合乱码久久久久| 天堂影院一区二区| 粉嫩av亚洲一区二区图片| 欧美精品在欧美一区二区少妇| 国产亚洲成av人在线观看导航 | 免费久久99精品国产| 国产成人在线免费| 欧美色视频一区| 国产日韩欧美高清在线| 五月天丁香久久| hitomi一区二区三区精品| 日韩欧美视频在线| 亚洲欧美偷拍三级| 激情小说亚洲一区| 欧美亚洲日本国产| 国产日韩欧美精品电影三级在线| 午夜亚洲福利老司机| 99综合电影在线视频| 日韩精品一区二区三区在线| 亚洲男同性恋视频| 国产激情精品久久久第一区二区 | 亚洲精品国产精品乱码不99| 国产一区二区三区视频在线播放| 欧美日韩一区视频| 国产精品免费视频一区| 美女视频第一区二区三区免费观看网站| 色综合久久久久综合体| 久久色在线观看| 日本在线不卡视频| 91精品办公室少妇高潮对白| 国产日产欧美一区二区三区| 免费一级片91| 在线观看区一区二| 国产精品人妖ts系列视频| 乱中年女人伦av一区二区| 在线观看视频91| 中文字幕制服丝袜一区二区三区 | 91精品国产91久久久久久一区二区 | 欧美日高清视频| 亚洲日本成人在线观看| 国产精品一二三四五| 日韩精品专区在线|