Skip to content

Commit 78f1c92

Browse files
committed
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.
1 parent 0ab1575 commit 78f1c92

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

examples/DeffuantVector/conf.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ model = "Deffuant"
55
[io]
66
# n_output_network = 20 # Write the network every 20 iterations
77
n_output_agents = 1 # Write the opinions of agents after every iteration
8-
print_progress = true # Print the iteration time ; if not set, then does not prints
8+
print_progress = true # Print the iteration time ; if not set, then does not print
99
output_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default.
1010
start_output = 1 # Start writing out opinions and/or network files from this iteration. If not set, this is 1.
1111

src/main.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,17 @@ int main( int argc, char * argv[] )
7878
}
7979
else if( simulation_options.model == Seldon::Config::Model::DeffuantModel )
8080
{
81-
simulation = std::make_unique<Seldon::Simulation<Seldon::DeffuantModel::AgentT>>(
82-
simulation_options, network_file, agent_file );
81+
auto model_settings = std::get<Seldon::Config::DeffuantSettings>( simulation_options.model_settings );
82+
if( model_settings.use_binary_vector )
83+
{
84+
simulation = std::make_unique<Seldon::Simulation<Seldon::DeffuantModelVector::AgentT>>(
85+
simulation_options, network_file, agent_file );
86+
}
87+
else
88+
{
89+
simulation = std::make_unique<Seldon::Simulation<Seldon::DeffuantModel::AgentT>>(
90+
simulation_options, network_file, agent_file );
91+
}
8392
}
8493
else
8594
{

0 commit comments

Comments
 (0)