global_best.h
Go to the documentation of this file.
1 
40 #ifndef HIGH_PRECISION_PSO_NEIGHBORHOOD_GLOBAL_BEST_H_
41 #define HIGH_PRECISION_PSO_NEIGHBORHOOD_GLOBAL_BEST_H_
42 
44 
45 namespace highprecisionpso {
46 
50 class GlobalBest: public Neighborhood {
51 public:
55  GlobalBest();
59  ~GlobalBest();
60  std::vector<mpf_t*> GetGlobalAttractorPosition();
61  std::vector<mpf_t*> GetGlobalAttractorPosition(int particle_id);
62  mpf_t* GetGlobalAttractorValue();
63  mpf_t* GetGlobalAttractorValue(int particle_id);
64  void UpdateAttractorInstantly(std::vector<mpf_t*> position, mpf_t* value, int particle_id);
65  std::string GetName();
66  void LoadData(std::ifstream* input_stream, ProgramVersion* version_of_stored_data);
67  void StoreData(std::ofstream* output_stream);
68 
69 private:
70  std::vector<mpf_t*> global_attractor_position_;
71  mpf_t* global_attractor_value_cached_;
72  unsigned int global_attractor_value_cached_precision_;
73 };
74 
75 } // namespace highprecisionpso
76 
77 #endif /* HIGH_PRECISION_PSO_NEIGHBORHOOD_GLOBAL_BEST_H_ */
std::vector< mpf_t * > GetGlobalAttractorPosition()
Returns the position of the best global attractor.
This class implements the global best topology for the particle swarm, where all particles are neighb...
Definition: global_best.h:50
This class stores a program version.
Definition: general_objects.h:54
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 ne...
This file contains an abstract classes for neighborhood generation.
std::string GetName()
Returns a string representation of this object.
mpf_t * GetGlobalAttractorValue()
Returns the value of the best global attractor.
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...
This class is an abstract class. It supplies the interface for neighborhood topologies of the particl...
Definition: neighborhood.h:56
void StoreData(std::ofstream *output_stream)
Stores the current state of this neighborhood topology such that it can completely restore the curren...
~GlobalBest()
The destructor.
GlobalBest()
The constructor.
base namespace for this project.
Definition: absorption.h:45