diff --git a/examples/ActivityDrivenReluctance/conf.toml b/examples/ActivityDrivenReluctance/conf.toml index 668891b..52b1005 100644 --- a/examples/ActivityDrivenReluctance/conf.toml +++ b/examples/ActivityDrivenReluctance/conf.toml @@ -24,8 +24,9 @@ mean_weights = false # Use the meanfield approximation of the network edges reluctances = true # Assigns a "reluctance" (m_i) to each agent. By default; false and every agent has a reluctance of 1 reluctance_mean = 1.0 # Mean of distribution before drawing from a truncated normal distribution (default set to 1.0) -reluctance_sigma = 0.25 # Width of normal distribution (before truncating) +reluctance_sigma = 0.15 # Width of normal distribution (before truncating) reluctance_eps = 0.01 # Minimum such that the normal distribution is truncated at this value +covariance_factor = 0.0 # 0.0 means that the reluctances and activities are uncorrelated. Should be in the range of [-1,1] [network] number_of_agents = 1000 diff --git a/include/models/ActivityDrivenModel.hpp b/include/models/ActivityDrivenModel.hpp index 7418e4c..64a1223 100644 --- a/include/models/ActivityDrivenModel.hpp +++ b/include/models/ActivityDrivenModel.hpp @@ -44,6 +44,7 @@ class ActivityDrivenModelAbstract : public Model reluctance_mean( settings.reluctance_mean ), reluctance_sigma( settings.reluctance_sigma ), reluctance_eps( settings.reluctance_eps ), + covariance_factor( settings.covariance_factor ), n_bots( settings.n_bots ), bot_m( settings.bot_m ), bot_activity( settings.bot_activity ), diff --git a/src/config_parser.cpp b/src/config_parser.cpp index 63c8456..ac48587 100644 --- a/src/config_parser.cpp +++ b/src/config_parser.cpp @@ -59,6 +59,7 @@ void parse_activity_settings( auto & model_settings, const auto & toml_model_opt set_if_specified( model_settings.mean_activities, toml_model_opt["mean_activities"] ); set_if_specified( model_settings.mean_weights, toml_model_opt["mean_weights"] ); // Reluctances + set_if_specified( model_settings.covariance_factor, toml_model_opt["covariance_factor"] ); set_if_specified( model_settings.use_reluctances, toml_model_opt["reluctances"] ); set_if_specified( model_settings.reluctance_mean, toml_model_opt["reluctance_mean"] ); set_if_specified( model_settings.reluctance_sigma, toml_model_opt["reluctance_sigma"] ); @@ -213,7 +214,7 @@ void validate_settings( const SimulationOptions & options ) check( name_and_var( model_settings.reluctance_mean ), g_zero ); check( name_and_var( model_settings.reluctance_sigma ), g_zero ); check( name_and_var( model_settings.reluctance_eps ), g_zero ); - check( name_and_var( model_settings.covariance_factor ), geq_zero ); + check( name_and_var( model_settings.covariance_factor ), []( auto x ) { return x >= -1.0 && x<=1.0; } ); // Bot options size_t n_bots = model_settings.n_bots; auto check_bot_size = [&]( auto x ) { return x.size() >= n_bots; };