modification of the PSO 's parallel selection
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@736 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
f9e5f6af04
commit
970289bbe2
1 changed files with 9 additions and 12 deletions
|
|
@ -39,24 +39,21 @@
|
|||
#include <utils/eoRNG.h>
|
||||
#include <eoSelectOne.h>
|
||||
|
||||
template <class EOT> class peoPSOSelect: public eoSelectOne<EOT>
|
||||
template <class POT> class peoPSOSelect: public eoSelectOne<POT>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename PO < EOT >::Fitness Fitness;
|
||||
peoPSOSelect(eoTopology < POT > & _topology):topology(_topology){}
|
||||
|
||||
typedef typename PO < POT >::Fitness Fitness;
|
||||
|
||||
virtual const EOT& operator()(const eoPop<EOT>& _pop)
|
||||
virtual const POT& operator()(const eoPop<POT>& _pop)
|
||||
{
|
||||
unsigned ind=0;
|
||||
double best=_pop[0].best();
|
||||
for(unsigned i=1;i<_pop.size();i++)
|
||||
if(_pop[i].best() > best)
|
||||
{
|
||||
ind=i;
|
||||
best=_pop[i].best();
|
||||
}
|
||||
return _pop[ind];
|
||||
return topology.globalBest(_pop);
|
||||
}
|
||||
|
||||
private:
|
||||
eoTopology < POT > & topology;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue