//Test : PSO select #include typedef eoRealParticle < double >Indi; double f (const Indi & _indi) { double sum=_indi[0]+_indi[1]; return (-sum); } int main (int __argc, char *__argv[]) { std::cout<<"\n\nTest : PSO select\n\n"; rng.reseed (10); peoEvalFunc plainEval(f); eoEvalFuncCounter < Indi > firstEval(plainEval); eoPopLoopEval < Indi > eval(firstEval); eoUniformGenerator < double >uGen (1, 2); eoInitFixedLength < Indi > random (2, uGen); eoUniformGenerator < double >sGen (-1, 1); eoVelocityInitFixedLength < Indi > veloRandom (2, sGen); eoFirstIsBestInit < Indi > localInit; eoRealVectorBounds bndsFlight(2,1,2); eoStandardFlight < Indi > flight(bndsFlight); eoLinearTopology topology(6); eoRealVectorBounds bnds(2,-1,1); eoStandardVelocity < Indi > velocity (topology,1,0.5,2.,bnds); eoPop < Indi > empty_pop,pop(20, random); eoInitializer init(eval,veloRandom,localInit,topology,pop); init(); eval (empty_pop,pop); peoPSOSelect mig_selec(topology); pop.sort(); std::cout<<"\nBest : "<