* whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 17:15:10 +02:00
commit 70e60a50d2
195 changed files with 1763 additions and 1873 deletions

View file

@ -19,7 +19,7 @@ double real_value (const Particle & _particle)
{
double sum = 0;
for (unsigned i = 0; i < _particle.size ()-1; i++)
sum += pow(_particle[i],2);
sum += pow(_particle[i],2);
return (sum);
}
@ -50,15 +50,15 @@ int main()
// perform position initialization
pop.append (POP_SIZE, random);
// topology
eoLinearTopology<Particle> topology(NEIGHBORHOOD_SIZE);
// the full initializer
eoInitializer <Particle> init(eval,veloRandom,localInit,topology,pop);
init();
// bounds
eoRealVectorBounds bnds(VEC_SIZE,-1.5,1.5);
@ -71,32 +71,32 @@ int main()
// Terminators
eoGenContinue <Particle> genCont1 (50);
eoGenContinue <Particle> genCont2 (50);
// PS flight
eoSyncEasyPSO<Particle> pso1(genCont1, eval, velocity, flight);
eoSyncEasyPSO<Particle> pso2(init,genCont2, eval, velocity, flight);
// flight
try
{
pso1(pop);
std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl;
pso1(pop);
std::cout << "FINAL POPULATION AFTER SYNC PSO n°1:" << std::endl;
for (i = 0; i < pop.size(); ++i)
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
pso2(pop);
std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
pso2(pop);
std::cout << "FINAL POPULATION AFTER SYNC PSO n°2:" << std::endl;
for (i = 0; i < pop.size(); ++i)
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
std::cout << "\t" << pop[i] << " " << pop[i].fitness() << std::endl;
}
catch (std::exception& e)
{
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
std::cout << "exception: " << e.what() << std::endl;;
exit(EXIT_FAILURE);
}
return 0;
}