ParadisEO - PEO Lesson 4: Parallel transformation

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.


When tackling an optimization problems by evolutionary algorithms (EA), the crossover and mutation step can be time consuming, especially, if the mutation is a local search. In order to speed up the execution of the EA, it could be interesting to parallelize these operators. That is what is proposed here by using the class peoTransform.


Nothing much is required as this lesson is quite easy. However, you are supposed to know about the EAs, the genetic operators. Doing the previous lessons might strongly help.


Let us assume that we have in hand the following hybrid algorithm implementation:

  local search
  MoveInit move_init;
  ProblemEval problem_eval;
  MoveNext move_next;
  MoveIncrEval move_incr_eval;
  moSimpleMoveTabuList<Move> tabulist(param.tabuListSize);
  moImprBestFitAspirCrit<Move> aspiration_criterion;
  moGenSolContinue<Problem> continu (param.TSmaxIter);
  moTS <Move> tabu_search (move_init, move_next, move_incr_eval, 
			   tabulist, aspiration_criterion, continu, problem_eval );

  Evolutionary algorithm
  ProblemEvalFunc plainEval;
  ProblemInit chromInit;
  eoPop<Problem> pop(param.popSize, chromInit);
  eoDetTournamentSelect<Problem> selectOne(param.tSize);
  eoSelectPerc<Problem> select(selectOne);
  ProblemXover Xover;
  eoSGATransform<Problem> transform(Xover, param.pCross, tabu_search, param.pMut);
  eoPlusReplacement<Problem> replace;
  eoGenContinue<Problem> genCont(param.maxGen);
  eoEasyEA<Problem> gga(genCont, plainEval, select, transform, replace);

All we need to change is the declaration highlighted in red. We merely replace it by the following

Parallel transformation

  peoTransform<Problem> transform(Xover, param.pCross, tabu_search, param.pMut);

Then, we set the transformation as the owner of the parallelism and run the program


   peoWrapper parallelEA( gga, pop);
   transform.setOwner (parallelEA);
   peo :: run();
   peo :: finalize(); 

Launching the program

Now it is ready to be run !!