highprecisionpso::AdjacencyListNeighborhood Class Referenceabstract

This class is an abstract class, which implements a complete neighborhood topology through a neighborhood relationship specified by adjacency lists. More...

#include <adjacency_list_neighborhood.h>

Inheritance diagram for highprecisionpso::AdjacencyListNeighborhood:

Public Member Functions

 AdjacencyListNeighborhood ()
 The constructor. More...
 
 ~AdjacencyListNeighborhood ()
 The destructor. More...
 
std::vector< mpf_t * > GetGlobalAttractorPosition ()
 Returns the position of the best global attractor. More...
 
std::vector< mpf_t * > GetGlobalAttractorPosition (int particle_id)
 Returns the position of the global attractor for the particle with the specified particle_id. More...
 
mpf_t * GetGlobalAttractorValue ()
 Returns the value of the best global attractor. More...
 
mpf_t * GetGlobalAttractorValue (int particle_id)
 Returns the value of the global attractor for the particle with the specified particle_id. More...
 
virtual std::string GetName ()=0
 Returns a string representation of this object. More...
 
void LoadData (std::ifstream *input_stream, ProgramVersion *version_of_stored_data)
 Loads data to reset the state of the neighborhood topology to the state which was stored. More...
 
void StoreData (std::ofstream *output_stream)
 Stores the current state of this neighborhood topology such that it can completely restore the current state with this data. More...
 
void UpdateAttractorInstantly (std::vector< mpf_t * > position, mpf_t *value, int particle_id)
 Depending on the neighborhood topology the new position replaces previous global attractors if the new position is better than previous positions. More...
 
- Public Member Functions inherited from highprecisionpso::Neighborhood
virtual ~Neighborhood ()
 The destructor. More...
 
std::vector< mpf_t * > GetGlobalAttractorPosition (Particle *p)
 Returns the position of the global attractor for the given particle. More...
 
mpf_t * GetGlobalAttractorValue (Particle *p)
 Returns the value of the global attractor for the particle p. More...
 
void ProceedAllUpdates ()
 Initializes the processing of all entries in the list of pending updates for the global attractors. More...
 
void UpdateAttractor (std::vector< mpf_t * > position, mpf_t *value, Particle *p)
 Appends the tuple of specified position, value and particle to the list of pending updates for global attractors. More...
 
void UpdateAttractor (std::vector< mpf_t * > position, mpf_t *value, int particle_id)
 Appends the tuple of specified position, value and particle to the list of pending updates for global attractors. More...
 
void UpdateAttractorInstantly (std::vector< mpf_t * > position, mpf_t *value, Particle *p)
 Depending on the neighborhood topology the new position replaces previous global attractors if the new position is better than previous positions. More...
 

Protected Member Functions

virtual void InitializeAdjacencyList ()=0
 This method initializes the adjacency list. More...
 

Protected Attributes

std::vector< std::vector< unsigned int > > adjacency_list
 The adjacency lists, which specify the neighborhood relationship. More...
 

Detailed Description

This class is an abstract class, which implements a complete neighborhood topology through a neighborhood relationship specified by adjacency lists.

Constructor & Destructor Documentation

highprecisionpso::AdjacencyListNeighborhood::AdjacencyListNeighborhood ( )

The constructor.

highprecisionpso::AdjacencyListNeighborhood::~AdjacencyListNeighborhood ( )

The destructor.

Member Function Documentation

std::vector<mpf_t*> highprecisionpso::AdjacencyListNeighborhood::GetGlobalAttractorPosition ( )
virtual

Returns the position of the best global attractor.

Returns
The position of the best global attractor.

Implements highprecisionpso::Neighborhood.

std::vector<mpf_t*> highprecisionpso::AdjacencyListNeighborhood::GetGlobalAttractorPosition ( int  particle_id)
virtual

Returns the position of the global attractor for the particle with the specified particle_id.

Parameters
particle_idThe index of the particle.
Returns
The position of the global attractor for the particle with index particle_id.

Implements highprecisionpso::Neighborhood.

mpf_t* highprecisionpso::AdjacencyListNeighborhood::GetGlobalAttractorValue ( )
virtual

Returns the value of the best global attractor.

Returns
The value of the best global attractor.

Implements highprecisionpso::Neighborhood.

mpf_t* highprecisionpso::AdjacencyListNeighborhood::GetGlobalAttractorValue ( int  particle_id)
virtual

Returns the value of the global attractor for the particle with the specified particle_id.

Parameters
particle_idThe index of the particle.
Returns
The value of the global attractor for the particle with index particle_id.

Implements highprecisionpso::Neighborhood.

virtual std::string highprecisionpso::AdjacencyListNeighborhood::GetName ( )
pure virtual

Returns a string representation of this object.

Returns
The name of the object.

Implements highprecisionpso::Neighborhood.

Implemented in highprecisionpso::WheelNeighborhood, highprecisionpso::GridNeighborhood, highprecisionpso::RingNeighborhood, and highprecisionpso::LBestNeighborhood.

virtual void highprecisionpso::AdjacencyListNeighborhood::InitializeAdjacencyList ( )
protectedpure virtual

This method initializes the adjacency list.

It is called after the number of particles is already set in the configuration section.

Implemented in highprecisionpso::WheelNeighborhood, highprecisionpso::GridNeighborhood, and highprecisionpso::LBestNeighborhood.

void highprecisionpso::AdjacencyListNeighborhood::LoadData ( std::ifstream *  input_stream,
ProgramVersion version_of_stored_data 
)
virtual

Loads data to reset the state of the neighborhood topology to the state which was stored.

Parameters
input_streamThe stream which contains the data about the state of the neighborhood topology.
version_of_stored_dataThe version of the program when the backup was created.

Implements highprecisionpso::Neighborhood.

void highprecisionpso::AdjacencyListNeighborhood::StoreData ( std::ofstream *  output_stream)
virtual

Stores the current state of this neighborhood topology such that it can completely restore the current state with this data.

Parameters
output_streamThe output stream where the state should be stored.

Implements highprecisionpso::Neighborhood.

void highprecisionpso::AdjacencyListNeighborhood::UpdateAttractorInstantly ( std::vector< mpf_t * >  position,
mpf_t *  value,
int  particle_id 
)
virtual

Depending on the neighborhood topology the new position replaces previous global attractors if the new position is better than previous positions.

Parameters
positionA new candidate position for a global attractor.
valueThe evaluated function value of this position.
particle_idThe index of the particle, which encountered this new position.

Implements highprecisionpso::Neighborhood.

Member Data Documentation

std::vector<std::vector<unsigned int> > highprecisionpso::AdjacencyListNeighborhood::adjacency_list
protected

The adjacency lists, which specify the neighborhood relationship.


The documentation for this class was generated from the following file: