diff --git a/include/connectivity.hpp b/include/connectivity.hpp index 1af9c8d..a9d0159 100644 --- a/include/connectivity.hpp +++ b/include/connectivity.hpp @@ -75,7 +75,7 @@ class TarjanConnectivityAlgo { lowest[v] = std::min( lowest[v], num[u] ); } // u not processed - } // u has been visited + } // u has been visited } // Now v has been processed diff --git a/include/models/ActivityDrivenModel.hpp b/include/models/ActivityDrivenModel.hpp index 1b0ab83..7418e4c 100644 --- a/include/models/ActivityDrivenModel.hpp +++ b/include/models/ActivityDrivenModel.hpp @@ -60,7 +60,7 @@ class ActivityDrivenModelAbstract : public Model } } - void iteration() override{}; + void iteration() override {}; protected: NetworkT & network; @@ -113,6 +113,8 @@ class ActivityDrivenModelAbstract : public Model power_law_distribution<> dist_activity( eps, gamma ); truncated_normal_distribution<> dist_reluctance( reluctance_mean, reluctance_sigma, reluctance_eps ); + bivariate_gaussian_copula copula( covariance_factor, dist_activity, dist_reluctance ); + auto mean_activity = dist_activity.mean(); // Initial conditions for the opinions, initialize to [-1,1] @@ -121,18 +123,16 @@ class ActivityDrivenModelAbstract : public Model { network.agents[i].data.opinion = dis_opinion( gen ); // Draw the opinion value - if( !mean_activities ) - { // Draw from a power law distribution (1-gamma)/(1-eps^(1-gamma)) * a^(-gamma) - network.agents[i].data.activity = dist_activity( gen ); - } - else - { - network.agents[i].data.activity = mean_activity; - } + auto res = copula( gen ); + network.agents[i].data.activity = res[0]; if( use_reluctances ) { - network.agents[i].data.reluctance = dist_reluctance( gen ); + network.agents[i].data.reluctance = res[1]; + } + if( mean_activities ) + { + network.agents[i].data.activity = mean_activity; } } diff --git a/src/config_parser.cpp b/src/config_parser.cpp index e0e054e..63c8456 100644 --- a/src/config_parser.cpp +++ b/src/config_parser.cpp @@ -253,8 +253,7 @@ void validate_settings( const SimulationOptions & options ) { const std::string basic_deff_msg = "The basic Deffuant model has not been implemented with multiple dimensions"; - check( - name_and_var( model_settings.dim ), []( auto x ) { return x == 1; }, basic_deff_msg ); + check( name_and_var( model_settings.dim ), []( auto x ) { return x == 1; }, basic_deff_msg ); } } } diff --git a/test/test_network.cpp b/test/test_network.cpp index 57239e7..f1d2bfa 100644 --- a/test/test_network.cpp +++ b/test/test_network.cpp @@ -112,7 +112,7 @@ TEST_CASE( "Testing the network class" ) auto weight = buffer_w[i_neighbour]; std::tuple edge{ neighbour, i_agent, weight - }; // Note that i_agent and neighbour are flipped compared to before + }; // Note that i_agent and neighbour are flipped compared to before REQUIRE( old_edges.contains( edge ) ); // can we find the transposed edge? old_edges.extract( edge ); // extract the edge afterwards }