diff --git a/test/res/1bot_1agent_activity_prob.toml b/test/res/1bot_1agent_activity_prob.toml index d8e0f58..1b2a109 100644 --- a/test/res/1bot_1agent_activity_prob.toml +++ b/test/res/1bot_1agent_activity_prob.toml @@ -22,6 +22,12 @@ K = 2.0 # Social interaction strength mean_activities = false # Use the mean value of the powerlaw distribution for the activities of all agents 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.5 # Mean of distribution before drawing from a truncated normal distribution (default set to 1.0) +reluctance_sigma = 2.5 # Width of normal distribution (before truncating) +reluctance_eps = 0.01 # Minimum such that the normal distribution is truncated at this value +covariance_factor = 0.25 # Determines whether activities and reluctances will be correlated. If set to 0.0 (default) then they will not be correlated. + n_bots = 1 # The number of bots to be used; if not specified defaults to 0 (which means bots are deactivated) # Bots are agents with fixed opinions and different parameters, the parameters are specified in the following lists # If n_bots is smaller than the length of any of the lists, the first n_bots entries are used. If n_bots is greater the code will throw an exception. diff --git a/test/test_activity.cpp b/test/test_activity.cpp index 900de56..75e83c8 100644 --- a/test/test_activity.cpp +++ b/test/test_activity.cpp @@ -85,7 +85,9 @@ TEST_CASE( "Test the probabilistic activity driven model for two agents", "[acti } } -TEST_CASE( "Test the probabilistic activity driven model with one bot and one agent", "[activity1Bot1Agent]" ) +TEST_CASE( + "Test the probabilistic activity driven model with one bot and one (reluctant) agent", + "[activity1Bot1AgentReluctance]" ) { using namespace Seldon; using namespace Catch::Matchers; @@ -122,8 +124,11 @@ TEST_CASE( "Test the probabilistic activity driven model with one bot and one ag auto time_elapsed = iterations * dt; // Final agent and bot opinions after the simulation run - auto x_t = agent.data.opinion; - auto x_t_bot = bot.data.opinion; + auto x_t = agent.data.opinion; + auto x_t_bot = bot.data.opinion; + auto reluctance = agent.data.reluctance; + + fmt::print( "Agent reluctance is = {}\n", reluctance ); // The bot opinion should not change during the simulation REQUIRE_THAT( x_t_bot, WithinAbs( x_bot, 1e-16 ) ); @@ -131,7 +136,8 @@ TEST_CASE( "Test the probabilistic activity driven model with one bot and one ag // Test that the agent opinion matches the analytical solution for an agent with a bot // Analytical solution is: // x_t = [x(0) - Ktanh(alpha*x_bot)]e^(-t) + Ktanh(alpha*x_bot) - auto x_t_analytical = ( x_0 - K * tanh( alpha * x_bot ) ) * exp( -time_elapsed ) + K * tanh( alpha * x_bot ); + auto x_t_analytical = ( x_0 - K / reluctance * tanh( alpha * x_bot ) ) * exp( -time_elapsed ) + + K / reluctance * tanh( alpha * x_bot ); REQUIRE_THAT( x_t, WithinAbs( x_t_analytical, 1e-5 ) ); }