added best position updating + printOn
This commit is contained in:
parent
7d89f5a97c
commit
c864f2deb5
4 changed files with 24 additions and 29 deletions
|
|
@ -128,17 +128,18 @@ public:
|
|||
return i;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Update the neighborhood: update the particle's best fitness and the best particle
|
||||
* of the corresponding neighborhood.
|
||||
*/
|
||||
void updateNeighborhood(POT & _po,unsigned _indice)
|
||||
{
|
||||
{
|
||||
// update the best fitness of the particle
|
||||
if (_po.fitness() > _po.best())
|
||||
{
|
||||
_po.best(_po.fitness());
|
||||
_po.best(_po.fitness());
|
||||
for(unsigned i=0;i<_po.size();i++)
|
||||
_po.bestPositions[i]=_po[i];
|
||||
}
|
||||
|
||||
// update the best in its neighborhood
|
||||
|
|
@ -149,7 +150,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the best informative of a particle. Could be itself.
|
||||
* @param _indice - The indice of a particle in the population
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue