⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 遗传算法的c源代码
💻 C
字号:
#define EXTERN#define TEST 0#include "genet.h"#define VERSION 	"version 4.3,  26 Jan 1989"/* 4.3 - add tab output to loop:  change to _main and psf*/#define BIG 999999main(){	int	v = 0;	int z;	Cost best = BIG;	Cost LastBest = BIG;	seed0 = 1;	k = 0;	n = 0;	optimum = MINUSINF;		printf("%s\n", VERSION);	while ( read_data() != EOF){ 	    v = 0;	    best=LastBest=BIG;		reprod = cross + inver + mutat;		initialize_population();				while (v++ < it &&  best > optimum) {# if TEST			printf("loop\t%4d", v); printf("\n");#endif			evaluate_population();						sort_population();						assign_probabilities1();						select_parents();# if TEST			print_iarray(parents); #endif			select_dead();# if TEST			print_iarray(dead);	#endif			replace_population();            			best = pp[0]->eval;			if (best < LastBest || v == it) {				printf("loop\t%4d\t", v);				print_so_far();				LastBest = best;			}		      }		print_results();		}	return(0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -