Skip to content

Commit

Permalink
IO: Variable name change to start_output
Browse files Browse the repository at this point in the history
Changed the variable deciding when to start outputting files to the more
intuitive `start_output`, as opposed to the old `start_print_iteration`

Co-authored-by: Moritz Sallermann <[email protected]>
  • Loading branch information
amritagos and MSallermann committed Mar 17, 2024
1 parent 2ceece9 commit cfbc66c
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/ActivityDriven/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 always print
print_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default.
start_print_iteration = 1 # Start printing opinions and/or network files from this iteration. If not set, this is 1.
start_output = 2 # Start writing out opinions and/or network files from this iteration. If not set, this is 1.

[model]
max_iterations = 500 # If not set, max iterations is infinite
Expand Down
2 changes: 1 addition & 1 deletion examples/ActivityDrivenBot/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ n_output_network = 1 # 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 always print
print_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default.
start_print_iteration = 1 # Start printing opinions and/or network files from this iteration. If not set, this is 1.
start_output = 1 # Start writing out opinions and/or network files from this iteration. If not set, this is 1.

[model]
max_iterations = 1000 # If not set, max iterations is infinite
Expand Down
2 changes: 1 addition & 1 deletion examples/ActivityDrivenMeanField/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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 always print
print_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default.
start_print_iteration = 1 # Start printing opinions and/or network files from this iteration. If not set, this is 1.
start_output = 1 # Start writing out opinions and/or network files from this iteration. If not set, this is 1.

[model]
max_iterations = 2000 # If not set, max iterations is infinite
Expand Down
2 changes: 1 addition & 1 deletion examples/DeGroot/conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ n_output_network = 20 # Write the network every 20 iterations
n_output_agents = 1 # Write the opinions of agents after every iteration
print_progress = false # Print the iteration time ; if not set, then always prints
print_initial = true # Print the initial opinions and network file from step 0. If not set, this is true by default.
start_print_iteration = 1 # Start printing opinions and/or network files from this iteration. If not set, this is 1.
start_output = 1 # Start writing out opinions and/or network files from this iteration. If not set, this is 1.

[model]
max_iterations = 20 # If not set, max iterations is infinite
Expand Down
2 changes: 1 addition & 1 deletion include/config_parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct OutputSettings
std::optional<size_t> n_output_network = std::nullopt;
bool print_progress = true; // Print the iteration time, by default always prints
bool print_initial = true; // Output initial opinions and network, by default always outputs.
int start_print_iteration = 1; // Start printing opinion and/or network files from this iteration number
int start_output = 1; // Start printing opinion and/or network files from this iteration number
};

struct DeGrootSettings
Expand Down
2 changes: 1 addition & 1 deletion include/simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class Simulation : public SimulationInterface
{
auto n_output_agents = this->output_settings.n_output_agents;
auto n_output_network = this->output_settings.n_output_network;
auto print_iter_start = this->output_settings.start_print_iteration;
auto print_iter_start = this->output_settings.start_output;
auto print_initial = this->output_settings.print_initial;

fmt::print( "-----------------------------------------------------------------\n" );
Expand Down
6 changes: 3 additions & 3 deletions src/config_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SimulationOptions parse_config_file( std::string_view config_file_path )
options.output_settings.print_initial
= tbl["io"]["print_initial"].value_or<bool>( bool( options.output_settings.print_initial ) );
// @TODO: default value should not be hard-coded here
options.output_settings.start_print_iteration = tbl["io"]["start_print_iteration"].value_or<int>( 1 );
options.output_settings.start_output = tbl["io"]["start_output"].value_or<int>( 1 );

// Check if the 'model' keyword exists
std::optional<std::string> model_string = tbl["simulation"]["model"].value<std::string>();
Expand Down Expand Up @@ -151,8 +151,8 @@ void validate_settings( const SimulationOptions & options )
auto g_zero = []( auto x ) { return x > 0; };
auto geq_zero = []( auto x ) { return x >= 0; };

// @TODO: Check that start_print_iteration is less than the max_iterations?
check( name_and_var( options.output_settings.start_print_iteration ), g_zero );
// @TODO: Check that start_output is less than the max_iterations?
check( name_and_var( options.output_settings.start_output ), g_zero );

if( options.model == Model::ActivityDrivenModel )
{
Expand Down

0 comments on commit cfbc66c

Please sign in to comment.