CUDA.tpl 30.5 KB
Newer Older
Ogier Maitre's avatar
Ogier Maitre committed
1
\TEMPLATE_START
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#ifdef WIN32
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(lib, "libEasea.lib")
#pragma comment(lib, "Winmm.lib")
#endif
/**
 This is program entry for STD template for EASEA
*/

\ANALYSE_PARAMETERS
#include <stdlib.h>
#include <iostream>
#include <time.h>
#include "COptionParser.h"
#include "CRandomGenerator.h"
#include "CEvolutionaryAlgorithm.h"
#include "global.h"
#include "EASEAIndividual.hpp"

using namespace std;

/** Global variables for the whole algorithm */
CIndividual** pPopulation = NULL;
CIndividual* bBest = NULL;
float* pEZ_MUT_PROB = NULL;
float* pEZ_XOVER_PROB = NULL;
Frederic Kruger's avatar
Frederic Kruger committed
28 29
unsigned *EZ_NB_GEN;
unsigned *EZ_current_generation;
kruger's avatar
kruger committed
30
CEvolutionaryAlgorithm* EA;
31 32 33 34 35 36 37 38 39 40

int main(int argc, char** argv){


	parseArguments("EASEA.prm",argc,argv);

	ParametersImpl p;
	p.setDefaultParameters(argc,argv);
	CEvolutionaryAlgorithm* ea = p.newEvolutionaryAlgorithm();

kruger's avatar
kruger committed
41 42
	EA = ea;

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
	EASEAInit(argc,argv);

	CPopulation* pop = ea->getPopulation();

	ea->runEvolutionaryLoop();

	EASEAFinal(pop);

	delete pop;

#ifdef WIN32
	system("pause");
#endif
	return 0;
}

\START_CUDA_GENOME_CU_TPL
#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
#define WIN32
#endif

#include <fstream>
#ifndef WIN32
#include <sys/time.h>
#else
#include <time.h>
#endif
kruger's avatar
kruger committed
71 72
#include <string>
#include <sstream>
73 74 75 76 77 78 79 80
#include "CRandomGenerator.h"
#include "CPopulation.h"
#include "COptionParser.h"
#include "CStoppingCriterion.h"
#include "CEvolutionaryAlgorithm.h"
#include "global.h"
#include "CIndividual.h"
#include <vector_types.h>
Ogier Maitre's avatar
1.09rc2  
Ogier Maitre committed
81
#include "CCuda.h"
82 83 84


using namespace std;
85
extern "C" __global__ void cudaEvaluatePopulation(void* d_population, unsigned popSize, float* d_fitnesses);
86 87 88 89
#include "EASEAIndividual.hpp"
bool INSTEAD_EVAL_STEP = false;

CRandomGenerator* globalRandomGenerator;
kruger's avatar
kruger committed
90
extern CEvolutionaryAlgorithm *EA;
91 92 93

#define CUDA_TPL

Ogier Maitre's avatar
Ogier Maitre committed
94
struct gpuEvaluationData* gpuData;
95

Ogier Maitre's avatar
Ogier Maitre committed
96 97 98
int fstGpu = 0;
int lstGpu = 0;

99

Ogier Maitre's avatar
Ogier Maitre committed
100
struct gpuEvaluationData* globalGpuData;
101 102 103 104 105 106 107 108 109 110 111 112 113
float* fitnessTemp;  
bool freeGPU = false;
bool first_generation = true;
int num_gpus = 0;       // number of CUDA GPUs

PopulationImpl* Pop = NULL;

\INSERT_USER_DECLARATIONS
\ANALYSE_USER_CLASSES


\INSERT_USER_FUNCTIONS

Ogier Maitre's avatar
Ogier Maitre committed
114

Ogier Maitre's avatar
Ogier Maitre committed
115
void dispatchPopulation(int populationSize){
Ogier Maitre's avatar
Ogier Maitre committed
116 117 118 119 120 121 122 123 124 125 126 127
  int noTotalMP = 0; // number of MP will be used to distribute the population
  int count = 0;

  //Recuperation of each device information's.
  for( int index = 0; index < num_gpus; index++){
    cudaDeviceProp deviceProp;
    cudaError_t lastError = cudaGetDeviceProperties(&deviceProp, index+fstGpu);
    if( lastError!=cudaSuccess ){
      std::cerr << "Cannot get device information for device no : " << index+fstGpu << std::endl;
      exit(-1);
    }

Ogier Maitre's avatar
Ogier Maitre committed
128 129 130 131
    globalGpuData[index].num_MP =  deviceProp.multiProcessorCount; 
    globalGpuData[index].num_Warp = deviceProp.warpSize;
    noTotalMP += globalGpuData[index].num_MP;
    globalGpuData[index].gpuProp = deviceProp;
Ogier Maitre's avatar
Ogier Maitre committed
132 133 134 135
  }

  for( int index = 0; index < num_gpus; index++){

Ogier Maitre's avatar
Ogier Maitre committed
136
    globalGpuData[index].indiv_start = count;
Ogier Maitre's avatar
Ogier Maitre committed
137

Ogier Maitre's avatar
Ogier Maitre committed
138 139 140 141
    if(index != (num_gpus - 1)) {
      globalGpuData[index].sh_pop_size = ceil((float)populationSize * (((float)globalGpuData[index].num_MP) / (float)noTotalMP) );
    
    }
Ogier Maitre's avatar
Ogier Maitre committed
142 143
    //On the last card we are going to place the remaining individuals.  
    else 
Ogier Maitre's avatar
Ogier Maitre committed
144
      globalGpuData[index].sh_pop_size = populationSize - count;
Ogier Maitre's avatar
Ogier Maitre committed
145
	     
Ogier Maitre's avatar
Ogier Maitre committed
146
    count += globalGpuData[index].sh_pop_size;	     
Ogier Maitre's avatar
Ogier Maitre committed
147
  }
Ogier Maitre's avatar
Ogier Maitre committed
148 149 150 151
}

void cudaPreliminaryProcess(struct gpuEvaluationData* localGpuData, int populationSize){

Ogier Maitre's avatar
Ogier Maitre committed
152 153 154 155

  //  here we will compute how to spread the population to evaluate on GPGPU cores

  struct cudaFuncAttributes attr;
156
  CUDA_SAFE_CALL(cudaFuncGetAttributes(&attr,cudaEvaluatePopulation));
Ogier Maitre's avatar
Ogier Maitre committed
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180

  int thLimit = attr.maxThreadsPerBlock;
  int N = localGpuData->sh_pop_size;
  int w = localGpuData->gpuProp.warpSize;

  int b=0,t=0;
	      
  do{
    b += localGpuData->num_MP;
    t = ceilf( MIN(thLimit,(float)N/b)/w)*w;
  } while( (b*t<N) || t>thLimit );
	      
  if( localGpuData->d_population!=NULL ){ cudaFree(localGpuData->d_population); }
  if( localGpuData->d_fitness!=NULL ){ cudaFree(localGpuData->d_fitness); }

  CUDA_SAFE_CALL(cudaMalloc(&localGpuData->d_population,localGpuData->sh_pop_size*(sizeof(IndividualImpl))));
  CUDA_SAFE_CALL(cudaMalloc(((void**)&localGpuData->d_fitness),localGpuData->sh_pop_size*sizeof(float)));


  std::cout << "card (" << localGpuData->threadId << ") " << localGpuData->gpuProp.name << " has " << localGpuData->sh_pop_size << " individual to evaluate" 
	    << ": t=" << t << " b: " << b << std::endl;
   localGpuData->dimGrid = b;
   localGpuData->dimBlock = t;

181 182
}

Frederic Kruger's avatar
Frederic Kruger committed
183
__device__ __host__ inline IndividualImpl* INDIVIDUAL_ACCESS(void* buffer,unsigned id){
184 185 186
  return (IndividualImpl*)buffer+id;
}

Ogier Maitre's avatar
Ogier Maitre committed
187
__device__ float cudaEvaluate(void* devBuffer, unsigned id){
188 189 190 191
  \INSERT_CUDA_EVALUATOR
}
  

Ogier Maitre's avatar
Ogier Maitre committed
192
extern "C" 
Ogier Maitre's avatar
Ogier Maitre committed
193
__global__ void cudaEvaluatePopulation(void* d_population, unsigned popSize, float* d_fitnesses){
194

Frederic Kruger's avatar
Frederic Kruger committed
195
        unsigned id = (blockDim.x*blockIdx.x)+threadIdx.x;  // id of the individual computed by this thread
196 197 198 199 200

  	// escaping for the last block
        if( id >= popSize ) return;
  
        //void* indiv = ((char*)d_population)+id*(\GENOME_SIZE+sizeof(IndividualImpl*)); // compute the offset of the current individual
Ogier Maitre's avatar
Ogier Maitre committed
201
        d_fitnesses[id] = cudaEvaluate(d_population,id);
202 203 204 205 206 207 208
}



void* gpuThreadMain(void* arg){

  cudaError_t lastError;
Ogier Maitre's avatar
Ogier Maitre committed
209 210
  struct gpuEvaluationData* localGpuData = (struct gpuEvaluationData*)arg;
  //std::cout << " gpuId : " << localGpuData->gpuId << std::endl;
Ogier Maitre's avatar
Ogier Maitre committed
211 212 213

  lastError = cudaSetDevice(localGpuData->gpuId);

Ogier Maitre's avatar
Ogier Maitre committed
214
  if( lastError != cudaSuccess ){
Ogier Maitre's avatar
Ogier Maitre committed
215
    std::cerr << "Error, cannot set device properly for device no " << localGpuData->gpuId << std::endl;
Ogier Maitre's avatar
Ogier Maitre committed
216 217 218
    exit(-1);
  }
  
219 220
  int nbr_cudaPreliminaryProcess = 2;

Ogier Maitre's avatar
Ogier Maitre committed
221
  //struct my_struct_gpu* localGpuInfo = gpu_infos+localArg->threadId;
Ogier Maitre's avatar
Ogier Maitre committed
222 223 224


  if( lastError != cudaSuccess ){
Ogier Maitre's avatar
Ogier Maitre committed
225
    std::cerr << "Error, cannot get function attribute for cudaEvaluatePopulation on card: " << localGpuData->gpuProp.name  << std::endl;
Ogier Maitre's avatar
Ogier Maitre committed
226 227 228
    exit(-1);
  }
  
229 230 231 232 233
  // Because of the context of each GPU thread, we have to put all user's CUDA 
  // initialisation here if we want to use them in the GPU, otherwise they are
  // not found in the GPU context
  \INSERT_USER_CUDA

234 235
  // Wait for population to evaluate
   while(1){
Ogier Maitre's avatar
Ogier Maitre committed
236 237
	    sem_wait(&localGpuData->sem_in);

238
	    if( freeGPU ) {
Ogier Maitre's avatar
Ogier Maitre committed
239 240 241
	      // do we need to free gpu memory ?
	      cudaFree(localGpuData->d_fitness);
	      cudaFree(localGpuData->d_population);
Ogier Maitre's avatar
Ogier Maitre committed
242
	      break;
243
	    }
Ogier Maitre's avatar
Ogier Maitre committed
244

Ogier Maitre's avatar
Ogier Maitre committed
245
	    if(nbr_cudaPreliminaryProcess > 0) {
Ogier Maitre's avatar
Ogier Maitre committed
246
	      
Ogier Maitre's avatar
Ogier Maitre committed
247 248 249 250 251
	      if( nbr_cudaPreliminaryProcess==2 ) 
		cudaPreliminaryProcess(localGpuData,EA->population->parentPopulationSize);
	      else {
		cudaPreliminaryProcess(localGpuData,EA->population->offspringPopulationSize);
	      }
Ogier Maitre's avatar
Ogier Maitre committed
252 253
	      nbr_cudaPreliminaryProcess--;

Ogier Maitre's avatar
Ogier Maitre committed
254
	      if( localGpuData->dimBlock*localGpuData->dimGrid!=localGpuData->sh_pop_size ){
Ogier Maitre's avatar
Ogier Maitre committed
255 256
		// due to lack of individuals, the population distribution is not optimial according to core organisation
		// warn the user and propose a proper configuration
Ogier Maitre's avatar
Ogier Maitre committed
257 258
		std::cerr << "Warning, population distribution is not optimial, consider adding " << (localGpuData->dimBlock*localGpuData->dimGrid-localGpuData->sh_pop_size) 
			  << " individuals to " << (nbr_cudaPreliminaryProcess==2?"parent":"offspring")<<" population" << std::endl;
Ogier Maitre's avatar
Ogier Maitre committed
259 260
	      }
            }
Ogier Maitre's avatar
Ogier Maitre committed
261 262
	    
	    // transfer data to GPU memory
Ogier Maitre's avatar
Ogier Maitre committed
263
            lastError = cudaMemcpy(localGpuData->d_population,(IndividualImpl*)(Pop->cudaBuffer)+localGpuData->indiv_start,
Ogier Maitre's avatar
Ogier Maitre committed
264 265 266
				   (sizeof(IndividualImpl)*localGpuData->sh_pop_size),cudaMemcpyHostToDevice);

	    CUDA_SAFE_CALL(lastError);
Ogier Maitre's avatar
Ogier Maitre committed
267 268 269
	    
	    
	    //std::cout << localGpuData->sh_pop_size << ";" << localGpuData->dimGrid << ";"<<  localGpuData->dimBlock << std::endl;
270
				      
Ogier Maitre's avatar
Ogier Maitre committed
271
	    // the real GPU computation (kernel launch)
Ogier Maitre's avatar
Ogier Maitre committed
272
	    cudaEvaluatePopulation<<< localGpuData->dimGrid, localGpuData->dimBlock>>>(localGpuData->d_population, localGpuData->sh_pop_size, localGpuData->d_fitness);
Ogier Maitre's avatar
Ogier Maitre committed
273 274 275
	    lastError = cudaGetLastError();
	    CUDA_SAFE_CALL(lastError);

Ogier Maitre's avatar
Ogier Maitre committed
276 277 278
	    if( cudaGetLastError()!=cudaSuccess ){ std::cerr << "Error during synchronize" << std::endl; }

	    // be sure the GPU has finished computing evaluations, and get results to CPU
279
	    lastError = cudaThreadSynchronize();
Ogier Maitre's avatar
Ogier Maitre committed
280
	    if( lastError!=cudaSuccess ){ std::cerr << "Error during synchronize" << std::endl; }
Ogier Maitre's avatar
Ogier Maitre committed
281
	    lastError = cudaMemcpy(fitnessTemp + localGpuData->indiv_start, localGpuData->d_fitness, localGpuData->sh_pop_size*sizeof(float), cudaMemcpyDeviceToHost);
282
	    
Ogier Maitre's avatar
Ogier Maitre committed
283
	    // this thread has finished its phase, so lets tell it to the main thread
Ogier Maitre's avatar
Ogier Maitre committed
284
	    sem_post(&localGpuData->sem_out);
285
   }
Ogier Maitre's avatar
Ogier Maitre committed
286
  sem_post(&localGpuData->sem_out);
287 288 289 290 291 292
  fflush(stdout);
  return NULL;
}
				
void wake_up_gpu_thread(){
	for( int i=0 ; i<num_gpus ; i++ ){
Ogier Maitre's avatar
Ogier Maitre committed
293
		sem_post(&(globalGpuData[i].sem_in));
Ogier Maitre's avatar
Ogier Maitre committed
294 295 296
	
  	}
	for( int i=0 ; i<num_gpus ; i++ ){
Ogier Maitre's avatar
Ogier Maitre committed
297
	  sem_wait(&globalGpuData[i].sem_out);
298
  	}
Ogier Maitre's avatar
Ogier Maitre committed
299

300 301 302 303
}
				
void InitialiseGPUs(){
	//MultiGPU part on one CPU
Ogier Maitre's avatar
Ogier Maitre committed
304
	globalGpuData = (struct gpuEvaluationData*)malloc(sizeof(struct gpuEvaluationData)*num_gpus);
305
	pthread_t* t = (pthread_t*)malloc(sizeof(pthread_t)*num_gpus);
Ogier Maitre's avatar
Ogier Maitre committed
306
	int gpuId = fstGpu;
307 308
	//here we want to create on thread per GPU
	for( int i=0 ; i<num_gpus ; i++ ){
Ogier Maitre's avatar
Ogier Maitre committed
309
	  
Ogier Maitre's avatar
Ogier Maitre committed
310 311
		globalGpuData[i].d_fitness = NULL;
		globalGpuData[i].d_population = NULL;
Ogier Maitre's avatar
Ogier Maitre committed
312
		
Ogier Maitre's avatar
Ogier Maitre committed
313
		globalGpuData[i].gpuId = gpuId++;
Ogier Maitre's avatar
Ogier Maitre committed
314

Ogier Maitre's avatar
Ogier Maitre committed
315 316 317 318
	  	globalGpuData[i].threadId = i;
	  	sem_init(&globalGpuData[i].sem_in,0,0);
	  	sem_init(&globalGpuData[i].sem_out,0,0);
	  	if( pthread_create(t+i,NULL,gpuThreadMain,globalGpuData+i) ){ perror("pthread_create : "); }
319 320 321 322 323 324 325 326 327 328 329
	}
}

\INSERT_INITIALISATION_FUNCTION
\INSERT_FINALIZATION_FUNCTION

void evale_pop_chunk(CIndividual** population, int popSize){
  \INSTEAD_EVAL_FUNCTION
}

void EASEAInit(int argc, char** argv){
Ogier Maitre's avatar
Ogier Maitre committed
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
  fstGpu = setVariable("fstgpu",0);
  lstGpu = setVariable("lstgpu",0);

	if( lstGpu==fstGpu && fstGpu==0 ){
	  // use all gpus available
	  cudaGetDeviceCount(&num_gpus);
	}
	else{
	  int queryGpuNum;
	  cudaGetDeviceCount(&queryGpuNum);
	  if( (lstGpu - fstGpu)>queryGpuNum || fstGpu<0 || lstGpu>queryGpuNum){
	    std::cerr << "Error, not enough devices found on the system ("<< queryGpuNum <<") to satisfy user configuration ["<<fstGpu<<","<<lstGpu<<"["<<std::endl;
	    exit(-1);
	  }
	  else{
	    num_gpus = lstGpu-fstGpu;
	  }
	}

Ogier Maitre's avatar
Ogier Maitre committed
349
	//globalGpuData = (struct gpuEvaluationData*)malloc(sizeof(struct gpuEvaluationData)*num_gpus);
350 351 352 353 354 355 356
	InitialiseGPUs();
	\INSERT_INIT_FCT_CALL
}

void EASEAFinal(CPopulation* pop){
	freeGPU=true;
	wake_up_gpu_thread();
Ogier Maitre's avatar
Ogier Maitre committed
357
        free(globalGpuData);
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
	
	\INSERT_FINALIZATION_FCT_CALL;
}

void AESAEBeginningGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm){
	\INSERT_BEGIN_GENERATION_FUNCTION
}

void AESAEEndGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm){
	\INSERT_END_GENERATION_FUNCTION
}

void AESAEGenerationFunctionBeforeReplacement(CEvolutionaryAlgorithm* evolutionaryAlgorithm){
        \INSERT_GENERATION_FUNCTION_BEFORE_REPLACEMENT
}


IndividualImpl::IndividualImpl() : CIndividual() {
  \GENOME_CTOR 
  \INSERT_EO_INITIALISER
  valid = false;
Frédéric Krüger's avatar
Frédéric Krüger committed
379
  isImmigrant = false;
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
}

CIndividual* IndividualImpl::clone(){
	return new IndividualImpl(*this);
}

IndividualImpl::~IndividualImpl(){
  \GENOME_DTOR
}


float IndividualImpl::evaluate(){
  if(valid)
    return fitness;
  else{
    valid = true;
    \INSERT_EVALUATOR
  }
}

Frederic Kruger's avatar
Frederic Kruger committed
400 401 402 403 404
void IndividualImpl::boundChecking(){
        \INSERT_BOUND_CHECKING
}


kruger's avatar
kruger committed
405 406 407
string IndividualImpl::serialize(){
    ostringstream AESAE_Line(ios_base::app);
    \GENOME_SERIAL
408
    AESAE_Line << this->fitness;
kruger's avatar
kruger committed
409 410 411 412 413 414 415
    return AESAE_Line.str();
}

void IndividualImpl::deserialize(string Line){
    istringstream AESAE_Line(Line);
    string line;
    \GENOME_DESERIAL
416 417
    AESAE_Line >> this->fitness;
    this->valid=true;
Frédéric Krüger's avatar
Frédéric Krüger committed
418
    this->isImmigrant=false;
kruger's avatar
kruger committed
419 420
}

421 422 423 424 425 426 427 428 429 430 431
IndividualImpl::IndividualImpl(const IndividualImpl& genome){

  // ********************
  // Problem specific part
  \COPY_CTOR


  // ********************
  // Generic part
  this->valid = genome.valid;
  this->fitness = genome.fitness;
Frédéric Krüger's avatar
Frédéric Krüger committed
432
  this->isImmigrant = false;
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
}


CIndividual* IndividualImpl::crossover(CIndividual** ps){
	// ********************
	// Generic part
	IndividualImpl** tmp = (IndividualImpl**)ps;
	IndividualImpl parent1(*this);
	IndividualImpl parent2(*tmp[0]);
	IndividualImpl child(*this);

	//DEBUG_PRT("Xover");
	/*   cout << "p1 : " << parent1 << endl; */
	/*   cout << "p2 : " << parent2 << endl; */

	// ********************
	// Problem specific part
  	\INSERT_CROSSOVER


	child.valid = false;
	/*   cout << "child : " << child << endl; */
	return new IndividualImpl(child);
}


void IndividualImpl::printOn(std::ostream& os) const{
	\INSERT_DISPLAY
}

std::ostream& operator << (std::ostream& O, const IndividualImpl& B)
{
  // ********************
  // Problem specific part
  O << "\nIndividualImpl : "<< std::endl;
  O << "\t\t\t";
  B.printOn(O);

  if( B.valid ) O << "\t\t\tfitness : " << B.fitness;
  else O << "fitness is not yet computed" << std::endl;
  return O;
}


Frederic Kruger's avatar
Frederic Kruger committed
477
unsigned IndividualImpl::mutate( float pMutationPerGene ){
478 479 480 481 482 483 484 485 486 487
  this->valid=false;


  // ********************
  // Problem specific part
  \INSERT_MUTATOR
}


void PopulationImpl::evaluateParentPopulation(){
Frederic Kruger's avatar
Frederic Kruger committed
488
        unsigned actualPopulationSize = this->actualParentPopulationSize;
489 490
	fitnessTemp = new float[actualPopulationSize];
	int index;
Ogier Maitre's avatar
Ogier Maitre committed
491 492 493 494 495 496 497
	static bool dispatchedParents = false;
	
	if( dispatchedParents==false ){
	  dispatchPopulation(EA->population->parentPopulationSize);
	  dispatchedParents=true;
	}

498 499 500 501 502 503 504 505 506 507 508 509 510 511
	       	
 	wake_up_gpu_thread(); 

 	
	for( index=(actualPopulationSize-1); index>=0; index--){
		this->parents[index]->fitness = fitnessTemp[index];
		this->parents[index]->valid = true;
	}  

        delete[](fitnessTemp);

}

void PopulationImpl::evaluateOffspringPopulation(){
Frederic Kruger's avatar
Frederic Kruger committed
512
	unsigned actualPopulationSize = this->actualOffspringPopulationSize;
513 514
	fitnessTemp = new float[actualPopulationSize];
	int index;
Ogier Maitre's avatar
Ogier Maitre committed
515 516 517 518 519 520
	static bool dispatchedOffspring = false;
	
	if( dispatchedOffspring==false ){
	  dispatchPopulation(EA->population->offspringPopulationSize);
	  dispatchedOffspring=true;
	}
521 522

        for( index=(actualPopulationSize-1); index>=0; index--)
Ogier Maitre's avatar
Ogier Maitre committed
523
	    ((IndividualImpl*)this->offsprings[index])->copyToCudaBuffer(this->cudaBuffer,index);
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539

        wake_up_gpu_thread(); 

	for( index=(actualPopulationSize-1); index>=0; index--){
		this->offsprings[index]->fitness = fitnessTemp[index];
		this->offsprings[index]->valid = true;
	}	  
 
        first_generation = false;
        delete[](fitnessTemp);
}





kruger's avatar
kruger committed
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601
void ParametersImpl::setDefaultParameters(int argc, char** argv){
        this->minimizing = \MINIMAXI;
        this->nbGen = setVariable("nbGen",(int)\NB_GEN);

        seed = setVariable("seed",(int)time(0));
        globalRandomGenerator = new CRandomGenerator(seed);
        this->randomGenerator = globalRandomGenerator;

        selectionOperator = getSelectionOperator(setVariable("selectionOperator","\SELECTOR_OPERATOR"), this->minimizing, globalRandomGenerator);
        replacementOperator = getSelectionOperator(setVariable("reduceFinalOperator","\RED_FINAL_OPERATOR"),this->minimizing, globalRandomGenerator);
        parentReductionOperator = getSelectionOperator(setVariable("reduceParentsOperator","\RED_PAR_OPERATOR"),this->minimizing, globalRandomGenerator);
        offspringReductionOperator = getSelectionOperator(setVariable("reduceOffspringOperator","\RED_OFF_OPERATOR"),this->minimizing, globalRandomGenerator);
        selectionPressure = setVariable("selectionPressure",(float)\SELECT_PRM);
        replacementPressure = setVariable("reduceFinalPressure",(float)\RED_FINAL_PRM);
        parentReductionPressure = setVariable("reduceParentsPressure",(float)\RED_PAR_PRM);
        offspringReductionPressure = setVariable("reduceOffspringPressure",(float)\RED_OFF_PRM);
        pCrossover = \XOVER_PROB;
        pMutation = \MUT_PROB;
        pMutationPerGene = 0.05;

        parentPopulationSize = setVariable("popSize",(int)\POP_SIZE);
        offspringPopulationSize = setVariable("nbOffspring",(int)\OFF_SIZE);


        parentReductionSize = setReductionSizes(parentPopulationSize, setVariable("survivingParents",(float)\SURV_PAR_SIZE));
        offspringReductionSize = setReductionSizes(offspringPopulationSize, setVariable("survivingOffspring",(float)\SURV_OFF_SIZE));

        this->elitSize = setVariable("elite",(int)\ELITE_SIZE);
        this->strongElitism = setVariable("eliteType",(int)\ELITISM);

        if((this->parentReductionSize + this->offspringReductionSize) < this->parentPopulationSize){
                printf("*WARNING* parentReductionSize + offspringReductionSize < parentPopulationSize\n");
                printf("*WARNING* change Sizes in .prm or .ez\n");
                printf("EXITING\n");
                exit(1);
        }
        if((this->parentPopulationSize - this->parentReductionSize)>this->parentPopulationSize-this->elitSize){
                printf("*WARNING* parentPopulationSize - parentReductionSize > parentPopulationSize - elitSize\n");
                printf("*WARNING* change Sizes in .prm or .ez\n");
                printf("EXITING\n");
                exit(1);
        }
        if(!this->strongElitism && ((this->offspringPopulationSize - this->offspringReductionSize)>this->offspringPopulationSize-this->elitSize)){
                printf("*WARNING* offspringPopulationSize - offspringReductionSize > offspringPopulationSize - elitSize\n");
                printf("*WARNING* change Sizes in .prm or .ez\n");
                printf("EXITING\n");
                exit(1);
        }
        if(offspringReductionSize<offspringPopulationSize) offspringReduction = true;
        else offspringReduction = false;

        if(parentReductionSize<parentPopulationSize) parentReduction = true;
        else parentReduction = false;

        generationalCriterion = new CGenerationalCriterion(setVariable("nbGen",(int)\NB_GEN));
        controlCStopingCriterion = new CControlCStopingCriterion();
        timeCriterion = new CTimeCriterion(setVariable("timeLimit",\TIME_LIMIT));

	this->optimise=0;

        this->printStats = setVariable("printStats",\PRINT_STATS);
        this->generateCSVFile = setVariable("generateCSVFile",\GENERATE_CSV_FILE);
Frédéric Krüger's avatar
Frédéric Krüger committed
602
        this->generatePlotScript = setVariable("generatePlotScript",\GENERATE_GNUPLOT_SCRIPT);
kruger's avatar
kruger committed
603 604 605 606 607 608 609 610 611 612 613
        this->generateRScript = setVariable("generateRScript",\GENERATE_R_SCRIPT);
        this->plotStats = setVariable("plotStats",\PLOT_STATS);
	this->printInitialPopulation = setVariable("printInitialPopulation",0);
	this->printFinalPopulation = setVariable("printFinalPopulation",0);
	this->savePopulation = setVariable("savePopulation",\SAVE_POPULATION);
	this->startFromFile = setVariable("startFromFile",\START_FROM_FILE);

        this->outputFilename = (char*)"EASEA";
        this->plotOutputFilename = (char*)"EASEA.png";

	this->remoteIslandModel = setVariable("remoteIslandModel",\REMOTE_ISLAND_MODEL);
Joseph Pallamidessi's avatar
Joseph Pallamidessi committed
614 615 616 617
	std::string* ipFilename=new std::string();
	*ipFilename=setVariable("ipFile","\IP_FILE");
	
	this->ipFile =(char*)ipFilename->c_str();
Frédéric Krüger's avatar
Frédéric Krüger committed
618 619
    this->migrationProbability = setVariable("migrationProbability",(float)\MIGRATION_PROBABILITY);
    this->serverPort = setVariable("serverPort",\SERVER_PORT);
kruger's avatar
kruger committed
620

621 622 623 624 625 626
}

CEvolutionaryAlgorithm* ParametersImpl::newEvolutionaryAlgorithm(){

	pEZ_MUT_PROB = &pMutationPerGene;
	pEZ_XOVER_PROB = &pCrossover;
Frederic Kruger's avatar
Frederic Kruger committed
627
	EZ_NB_GEN = (unsigned*)setVariable("nbGen",\NB_GEN);
628 629 630 631 632 633 634 635 636 637 638 639 640 641
	EZ_current_generation=0;

	CEvolutionaryAlgorithm* ea = new EvolutionaryAlgorithmImpl(this);
	generationalCriterion->setCounterEa(ea->getCurrentGenerationPtr());
	 ea->addStoppingCriterion(generationalCriterion);
	ea->addStoppingCriterion(controlCStopingCriterion);
	ea->addStoppingCriterion(timeCriterion);

	  EZ_NB_GEN=((CGenerationalCriterion*)ea->stoppingCriteria[0])->getGenerationalLimit();
	  EZ_current_generation=&(ea->currentGeneration);

	 return ea;
}

Frederic Kruger's avatar
Frederic Kruger committed
642
inline void IndividualImpl::copyToCudaBuffer(void* buffer, unsigned id){
643 644 645 646 647 648 649 650 651
  
 memcpy(((IndividualImpl*)buffer)+id,this,sizeof(IndividualImpl)); 
  
}

void EvolutionaryAlgorithmImpl::initializeParentPopulation(){
    //DEBUG_PRT("Creation of %lu/%lu parents (other could have been loaded from input file)",this->params->parentPopulationSize-this->params->actualParentPopulationSize,this->params->parentPopulationSize);
    int index,Size = this->params->parentPopulationSize;
    
kruger's avatar
kruger committed
652 653 654 655 656 657 658
    if(this->params->startFromFile){
          ifstream AESAE_File("EASEA.pop");
          string AESAE_Line;
          for( index=(Size-1); index>=0; index--) {
             getline(AESAE_File, AESAE_Line);
            this->population->addIndividualParentPopulation(new IndividualImpl(),index);
            ((IndividualImpl*)this->population->parents[index])->deserialize(AESAE_Line);
Ogier Maitre's avatar
Ogier Maitre committed
659
            ((IndividualImpl*)this->population->parents[index])->copyToCudaBuffer(((PopulationImpl*)this->population)->cudaBuffer,index);
kruger's avatar
kruger committed
660 661 662 663 664 665
         }

        }
        else{
                for( index=(Size-1); index>=0; index--) {
                         this->population->addIndividualParentPopulation(new IndividualImpl(),index);
Ogier Maitre's avatar
Ogier Maitre committed
666
                        ((IndividualImpl*)this->population->parents[index])->copyToCudaBuffer(((PopulationImpl*)this->population)->cudaBuffer,index);
kruger's avatar
kruger committed
667 668
                }
    }
669 670 671 672 673 674 675
    
    this->population->actualOffspringPopulationSize = 0;
    this->population->actualParentPopulationSize = Size;
}


EvolutionaryAlgorithmImpl::EvolutionaryAlgorithmImpl(Parameters* params) : CEvolutionaryAlgorithm(params){
Ogier Maitre's avatar
Ogier Maitre committed
676 677

  // warning cstats parameter is null
678 679 680 681 682
  this->population = (CPopulation*)new
  PopulationImpl( this->params->parentPopulationSize,this->params->offspringPopulationSize,
                  this->params->pCrossover,this->params->pMutation,this->params->pMutationPerGene,
                  this->params->randomGenerator,this->params,this->cstats);

Ogier Maitre's avatar
Ogier Maitre committed
683 684 685 686 687
  int popSize = (params->parentPopulationSize>params->offspringPopulationSize?params->parentPopulationSize:params->offspringPopulationSize);
  ((PopulationImpl*)this->population)->cudaBuffer = (void*)malloc(sizeof(IndividualImpl)*( popSize ));
  
  // = new CCuda(params->parentPopulationSize, params->offspringPopulationSize, sizeof(IndividualImpl));
  Pop = ((PopulationImpl*)this->population);
688 689 690 691 692 693
}

EvolutionaryAlgorithmImpl::~EvolutionaryAlgorithmImpl(){

}

Ogier Maitre's avatar
Ogier Maitre committed
694
PopulationImpl::PopulationImpl(unsigned parentPopulationSize, unsigned offspringPopulationSize, float pCrossover, float pMutation, float pMutationPerGene, CRandomGenerator* rg, Parameters* params, CStats* stats) : CPopulation(parentPopulationSize, offspringPopulationSize, pCrossover, pMutation, pMutationPerGene, rg, params, stats){
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711
	;
}

PopulationImpl::~PopulationImpl(){
}


\START_CUDA_GENOME_H_TPL

#ifndef PROBLEM_DEP_H
#define PROBLEM_DEP_H

//#include "CRandomGenerator.h"
#include <stdlib.h>
#include <iostream>
#include <CIndividual.h>
#include <Parameters.h>
kruger's avatar
kruger committed
712
#include <string>
Ogier Maitre's avatar
Ogier Maitre committed
713
#include <CStats.h>
kruger's avatar
kruger committed
714 715 716

using namespace std;

717 718 719 720 721 722 723 724 725
class CRandomGenerator;
class CSelectionOperator;
class CGenerationalCriterion;
class CEvolutionaryAlgorithm;
class CPopulation;
class Parameters;
class CCuda;


726
\INSERT_USER_CLASSES
727 728 729 730 731 732 733 734 735 736 737 738 739

class IndividualImpl : public CIndividual {

public: // in EASEA the genome is public (for user functions,...)
	// Class members
  	\INSERT_GENOME


public:
	IndividualImpl();
	IndividualImpl(const IndividualImpl& indiv);
	virtual ~IndividualImpl();
	float evaluate();
Frederic Kruger's avatar
Frederic Kruger committed
740
	static unsigned getCrossoverArrity(){ return 2; }
741 742 743 744 745
	float getFitness(){ return this->fitness; }
	CIndividual* crossover(CIndividual** p2);
	void printOn(std::ostream& O) const;
	CIndividual* clone();

Frederic Kruger's avatar
Frederic Kruger committed
746
	unsigned mutate(float pMutationPerGene);
Frederic Kruger's avatar
Frederic Kruger committed
747 748 749

	void boundChecking();

kruger's avatar
kruger committed
750 751
	string serialize();
	void deserialize(string AESAE_Line);
Frederic Kruger's avatar
Frederic Kruger committed
752
	void copyToCudaBuffer(void* buffer, unsigned id);
753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785

	friend std::ostream& operator << (std::ostream& O, const IndividualImpl& B) ;
	void initRandomGenerator(CRandomGenerator* rg){ IndividualImpl::rg = rg;}
};


class ParametersImpl : public Parameters {
public:
	void setDefaultParameters(int argc, char** argv);
	CEvolutionaryAlgorithm* newEvolutionaryAlgorithm();
};

/**
 * @TODO ces functions devraient s'appeler weierstrassInit, weierstrassFinal etc... (en gros EASEAFinal dans le tpl).
 *
 */

void EASEAInit(int argc, char** argv);
void EASEAFinal(CPopulation* pop);
void EASEABeginningGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm);
void EASEAEndGenerationFunction(CEvolutionaryAlgorithm* evolutionaryAlgorithm);
void EASEAGenerationFunctionBeforeReplacement(CEvolutionaryAlgorithm* evolutionaryAlgorithm);


class EvolutionaryAlgorithmImpl: public CEvolutionaryAlgorithm {
public:
	EvolutionaryAlgorithmImpl(Parameters* params);
	virtual ~EvolutionaryAlgorithmImpl();
	void initializeParentPopulation();
};

class PopulationImpl: public CPopulation {
public:
Ogier Maitre's avatar
Ogier Maitre committed
786 787 788
  //CCuda *cuda;
  void* cudaBuffer;

789
public:
Ogier Maitre's avatar
Ogier Maitre committed
790
  PopulationImpl(unsigned parentPopulationSize, unsigned offspringPopulationSize, float pCrossover, float pMutation, float pMutationPerGene, CRandomGenerator* rg, Parameters* params, CStats* stats);
791 792 793 794 795 796 797 798
        virtual ~PopulationImpl();
        void evaluateParentPopulation();
	void evaluateOffspringPopulation();
};

#endif /* PROBLEM_DEP_H */

\START_CUDA_MAKEFILE_TPL
kruger's avatar
kruger committed
799 800
NVCC= nvcc
CPPC= g++
801 802
LIBAESAE=$(EZ_PATH)libeasea/
CXXFLAGS+=-g -Wall -O2 -I$(LIBAESAE)include -I$(EZ_PATH)boost
Ogier Maitre's avatar
Ogier Maitre committed
803
LDFLAGS=$(EZ_PATH)boost/program_options.a $(LIBAESAE)libeasea.a -lpthread 
kruger's avatar
kruger committed
804 805 806 807 808 809 810 811 812 813 814 815 816 817



EASEA_SRC= EASEAIndividual.cpp
EASEA_MAIN_HDR= EASEA.cpp
EASEA_UC_HDR= EASEAIndividual.hpp

EASEA_HDR= $(EASEA_SRC:.cpp=.hpp) 

SRC= $(EASEA_SRC) $(EASEA_MAIN_HDR)
CUDA_SRC = EASEAIndividual.cu
HDR= $(EASEA_HDR) $(EASEA_UC_HDR)
OBJ= $(EASEA_SRC:.cpp=.o) $(EASEA_MAIN_HDR:.cpp=.o)

Ogier Maitre's avatar
Ogier Maitre committed
818 819 820
#USER MAKEFILE OPTIONS :
\INSERT_MAKEFILE_OPTION#END OF USER MAKEFILE OPTIONS

Ogier Maitre's avatar
Ogier Maitre committed
821 822
CPPFLAGS+= -I$(LIBAESAE)include -I$(EZ_PATH)boost -I/usr/local/cuda/include/
NVCCFLAGS+= #--ptxas-options="-v"# --gpu-architecture sm_23 --compiler-options -fpermissive 
Ogier Maitre's avatar
Ogier Maitre committed
823 824


kruger's avatar
kruger committed
825 826 827 828 829
BIN= EASEA
  
all:$(BIN)

$(BIN):$(OBJ)
830
	$(NVCC) $^ -o $@ $(LDFLAGS) -Xcompiler -fopenmp
kruger's avatar
kruger committed
831 832

%.o:%.cu
833
	$(NVCC) $(NVCCFLAGS) -o $@ $< -c -DTIMING $(CPPFLAGS) -g -Xcompiler -fopenmp 
kruger's avatar
kruger committed
834 835 836

easeaclean: clean
	rm -f Makefile EASEA.prm $(SRC) $(HDR) EASEA.mak $(CUDA_SRC) *.linkinfo EASEA.png EASEA.dat EASEA.vcproj EASEA.plot EASEA.r EASEA.csv EASEA.pop
837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
clean:
	rm -f $(OBJ) $(BIN) 	
	
\START_VISUAL_TPL<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9,00"
	Name="EASEA"
	ProjectGUID="{E73D5A89-F262-4F0E-A876-3CF86175BC30}"
	RootNamespace="EASEA"
	Keyword="WIN32Proj"
	TargetFrameworkVersion="196613"
	>
	<Platforms>
		<Platform
			Name="WIN32"
		/>
	</Platforms>
	<ToolFiles>
		<ToolFile
			RelativePath="\CUDA_RULE_DIRcommon\Cuda.rules"
		/>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Release|WIN32"
			OutputDirectory="$(SolutionDir)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="1"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="CUDA Build Rule"
				Include="\EZ_PATHlibEasea"
				Keep="false"
				Runtime="0"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="2"
				EnableIntrinsicFunctions="true"
				AdditionalIncludeDirectories="&quot;\EZ_PATHlibEasea&quot;"
				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
				RuntimeLibrary="0"
				EnableFunctionLevelLinking="true"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalDependencies="$(CUDA_LIB_PATH)\cudart.lib"
				LinkIncremental="1"
				AdditionalLibraryDirectories="&quot;\EZ_PATHlibEasea&quot;"
				GenerateDebugInformation="true"
				SubSystem="1"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\EASEA.cpp"
				>
			</File>
			<File
				RelativePath=".\EASEAIndividual.cu"
				>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\EASEAIndividual.hpp"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

\START_EO_PARAM_TPL#****************************************
#
#  EASEA.prm
#
#  Parameter file generated by CUDA.tpl AESAE v1.0
#
#***************************************
# --seed=0   # -S : Random number seed. It is possible to give a specific seed.

######    Evolution Engine    ######
--popSize=\POP_SIZE # -P : Population Size
--nbOffspring=\OFF_SIZE # -O : Nb of offspring (percentage or absolute)

######    Stopping Criterions    #####
--nbGen=\NB_GEN #Nb of generations
--timeLimit=\TIME_LIMIT # Time Limit: desactivate with (0) (in Seconds)

######    Evolution Engine / Replacement    ######
--elite=\ELITE_SIZE  # Nb of elite parents (absolute)
--eliteType=\ELITISM # Strong (1) or weak (0) elitism (set elite to 0 for none)
--survivingParents=\SURV_PAR_SIZE # Nb of surviving parents (percentage or absolute)
--survivingOffspring=\SURV_OFF_SIZE  # Nb of surviving offspring (percentage or absolute)
--selectionOperator=\SELECTOR_OPERATOR # Selector: Deterministic, Tournament, Random, Roulette
--selectionPressure=\SELECT_PRM
--reduceParentsOperator=\RED_PAR_OPERATOR
--reduceParentsPressure=\RED_PAR_PRM
--reduceOffspringOperator=\RED_OFF_OPERATOR
--reduceOffspringPressure=\RED_OFF_PRM
--reduceFinalOperator=\RED_FINAL_OPERATOR
--reduceFinalPressure=\RED_FINAL_PRM

#####   Stats Ouput     #####
--printStats=\PRINT_STATS #print Stats to screen
Frédéric Krüger's avatar
Frédéric Krüger committed
1016
--plotStats=\PLOT_STATS #plot Stats 
1017
--generateCSVFile=\GENERATE_CSV_FILE
Frédéric Krüger's avatar
Frédéric Krüger committed
1018
--generatePlotScript=\GENERATE_GNUPLOT_SCRIPT
1019 1020
--generateRScript=\GENERATE_R_SCRIPT

kruger's avatar
kruger committed
1021 1022 1023 1024 1025 1026
#### Population save    ####
--savePopulation=\SAVE_POPULATION #save population to EASEA.pop file
--startFromFile=\START_FROM_FILE #start optimisation from EASEA.pop file

#### Remote Island Model ####
--remoteIslandModel=\REMOTE_ISLAND_MODEL #To initialize communications with remote AESAE's
1027 1028
--ipFile=\IP_FILE
--migrationProbability=\MIGRATION_PROBABILITY #Probability to send an individual every generation
Frédéric Krüger's avatar
Frédéric Krüger committed
1029
--serverPort=\SERVER_PORT
1030
\TEMPLATE_END