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

📄 realinit.h

📁 NSGA-II 多目标遗传算法 c语言编写
💻 H
字号:
/*This is the file which initializes the population*/void realinit(population *pop_ptr);void realinit(population *pop_ptr){  int i,j,r,d2;  float d,d1;    for (i = 0 ; i < popsize ; i++)    {       for (j = 0; j < nvar; j++)	{	  d = randomperc();	  d1 = 2*d - 1;	  /*if limits are not specified then generates any number between 	    zero and infinity*/	  if(ans != 1)	    {	      pop_ptr->ind[i].xreal[j] = 1/d1 ;	    }	  	  /*if limits are specified it generates the value in 	    range of minimum and maximum value of the variable*/	  else	    {	      pop_ptr->ind[i].xreal[j] = d*(lim_r[j][1] - lim_r[j][0])+lim_r[j][0];	    }	}      /* pop_ptr->ind_ptr = &(pop_ptr->ind[i+1]); */    }  /*pop_ptr->ind_ptr = &(pop_ptr->ind[0]); */ return;}

⌨️ 快捷键说明

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