This class implements the grid or von Neumann topology for the particle swarm. More...
#include <adjacency_list_neighborhood.h>
Public Member Functions | |
GridNeighborhood (int rows, int columns) | |
The constructor, which specifies the size of the grid. More... | |
std::string | GetName () |
Returns a string representation of this object. More... | |
Public Member Functions inherited from highprecisionpso::AdjacencyListNeighborhood | |
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... | |
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 | |
void | InitializeAdjacencyList () |
This method initializes the adjacency list. More... | |
Additional Inherited Members | |
Protected Attributes inherited from highprecisionpso::AdjacencyListNeighborhood | |
std::vector< std::vector< unsigned int > > | adjacency_list |
The adjacency lists, which specify the neighborhood relationship. More... | |
Detailed Description
This class implements the grid or von Neumann topology for the particle swarm.
Each particle is assigned to a grid position. The four neighbors of a particle are the particle above, the particle below, the particle to the right and the particle to the left.
Constructor & Destructor Documentation
highprecisionpso::GridNeighborhood::GridNeighborhood | ( | int | rows, |
int | columns | ||
) |
The constructor, which specifies the size of the grid.
Make sure that the number of grid positions is equal to the number of particles.
- Parameters
-
rows The number of rows in the grid. columns The number of columns in the grid.
Member Function Documentation
|
virtual |
Returns a string representation of this object.
- Returns
- The name of the object.
Implements highprecisionpso::AdjacencyListNeighborhood.
|
protectedvirtual |
This method initializes the adjacency list.
It is called after the number of particles is already set in the configuration section.
Implements highprecisionpso::AdjacencyListNeighborhood.
The documentation for this class was generated from the following file:
- src/neighborhood/adjacency_list_neighborhood.h