ParadisEO - PEO Lesson 2: Multi start over an evolutionary algorithm

Note: All the components are not presented in this lesson (binary, topology, asynchronous or synchronous... ). To know the completeness of components refer to API documentation of ParadisEO-EO and ParadisEO-PEO.

Introduction

After this lesson, you will be able to run a multistart of a genetic algorithm. This is particularly interesting for testing different parameters of an EA. For instance, we can run several genetic algorithms with different population size, mutation/Crossover probability or stopping criterion ... etc. We can store all these different statistics and estimate swiftly what are the best parameters for a given instance of a particular problem.

Requirements

This lesson could have been a paragraph of lesson 1, but was separated for pedagogy reason. It is then with no surprise that this lesson would be short. We are going to reuse what have been presented in the previous lesson. So if you have not, you should take a look at lesson 1.

Implementation

As expected, we need to initialize an EA. Actually, several EAs with possibly different parameters values.

Initialisation of the EA

  ProblemEvalFunc plainEval;
  eoEvalFuncCounter<Problem> eval(plainEval);
  ProblemInit chromInit;

  eoPop< Problem > pop1( POP_SIZE, init );
  eoSGATransform< Problem > transform1( xover, param.pCross, mut, param.pMut );
  eoStochTournamentSelect< Problem > select1;
  eoSelectMany< Problem > selectN1( select1, selectionRate.value() );
  eoSSGAStochTournamentReplacement< Problem > replace1( 1.0 );
  eoWeakElitistReplacement< Problem > elitReplace1( replace1 );
  eoGenContinue< Problem > cont1( nbGenerations.value() );
  eoCheckPoint< Problem > checkpoint1( cont1 );
  eoEasyEA< Problem > algo1( checkpoint1, eval, selectN1, transform1, elitReplace1 );


  eoPop< Problem > pop2( POP_SIZE, init );
  eoSGATransform< Problem > transform2( xover, param.pCross, mut, param.pMut );
  eoStochTournamentSelect< Problem > select2;
  eoSelectMany< Problem > selectN2( select2, selectionRate.value() );
  eoSSGAStochTournamentReplacement< Problem > replace2( 1.0 );
  eoWeakElitistReplacement< Problem > elitReplace2( replace2 );
  eoGenContinue< Problem > cont2( nbGenerations.value() );
  eoCheckPoint< Problem > checkpoint2( cont2 );
  eoEasyEA< Problem > algo2( checkpoint2, eval, selectN2, transform2, elitReplace2 );


  eoPop< Problem > pop3( POP_SIZE, init );
  eoSGATransform< Problem > transform3( xover, param.pCross, mut, param.pMut );
  eoStochTournamentSelect< Problem > select3;
  eoSelectMany< Problem > selectN3( select3, selectionRate.value() );
  eoSSGAStochTournamentReplacement< Problem > replace3( 1.0 );
  eoWeakElitistReplacement< Problem > elitReplace3( replace3 );
  eoGenContinue< Problem > cont3( nbGenerations.value() );
  eoCheckPoint< Problem > checkpoint3( cont3 );
  eoEasyEA< Problem > algo3( checkpoint3, eval, selectN3, transform3, elitReplace3 );

Launching the parallel EA

    peo :: init (__argc, __argv);
    peoWrapper parallelEA1( algo1, pop1);
    peoWrapper parallelEA2( algo2, pop2);
    peoWrapper parallelEA3( algo3, pop3);
    peo :: run ();
    peo :: finalize ();

Launching the program

That is it !! Go ahead and execute !!