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

📄 sim.c

📁 GENETIC ALGORITHM FOR NEURAL NETWORKS ON TRANSPUTERS (Source code and Reference)
💻 C
字号:
/* Declarations of simulation features (backpropagation) */#include "defs.h"#include "sim.h"/* Parameter Handling */#define DEFMAXITER	100000#define DEFMAXERR	0.01#define DEFSEED		AUTOchar *SimOptStr() {return "g:e:s:\0";}char *SimUsage() {return 	  "Simulation Parameters:\n"  "-g <max. no. of iterations:>:     10000\n"  "-e <max. error for succes>:       0.01\n"  "-s <random seed value>:           time\n\0";}/* set default values */int MaxIter	=DEFMAXITER;	/* Maximum no. of generations */float MaxErr	=DEFMAXERR;	/* Maximum error for succes */int SeedRand	=DEFSEED;	/* random seed */int handleSimOpt(char opt,char* arg){  switch(opt)  {    case 'g': return (MaxIter 	=getint(arg,1,1000000000))<0;    case 'e': return getfloat(&MaxErr,arg,0,1000000);    case 's': return (SeedRand	=getint(arg,0,MAXRANDOM))<0;    default: return 1;  };}int initSim(){  if(SeedRand==AUTO) SeedRand=gettime();  seedrand(SeedRand);  sprintf(SimParamStr,    "Simulation: MaxIter = %d, MaxErr = %7.4f, Seed = %d\n",    MaxIter,MaxErr,SeedRand);  return 0;}

⌨️ 快捷键说明

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