readme-gs.cc

来自「c++编写的并行拉马克遗传算法的程序。实现分析对接程序」· CC 代码 · 共 34 行

CC
34
字号
//1.-------------------------------------------------------------------Individual *Genetic_Algorithm::selection(Population &solutions){   Individual *next_generation;#ifdef DEBUG   (void)fprintf(logFile, "gs.cc/Individual *Genetic_Algorithm::selection(Population &solutions)\n");#endif /* DEBUG */   next_generation = new Individual[solutions.num_individuals()];         			 //分配自由存储区内存,但没有施放 delete next_generation     set_worst(solutions);   switch(s_mode)   {      case Proportional:         selection_proportional(solutions, next_generation);         break;      case Tournament:         selection_tournament(solutions, next_generation);         break;      case Boltzmann:         (void)fprintf(logFile,"gs.cc/Unimplemented Selection Method - using proportional\n");         selection_proportional(solutions, next_generation);         break;      default:         (void)fprintf(logFile,"gs.cc/Unknown Selection Mode!\n");   }   return(next_generation);}//end 1.------------------------------------------------------------------------------------------//----------------------------------------------------------------------------------------------

⌨️ 快捷键说明

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