statistics.h
Go to the documentation of this file.
1 
40 #ifndef HIGH_PRECISION_PSO_STATISTICS_STATISTICS_H_
41 #define HIGH_PRECISION_PSO_STATISTICS_STATISTICS_H_
42 
43 #include <fstream>
44 #include <string>
45 #include <vector>
46 
48 #include "general/particle.h"
49 
50 namespace highprecisionpso {
51 
55 class Statistics {
56 public:
62  Statistics(std::vector<Particle*>* initial_swarm);
63 
68  void EvaluateStatistics();
69 
76  void LoadData(std::ifstream* input_stream, ProgramVersion* version_of_stored_data);
82  void StoreData(std::ofstream* output_stream);
83 
87  std::vector<Particle*>* swarm;
91  std::vector<long long> stored_statistical_iterations;
95  std::vector<std::vector<std::string> > stored_statistical_data;
99  std::vector<long long> local_attractor_update_counter;
103  std::vector<long long> global_attractor_update_counter;
107  long long current_iteration;
108 };
109 
110 } // namespace highprecisionpso
111 
112 #endif /* HIGH_PRECISION_PSO_STATISTICS_STATISTICS_H_ */
Statistics(std::vector< Particle * > *initial_swarm)
The constructor.
long long current_iteration
The current iteration counter.
Definition: statistics.h:107
std::vector< std::vector< std::string > > stored_statistical_data
Various lists of stored (but not yet saved) statistical data.
Definition: statistics.h:95
This class stores a program version.
Definition: general_objects.h:54
std::vector< long long > local_attractor_update_counter
For each particle the number of local attractor updates enforced by found positions of this particle...
Definition: statistics.h:99
std::vector< long long > stored_statistical_iterations
The iteration numbers of stored (but not yet saved) statistical data.
Definition: statistics.h:91
This class stores current information about the particle swarm.
Definition: statistics.h:55
void EvaluateStatistics()
If the current iteration counter has a value, where statistical calculations are expected, then the values of all statistics are evaluated and stored in respective vectors.
void LoadData(std::ifstream *input_stream, ProgramVersion *version_of_stored_data)
Loads data to reset the state of the statistics object to the state which was stored.
void StoreData(std::ofstream *output_stream)
Stores the current state of the statistics object (iteration counter, attractor positions and update ...
This file contains information about the particles of the swarm.
std::vector< Particle * > * swarm
The list of particles, which are contained in the current swarm.
Definition: statistics.h:87
std::vector< long long > global_attractor_update_counter
For each particle the number of global attractor updates enforced by found positions of this particle...
Definition: statistics.h:103
This file contains various general objects which can be used by or contained in other objects...
base namespace for this project.
Definition: absorption.h:45