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

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

?? fitness.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 fitness_c_rcsid[]="$Id: fitness.c,v 2.8 1993/04/30 05:08:38 gpc-avc Exp gpc-avc $";
#endif

/*
 *
 * $Log: fitness.c,v $
 * Revision 2.8  1993/04/30  05:08:38  gpc-avc
 * Restructured directories and Makefile
 *
 * Revision 2.6  1993/04/17  03:03:01  gpc-avc
 * Added a test to check if the fitness file exists
 *
 *
 */

#include <stdio.h>
#include <malloc.h>
#include <errno.h>
#include <stdlib.h>
#include "gpc.h"
#include "prob.h"

VOID sort_fitness_cases P_((
	int num,
	GENERIC *vals,
	int *index
	));

VOID load_fitness_file P_((
	char *fn,
	int *num,
	int **labels,
	GENERIC ***table,
	GENERIC **tval,
	GENERIC **cval,
	int **tindex,
	int **cindex,
	int *numt,
	int *numc
	));

#define DIMENSION 7
GENERIC **fitness_cases_table;
GENERIC **test_cases_table;
int *fclabels;
int *tclabels;
int numfc;
int numtc;

GENERIC *fctval;
GENERIC *fccval;
GENERIC *tctval;
GENERIC *tccval;
GENERIC *sortval;
int *fct_sort_index;
int *fcc_sort_index;
int *tct_sort_index;
int *tcc_sort_index;
int numfct;
int numfcc;
int numtct;
int numtcc;

#define pd 0.96
#define xabs(x) ((x)>0?(x):(-(x)))
#ifdef ANSI_FUNC

VOID evaluate_fitness_of_populations(
     int 	numpops,
     int 	numgens,
     pop_struct	*pop,
     int	p
     )
#else

VOID evaluate_fitness_of_populations(numpops,numgens,pop,p)
     int 	numpops;
     int 	numgens;
     pop_struct	*pop;
     int	p;
#endif
{
  int		i;

  for (i=0; i<pop[p].population_size; i++) {
    pop[p].standardized_fitness[i] = 
      evaluate_fitness_of_individual(pop,p,pop[p].population[i],i);
  }
}

#ifdef ANSI_FUNC

float evaluate_fitness_of_individual(
     pop_struct	*pop,
     int	p,
     tree	*t,
     int	i
     )
#else

float evaluate_fitness_of_individual(pop, p, t, i)
     pop_struct	*pop;
     int	p;
     tree	*t;
     int	i;
#endif
{
  int		j, ccount, tcount;
  GENERIC	pdval;

  ccount = tcount = 0;
  for (j=0; j<numfc; j++) {
    load_terminal_set_values(pop,p,fitness_cases_table[j]);
    if (fclabels[j]) fctval[tcount++] = eval(pop[p].population[i]);
    else fccval[ccount++] = eval(pop[p].population[i]);
  }
  sort_fitness_cases(tcount, fctval, fct_sort_index);
  sort_fitness_cases(ccount, fccval, fcc_sort_index);
  pdval = fctval[fct_sort_index[(int)((pd*((GENERIC)(tcount-1)))+0.5)]];
  for (j=0; ((j<ccount) && (fccval[fcc_sort_index[j]] >= pdval)); j++);
  return ((float)j)/(float)ccount;
}

#ifdef ANSI_FUNC

float validate_fitness_of_tree(
     int	numpops,
     int	numgens,
     pop_struct *pop,
     int	p,
     tree 	*t
     )
#else

float validate_fitness_of_tree(numpops, numgens, pop, p, t)
  int		numpops;
  int		numgens;
  pop_struct	*pop;
  int		p;
  tree		*t;
#endif
{
  int	        j, ccount, tcount;
  GENERIC	pdval;

  ccount = tcount = 0;
  for (j=0; j<numtc; j++) {
    load_terminal_set_values(pop,p,test_cases_table[j]);
    if (tclabels[j]) tctval[tcount++] = eval(t);
      else tccval[ccount++] = eval(t);
    }
  sort_fitness_cases(tcount, tctval, tct_sort_index);
  sort_fitness_cases(ccount, tccval, tcc_sort_index);
  pdval = tctval[tct_sort_index[(int)((pd*((GENERIC)(tcount-1)))+0.5)]];
  for (j=0; ((j<ccount) && (tccval[tcc_sort_index[j]] >= pdval)); j++);
  printf("Validation Fitness:\np(D)= %f p(FA)= %f\n", pd, ((float)j)/(float)ccount);
  return ((float)j)/(float)ccount;
}
  
#ifdef ANSI_FUNC

static int fcpr(
	int *i,
	int *j
	)
#else

static int fcpr(i, j)
int	*i, *j;
#endif
{
  if (sortval[*j] > sortval[*i]) return 1;
  else if (sortval[*j] < sortval[*i]) return -1;
  else return 0;
}

#ifdef ANSI_FUNC

VOID sort_fitness_cases(
	int num,
	GENERIC *vals,
	int *index
	)
#else

VOID sort_fitness_cases(num, vals, index)
int	num;
GENERIC *vals;
int	*index;
#endif
{
  int	i;

  for (i=0; i<num;i++) {
    index[i] = i;
  }
  sortval = vals;
  qsort(index, num, sizeof(int), fcpr);
}

#ifdef ANSI_FUNC

int terminate_early(
  int 		numpops,
  int 		numgens,
  pop_struct 	*pop
  )
#else

int terminate_early(numpops,numgens,pop)
  int		numpops;
  int		numgens;
  pop_struct 	*pop;
#endif
{
  return 0;
}

#ifdef ANSI_FUNC

VOID define_fitness_cases(
  int 		numpops,
  int 		numgens,
  pop_struct	*pop
     )
#else

VOID define_fitness_cases(numpops,numgens,pop)
  int 		numpops;
  int 		numgens;
  pop_struct	*pop;
#endif
{
  int	p,i;
  char	ffn[132],tfn[132];
  FILE	*f;

  printf("Enter name of fitness cases file: ");
  scanf("%s",ffn);
  printf("%s\n",ffn);
  printf("Enter name of validation test cases file: ");
  scanf("%s",tfn);
  printf("%s\n",tfn);
  load_fitness_file(ffn,&numfc,&fclabels,&fitness_cases_table,
		    &fctval, &fccval, &fct_sort_index, &fcc_sort_index,
		    &numfct, &numfcc);
  load_fitness_file(tfn,&numtc,&tclabels,&test_cases_table,
		    &tctval, &tccval, &tct_sort_index, &tcc_sort_index,
		    &numtct, &numtcc);
}

#ifdef ANSI_FUNC

VOID load_fitness_file(
	char *fn,
	int *num,
	int **labels,
	GENERIC ***table,
	GENERIC **tval,
	GENERIC **cval,
	int **tindex,
	int **cindex,
	int *numt,
	int *numc
	)
#else

VOID load_fitness_file(fn,num,labels,table,tval,cval,tindex, cindex,numt,numc)
char	*fn;
int	*num;
int	**labels;
GENERIC ***table;
GENERIC **tval, **cval;
int	**tindex, **cindex;
int	*numt, *numc;
#endif
{
  FILE	*f;
  int	i,j;

  if ((f=fopen(fn,"r")) == (FILE *) NULL) {
    fprintf(stderr,"Error: fitness file not found: %s\n",fn);
    exit(1);
  }
  fscanf(f,"%d",num);
  (*labels) = (int *) malloc(*num*sizeof(int));
  (*table) = (GENERIC **) malloc(*num*sizeof(GENERIC *));
  for ((*numt) = (*numc) = i = 0; i<*num; i++) {
    (*table)[i] = (GENERIC *) malloc(DIMENSION*sizeof(GENERIC));
    fscanf(f,"%d",&((*labels)[i]));
    (((*labels)[i]) ? (*numt)++ : (*numc)++);
    for (j=0;j<DIMENSION;j++) fscanf(f,FORMAT,&((*table)[i][j]));
  }
  (*tval) = (GENERIC *) malloc(*numt*sizeof(GENERIC));
  (*cval) = (GENERIC *) malloc(*numc*sizeof(GENERIC));
  (*tindex) = (int *) malloc(*numt*sizeof(int));
  (*cindex) = (int *) malloc(*numc*sizeof(int));
  fclose(f);
}

 ? (*numt)++ : (*numc)++);
    for (j=0;j<DIMENSION;j++) fscanf(f,FORMAT,&((*table)[i][j]));
  }
  (*tval) = (GENERIC *) malloc(*numt*sizeof(GENERIC));
  (*cval) = (GENERIC *) malloc(*numc*sizeof(GENERIC));
  (*tindex) = (int *) malloc(*numt*sizeof(int));
  (*cindex) = (int *) malloc(*numc*sizeof(int));
  fclose(f);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文字幕欧美三区| 国产成人亚洲精品青草天美| 久久精品免费看| av网站一区二区三区| 欧美精品v国产精品v日韩精品 | 一区二区三区高清| 国产一区二区精品久久99| 欧美三级电影一区| 亚洲欧美日韩久久精品| 国产69精品久久久久777| 欧美一级在线观看| 亚洲成av人片在线| 91黄色免费网站| 亚洲同性gay激情无套| 国产精品一区在线观看乱码| 日韩一级视频免费观看在线| 亚洲高清免费视频| 欧美中文字幕不卡| 一区二区三区自拍| 日本高清无吗v一区| 亚洲图片激情小说| 色呦呦国产精品| 亚洲欧美综合在线精品| 成人精品视频网站| 国产精品免费视频一区| 国产精品亚洲а∨天堂免在线| 精品理论电影在线观看 | 亚洲国产精品自拍| 91久久精品一区二区三区| 成人欧美一区二区三区视频网页| 成人理论电影网| 中文字幕亚洲一区二区av在线| 成人影视亚洲图片在线| 日韩毛片精品高清免费| 99精品久久99久久久久| 亚洲色图.com| 欧美中文字幕久久| 日韩av电影天堂| 欧美成人激情免费网| 国产精品一区一区| 国产精品久久99| 色综合久久综合网欧美综合网| 一区二区三区小说| 欧美日韩精品欧美日韩精品| 日韩精品电影在线| 久久美女艺术照精彩视频福利播放 | 国产精品蜜臀av| 一本久久综合亚洲鲁鲁五月天| 亚洲国产一区二区a毛片| 欧美顶级少妇做爰| 国产高清精品久久久久| 亚洲三级在线观看| 欧美一二三区在线| 岛国精品在线播放| 亚洲一区二区四区蜜桃| 欧美一区二区三区免费视频| 国产精品白丝jk黑袜喷水| 综合色中文字幕| 欧美一区二区大片| 不卡在线观看av| 国产91在线看| 综合激情网...| 欧美久久久久久久久| 国产一区二区在线免费观看| 亚洲欧美一区二区三区孕妇| 欧美精品免费视频| 国产福利不卡视频| 午夜精品福利一区二区三区蜜桃| 久久夜色精品国产噜噜av | 在线观看国产一区二区| 蜜桃久久精品一区二区| 亚洲欧美韩国综合色| 欧美成va人片在线观看| 日本国产一区二区| 国产91精品一区二区麻豆网站 | 视频一区二区三区中文字幕| 欧美日韩精品系列| 亚洲国产日韩精品| 色婷婷av一区二区三区之一色屋| 国产精品福利影院| 欧美一卡二卡在线| 欧美在线制服丝袜| 成人免费观看视频| 免费在线观看日韩欧美| 日韩美女久久久| 久久先锋资源网| 日韩午夜激情免费电影| 欧洲一区二区三区在线| 成人丝袜高跟foot| 国产在线视频一区二区三区| 亚洲成人av资源| 亚洲最色的网站| 综合久久综合久久| 国产片一区二区| 精品国产伦一区二区三区免费| 欧美精三区欧美精三区| 欧美视频完全免费看| 色欧美乱欧美15图片| www.视频一区| k8久久久一区二区三区| 国产成人精品免费看| 国产高清精品网站| 国产v综合v亚洲欧| 国产成人免费在线视频| 国产一区二区女| 国产一区二区三区不卡在线观看| 老司机午夜精品| 国内外成人在线| 国产一区二区剧情av在线| 国产在线不卡视频| 国产精品一线二线三线精华| 99v久久综合狠狠综合久久| 欧美视频你懂的| 免费欧美日韩国产三级电影| 亚洲成人自拍网| 亚洲不卡一区二区三区| 亚洲一级不卡视频| 亚洲第一福利一区| 丝袜脚交一区二区| 经典一区二区三区| 国产成人免费在线视频| bt欧美亚洲午夜电影天堂| hitomi一区二区三区精品| 91视视频在线观看入口直接观看www | 国产精品日韩成人| 中文字幕精品在线不卡| 一区二区三区在线播放| 国产精品麻豆一区二区| 国产一区二区三区在线看麻豆| 久久成人免费网| 高清不卡在线观看av| 99久久er热在这里只有精品15| 91污片在线观看| 欧美日韩激情一区二区三区| 这里只有精品99re| 26uuu亚洲综合色| 中文字幕日韩欧美一区二区三区| 亚洲乱码国产乱码精品精98午夜 | 久久久99久久精品欧美| 国产精品久久久久久久久免费桃花 | 免费看日韩精品| 粉嫩一区二区三区性色av| 色哟哟欧美精品| 精品国产一区二区三区四区四| 国产精品久久久久久久久免费丝袜| 亚洲精品视频在线观看网站| 蜜桃视频第一区免费观看| 成人免费视频一区二区| 欧美日韩国产大片| 欧美国产一区视频在线观看| 一区二区三区不卡视频在线观看| 久久丁香综合五月国产三级网站| 91性感美女视频| 精品国产一二三| 亚洲亚洲精品在线观看| 国产suv一区二区三区88区| 欧美日韩日日骚| 亚洲色图欧洲色图婷婷| 久久99精品久久久久久国产越南| 色婷婷av一区二区三区大白胸| 久久影院电视剧免费观看| 亚洲一区二区三区影院| 成人午夜免费电影| 精品日本一线二线三线不卡| 一区二区三区四区精品在线视频| 国产毛片精品视频| 欧美一级久久久| 亚洲大片免费看| 91原创在线视频| 国产精品久久网站| 国产一区二区毛片| 91精品欧美综合在线观看最新| 亚洲欧美二区三区| 国产99久久久精品| www国产精品av| 久久成人免费网| 91精品国产乱码久久蜜臀| 亚洲综合区在线| 色婷婷久久久久swag精品| 国产精品久久久久天堂| 国产福利一区二区三区视频在线 | 亚洲欧美日韩国产综合| 国产精品1024| 久久女同互慰一区二区三区| 日本网站在线观看一区二区三区| 在线观看日韩毛片| 一区二区三区在线免费| 91丝袜美女网| 亚洲久本草在线中文字幕| 99久久er热在这里只有精品66| 久久久久99精品一区| 国产精品资源在线| 久久久久9999亚洲精品| 国产裸体歌舞团一区二区| 久久只精品国产| 国产精品亚洲人在线观看| 久久久亚洲综合| 国产91在线观看丝袜| 中文字幕在线一区| 91视频你懂的|