Migration from SVN
This commit is contained in:
parent
d7d6c3a217
commit
8cd56f37db
29069 changed files with 0 additions and 4096888 deletions
35
smp/src/MWAlgo/eoEasyPSO.cpp
Normal file
35
smp/src/MWAlgo/eoEasyPSO.cpp
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
template<template <class> class EOAlgo, class EOT, class Policy>
|
||||
void paradiseo::smp::MWModel<EOAlgo,EOT,Policy>::operator()(eoPop<EOT>& _pop, const eoEasyPSO_tag&)
|
||||
{
|
||||
try
|
||||
{
|
||||
// initializes the topology, velocity, best particle(s)
|
||||
this->init();
|
||||
do
|
||||
{
|
||||
// loop over all the particles for the current iteration
|
||||
for (unsigned idx = 0; idx < _pop.size (); idx++)
|
||||
{
|
||||
// perform velocity evaluation
|
||||
this->velocity (_pop[idx],idx);
|
||||
|
||||
// apply the flight
|
||||
this->flight (_pop[idx]);
|
||||
}
|
||||
|
||||
// evaluate the position
|
||||
scheduler(EOAlgo<EOT>::eval, _pop);
|
||||
|
||||
for (unsigned idx = 0; idx < _pop.size (); idx++)
|
||||
// update the topology (particle and local/global best(s))
|
||||
this->velocity.updateNeighborhood(_pop[idx],idx);
|
||||
|
||||
} while (this->continuator (_pop));
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
std::string s = e.what ();
|
||||
s.append (" in eoEasyPSO");
|
||||
throw std::runtime_error (s);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue