EvolvingObjects
|
Static ring topology for particle swarm optimization. More...
#include <eoRingTopology.h>
Public Member Functions | |
eoRingTopology (unsigned _neighborhoodSize) | |
The only Ctor. | |
void | setup (const eoPop< POT > &_pop) |
Builds the neighborhoods using a ring strategy based on the particle indices. | |
unsigned | retrieveNeighborhoodByIndice (unsigned _indice) |
Retrieves the neighboorhood of a particle. | |
void | updateNeighborhood (POT &_po, unsigned _indice) |
Updates the best fitness of the given particle and potentially replaces the local best the given particle it's better. | |
POT & | best (unsigned _indice) |
Returns the best particle belonging to the neighborhood of the given particle. | |
void | printOn () |
Print the structure of the topology on the standard output. | |
virtual POT & | globalBest () |
Protected Attributes | |
std::vector < eoSocialNeighborhood< POT > > | neighborhoods |
unsigned | neighborhoodSize |
bool | isSetup |
Static ring topology for particle swarm optimization.
The neighborhoods are built using a ring based on each particle's indice and do not change for all the time steps. Only the best particle in each neighborhood is potentially updated thanks to the "updateNeighborhood" method.
Definition at line 45 of file eoRingTopology.h.
eoRingTopology< POT >::eoRingTopology | ( | unsigned | _neighborhoodSize | ) | [inline] |
The only Ctor.
_neighborhoodSize | - The size of each neighborhood. |
Definition at line 54 of file eoRingTopology.h.
void eoRingTopology< POT >::setup | ( | const eoPop< POT > & | _pop | ) | [inline, virtual] |
Builds the neighborhoods using a ring strategy based on the particle indices.
Also initializes the best particle of each neighborhood.
_pop | - The population used to build the only neighborhood. |
Implements eoTopology< POT >.
Definition at line 63 of file eoRingTopology.h.
References eoSocialNeighborhood< POT >::best(), and eoSocialNeighborhood< POT >::put().
unsigned eoRingTopology< POT >::retrieveNeighborhoodByIndice | ( | unsigned | _indice | ) | [inline] |
Retrieves the neighboorhood of a particle.
Definition at line 98 of file eoRingTopology.h.
Referenced by eoRingTopology< POT >::best().
void eoRingTopology< POT >::updateNeighborhood | ( | POT & | _po, |
unsigned | _indice | ||
) | [inline, virtual] |
Updates the best fitness of the given particle and potentially replaces the local best the given particle it's better.
_po | - The particle to update |
_indice | - The indice of the given particle in the population |
Implements eoTopology< POT >.
Definition at line 110 of file eoRingTopology.h.
References eoRingTopology< POT >::best().
POT& eoRingTopology< POT >::best | ( | unsigned | _indice | ) | [inline, virtual] |
Returns the best particle belonging to the neighborhood of the given particle.
_indice | - The indice of a particle in the population |
Implements eoTopology< POT >.
Definition at line 135 of file eoRingTopology.h.
References eoRingTopology< POT >::retrieveNeighborhoodByIndice().
Referenced by eoRingTopology< POT >::updateNeighborhood().