Skip to content

Commit

Permalink
Copula: Complete input parsing
Browse files Browse the repository at this point in the history
Co-authored-by: Moritz Sallermann <[email protected]>
  • Loading branch information
amritagos and MSallermann committed Mar 25, 2024
1 parent ade8ee9 commit 42c1a9d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/ActivityDrivenReluctance/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions include/models/ActivityDrivenModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ActivityDrivenModelAbstract : public Model<AgentT_>
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 ),
Expand Down
3 changes: 2 additions & 1 deletion src/config_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"] );
Expand Down Expand Up @@ -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; };
Expand Down

0 comments on commit 42c1a9d

Please sign in to comment.