From 78f1c92cbe8f69482239a61d49c6c866d65563c7 Mon Sep 17 00:00:00 2001 From: Amrita Goswami Date: Wed, 10 Apr 2024 08:11:45 +0000 Subject: [PATCH] DeffuantVector: Fixed bug in main.cpp The multi-dimensional DeffuantVector model has a different AgentT from the regular Deffuant model. Therefore, the model and simulation have to be built with the DeffuantVector agent. This requires some repititive logic in main.cpp. Also fixed a small typo in the TOML input file for the DeffuantVector model example. --- examples/DeffuantVector/conf.toml | 2 +- src/main.cpp | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/DeffuantVector/conf.toml b/examples/DeffuantVector/conf.toml index 604a40e..1d5f0ca 100644 --- a/examples/DeffuantVector/conf.toml +++ b/examples/DeffuantVector/conf.toml @@ -5,7 +5,7 @@ model = "Deffuant" [io] # n_output_network = 20 # Write the network every 20 iterations n_output_agents = 1 # Write the opinions of agents after every iteration -print_progress = true # Print the iteration time ; if not set, then does not prints +print_progress = true # Print the iteration time ; if not set, then does not print output_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default. start_output = 1 # Start writing out opinions and/or network files from this iteration. If not set, this is 1. diff --git a/src/main.cpp b/src/main.cpp index 3f429fa..ac57310 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -78,8 +78,17 @@ int main( int argc, char * argv[] ) } else if( simulation_options.model == Seldon::Config::Model::DeffuantModel ) { - simulation = std::make_unique>( - simulation_options, network_file, agent_file ); + auto model_settings = std::get( simulation_options.model_settings ); + if( model_settings.use_binary_vector ) + { + simulation = std::make_unique>( + simulation_options, network_file, agent_file ); + } + else + { + simulation = std::make_unique>( + simulation_options, network_file, agent_file ); + } } else {