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 <utils/eoRNG.h>
|
||||||
#include <eoSelectOne.h>
|
#include <eoSelectOne.h>
|
||||||
|
|
||||||
template <class EOT> class peoPSOSelect: public eoSelectOne<EOT>
|
template <class POT> class peoPSOSelect: public eoSelectOne<POT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef typename PO < EOT >::Fitness Fitness;
|
peoPSOSelect(eoTopology < POT > & _topology):topology(_topology){}
|
||||||
|
|
||||||
virtual const EOT& operator()(const eoPop<EOT>& _pop)
|
typedef typename PO < POT >::Fitness Fitness;
|
||||||
|
|
||||||
|
virtual const POT& operator()(const eoPop<POT>& _pop)
|
||||||
{
|
{
|
||||||
unsigned ind=0;
|
return topology.globalBest(_pop);
|
||||||
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];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
eoTopology < POT > & topology;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue