EvolvingObjects
eoRingTopology< POT > Class Template Reference

Static ring topology for particle swarm optimization. More...

#include <eoRingTopology.h>

Inheritance diagram for eoRingTopology< POT >:
eoTopology< POT > eoPop< POT > vector eoObject eoPersistent eoPrintable

List of all members.

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

Detailed Description

template<class POT>
class eoRingTopology< POT >

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.

Examples:
t-eoRingTopology.cpp.

Definition at line 45 of file eoRingTopology.h.


Constructor & Destructor Documentation

template<class POT >
eoRingTopology< POT >::eoRingTopology ( unsigned  _neighborhoodSize) [inline]

The only Ctor.

Parameters:
_neighborhoodSize- The size of each neighborhood.

Definition at line 54 of file eoRingTopology.h.


Member Function Documentation

template<class POT >
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.

Parameters:
_pop- The population used to build the only neighborhood.
Returns:

Implements eoTopology< POT >.

Definition at line 63 of file eoRingTopology.h.

References eoSocialNeighborhood< POT >::best(), and eoSocialNeighborhood< POT >::put().

template<class POT >
unsigned eoRingTopology< POT >::retrieveNeighborhoodByIndice ( unsigned  _indice) [inline]

Retrieves the neighboorhood of a particle.

Returns:
_indice - The particle indice (in the population)

Definition at line 98 of file eoRingTopology.h.

Referenced by eoRingTopology< POT >::best().

template<class POT >
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.

Parameters:
_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().

template<class POT >
POT& eoRingTopology< POT >::best ( unsigned  _indice) [inline, virtual]

Returns the best particle belonging to the neighborhood of the given particle.

Parameters:
_indice- The indice of a particle in the population
Returns:
POT & - The best particle in the neighborhood of the particle whose indice is _indice

Implements eoTopology< POT >.

Definition at line 135 of file eoRingTopology.h.

References eoRingTopology< POT >::retrieveNeighborhoodByIndice().

Referenced by eoRingTopology< POT >::updateNeighborhood().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends