configuration.h
Go to the documentation of this file.
1 
40 #ifndef HIGH_PRECISION_PSO_GENERAL_CONFIGURATION_H_
41 #define HIGH_PRECISION_PSO_GENERAL_CONFIGURATION_H_
42 
43 #include <string>
44 #include <vector>
45 
47 #include "function/function.h"
52 #include "statistics/statistics.h"
54 
58 namespace highprecisionpso {
59 
63 namespace configuration {
64 
68 extern double g_chi;
72 extern double g_coefficient_local_attractor;
76 extern double g_coefficient_global_attractor;
77 
94 };
99 
114 };
119 
123 extern int g_particles;
127 extern int g_dimensions;
132 extern long long g_max_iterations;
133 
138 extern std::vector<std::vector<long long> > g_iterations_with_statistic_evaluations;
142 extern std::vector<Statistic*> g_statistics_list;
161 };
166 
170 extern std::vector<long long> g_preserve_backup_times;
174 extern double g_time_between_backups;
179 extern double g_time_between_run_checks;
183 extern std::string g_run_check_configuration_file;
184 
188 extern std::string g_file_prefix;
192 extern std::string g_user_defined_file_prefix;
197 
201 extern Function* g_function;
221 extern Statistics* g_statistics;
222 
226 extern bool g_debug_swarm_activated;
230 extern unsigned int g_debug_swarm_x_resolution;
234 extern unsigned int g_debug_swarm_y_resolution;
242 extern unsigned int g_debug_swarm_image_generation_frequency;
250 extern std::string g_debug_swarm_gnuplot_terminal;
254 extern std::string g_debug_swarm_image_file_extension;
255 
280 };
285 public:
293  double lower_bound;
297  double upper_bound;
301  double range;
309  double normal_scale;
326 };
330 extern std::vector<InitializationInformation> g_position_initialization_informations;
334 extern std::vector<InitializationInformation> g_velocity_initialization_informations;
335 
336 
340 extern std::vector<SearchSpaceBound> g_function_bounds;
341 
349 bool ReadConfigurationFile(std::string fileName);
350 
356 std::string GetConfigurationString();
357 
363 std::string GetFilePrefix();
364 
368 void Init();
369 
370 } // namespace configuration
371 } // namespace highprecisionpso
372 
373 #endif /* HIGH_PRECISION_PSO_GENERAL_CONFIGURATION_H_ */
VelocityAdjustment * g_velocity_adjustment
Specifies the method for velocity adjustment in case that the bound handling method was active...
The velocity is initialized with a zero vector.
Definition: configuration.h:85
unsigned int g_debug_swarm_global_attractor_trajectory
Specifies how many of the previous global attractor positions are visualized.
This file contains abstract classes for function generation.
int power_scale
Exponential scale (with base two) for initialization. May be unused depending on information type...
Definition: configuration.h:305
std::vector< long long > g_preserve_backup_times
Contains a list of time steps at which backups of the current situation (positions, velocities, ... ) are stored.
std::vector< InitializationInformation > g_position_initialization_informations
Initialization informations for position initialization.
double lower_bound
Lower bound for initialization. May be unused depending on information type.
Definition: configuration.h:293
InitializationInformation with this type contains an upper bound and a lower bound for the random cen...
Definition: configuration.h:271
This class is an abstract class for processing the velocity adjustment after the position update of e...
Definition: velocity_adjustment.h:54
InitializationInformation with this type contains factor which scales the range of previously specifi...
Definition: configuration.h:275
InitializeVelocityMode g_initialize_velocity_mode
Stores the information how the velocity should be initialized.
This file contains an abstract class for processing the velocity and position update of each particle...
int g_dimensions
The number of dimensions of the search space for the particle swarm optimization algorithm.
double upper_bound
Upper bound for initialization. May be unused depending on information type.
Definition: configuration.h:297
int particle_from
Lowest particle id which is affected by current initialization information.
Definition: configuration.h:313
Stores the information how positions or velocities should be initialized.
Definition: configuration.h:284
std::string g_file_prefix
File prefix for all generated files. (Will be initialized in the first call of getFilePrefix) ...
bool g_debug_swarm_activated
Specifies whether the debug swarm mode is activated.
If the function is evaluated outside of the search space bounds always +infinity is returned...
Definition: configuration.h:150
unsigned int g_debug_swarm_image_generation_frequency
Specifies how often images are created.
long long g_max_iterations
The number of iterations / steps for the particle swarm optimization algorithm. Specifies how many it...
bool g_show_system_time_in_file_prefix
Specifies whether the time and the date should be included in the generated files.
This class is an abstract class for processing the velocity and position update of each particle...
Definition: position_and_velocity_updater.h:55
This file contains the available random number generators.
int dimension_to
Highest dimension id which is affected by current initialization information.
Definition: configuration.h:325
unsigned int g_debug_swarm_y_resolution
Specifies height in pixels of generated images.
The global attractor is updated as soon as a better position appears.
Definition: configuration.h:113
double g_coefficient_local_attractor
Coefficient for the weight of the direction to the local attractor for the movement equation...
std::string g_user_defined_file_prefix
User defined part of the file prefix. It is empty if the user has not specified it.
This file contains an class, which stores current information about the particle swarm.
This file contains an abstract classes for neighborhood generation.
InitializeVelocityMode
Specification possibilities how the velocity is initialized.
Definition: configuration.h:81
InitializationInformation with this type contains an exponential factor which scales the range of pre...
Definition: configuration.h:279
std::string GetFilePrefix()
If a file prefix is already specified then this file prefix is returned. Otherwise the file prefix is...
InitializationInformationType information_type
Specifies the current type of information about initialization.
Definition: configuration.h:289
bool g_debug_swarm_show_global_attractor_on_terminal
Specifies whether the position value and the function value of the particle swarm should be displayed...
std::vector< SearchSpaceBound > g_function_bounds
A list of search space bounds for the current objective function.
Function * g_function
Specifies the objective function.
double g_time_between_run_checks
Specifies periodicity in seconds of checking whether the program is allowed to run or not...
void Init()
Resets all variables in the configuration section to the default values.
FunctionBehaviorOutsideOfBoundsMode
Specification possibilities how the objective function is evaluated outside of the search space bound...
Definition: configuration.h:146
std::string g_debug_swarm_image_file_extension
Specifies the file extension for image generation with gnuplot.
std::vector< std::vector< long long > > g_iterations_with_statistic_evaluations
Specifies at which steps / iterations statistical evaluations are done. Each vector entry contains 3 ...
This file contains an abstract class for different bound handling strategies, which can be used for t...
BoundHandling * g_bound_handling
Specifies the bound handling method.
This class stores current information about the particle swarm.
Definition: statistics.h:55
This class is an abstract class. It supplies the interface for bound handling strategies of the parti...
Definition: bound_handling.h:54
bool ReadConfigurationFile(std::string fileName)
Reads data from the given configuration file and stores them in the configuration section...
InitializationInformation with this type contains an upper bound and a lower bound as well as the rel...
Definition: configuration.h:263
If the function is evaluated outside of the search space bounds, the function is repeated periodicall...
Definition: configuration.h:160
UpdateGlobalAttractorMode
Specification possibilities how often the global attractor is updated.
Definition: configuration.h:103
FunctionBehaviorOutsideOfBoundsMode g_function_behavior_outside_of_bounds_mode
Stores the information how the objective function is evaluated outside of the search space bounds...
std::vector< InitializationInformation > g_velocity_initialization_informations
Initialization informations for velocity initialization.
double g_coefficient_global_attractor
Coefficient for the weight of the direction to the global attractor for the movement equation...
InitializationInformation with this type contains a center and a range as well as the related dimensi...
Definition: configuration.h:267
This class is an abstract class. It supplies the interface for neighborhood topologies of the particl...
Definition: neighborhood.h:56
InitializationInformationType
Specification possibilities for position or velocity initialization.
Definition: configuration.h:259
std::string g_debug_swarm_gnuplot_terminal
Specifies the gnuplot terminal for image generation.
The velocity is initialized by sampling a second position and taking the half difference vector from ...
Definition: configuration.h:89
UpdateGlobalAttractorMode g_update_global_attractor_mode
Stores the information how often the global attractor is updated.
double range
Range for initialization. May be unused depending on information type.
Definition: configuration.h:301
This file contain classes, which evaluate to vectors depending on the current state of the particle s...
std::string GetConfigurationString()
Generates a short string, which includes the main information about the current configuration.
If the function is evaluated outside of the search space bounds also the specified function is evalua...
Definition: configuration.h:154
int g_particles
The number of particles for the particle swarm optimization algorithm.
The velocity is initialized randomly according to the diameter of the search space.
Definition: configuration.h:93
Neighborhood * g_neighborhood
Specifies the neighborhood topology.
std::string g_run_check_configuration_file
File name of the run check configuration file. If this value is the empty string then no run check is...
double normal_scale
Scale for initialization. May be unused depending on information type.
Definition: configuration.h:309
This file contains an abstract class for processing the velocity adjustment after the position update...
The global attractor is updated after each iteration is completed.
Definition: configuration.h:107
int dimension_from
Lowest dimension id which is affected by current initialization information.
Definition: configuration.h:321
Statistics * g_statistics
Stores information about the current swarm situation.
int particle_to
Highest particle id which is affected by current initialization information.
Definition: configuration.h:317
unsigned int g_debug_swarm_x_resolution
Specifies width in pixels of generated images.
PositionAndVelocityUpdater * g_position_and_velocity_updater
Specifies the way how the positions and the velocities are updated at each iteration.
This class is an abstract class. It supplies the interface for objective functions.
Definition: function.h:74
std::vector< Statistic * > g_statistics_list
Contains a list of statistics which should be evaluated.
double g_time_between_backups
Specifies periodicity in seconds of the creation of backups and the continuation of statistics...
base namespace for this project.
Definition: absorption.h:45
double g_chi
Inertia weight of PSO for movement equation.