tutorial PEO modified
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@903 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
498663e2f8
commit
15db5e4fea
37 changed files with 512 additions and 832 deletions
|
|
@ -77,20 +77,10 @@ int main (int __argc, char *__argv[])
|
|||
eoCombinedContinue <Indi> continuatorPara (genContPara);
|
||||
eoCheckPoint<Indi> checkpoint(continuatorPara);
|
||||
|
||||
|
||||
/* In this lesson, you should define a peoEvalFunc witch will allow to initialize :
|
||||
*
|
||||
* - peoSeqPopEval : using to the sequential evaluation
|
||||
*
|
||||
* OR
|
||||
*
|
||||
* - peoParaPopEval : using to the parallel evaluation
|
||||
*
|
||||
*/
|
||||
|
||||
// For a parallel evaluation
|
||||
|
||||
peoEvalFunc<Indi> plainEval(f);
|
||||
peoParaPopEval< Indi > eval(plainEval);
|
||||
peoPopEval <Indi> eval(plainEval);
|
||||
|
||||
|
||||
// Initialization
|
||||
|
|
@ -105,21 +95,26 @@ int main (int __argc, char *__argv[])
|
|||
eoSegmentCrossover<Indi> crossover; // Crossover
|
||||
eoUniformMutation<Indi> mutation(EPSILON); // Mutation
|
||||
eoSGATransform<Indi> transform(crossover,CROSS_RATE,mutation,MUT_RATE);
|
||||
peoSeqTransform<Indi> eaTransform(transform);
|
||||
|
||||
|
||||
// Replacement
|
||||
eoPlusReplacement<Indi> replace;
|
||||
|
||||
// Creation of the population
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
|
||||
// Algorithm
|
||||
eoEasyEA< Indi > eaAlg( checkpoint, eval, select, transform, replace );
|
||||
|
||||
//Parallel algorithm
|
||||
peoEA<Indi> Algo(checkpoint,eval,select,eaTransform,replace);
|
||||
Algo(pop);
|
||||
|
||||
peoWrapper parallelEA( eaAlg, pop);
|
||||
eval.setOwner(parallelEA);
|
||||
|
||||
peo :: run();
|
||||
peo :: finalize();
|
||||
if (getNodeRank()==1)
|
||||
{
|
||||
pop.sort();
|
||||
std::cout << "Final population :\n" << pop << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue