Table Of Contents

Previous topic

SIS model

Next topic

Python SIR model

This Page

Scripted SIR model

SIR process definition

[NodeAttributes]
status = S,I,R
 
[MeanFieldStates]
{status:S}
{status:I}
{status:R}

[NodeRules]
{status:S} -> {status:I} = NN({status:I}) * beta
{status:I} -> {status:R} = gamma

SIR simulation configuration

# This is the simulation section.
[Simulation]
# Run the simulation this many iterations.
iterations = 2000

# The time step taken each iteration.
dt = .1

# This is the name of the process object.
process_class = ScriptedProcess

# This is the name of the network generation function.
network_func = BA_networkx

# Network settings.
[NetworkParameters]
# Number of nodes.
n = 1000
# Number of edges to add in each iteration.
m = 2

# Defining the process parameter values.
# The contents of this section is dependent on
# the parameters of the process class as specified by
# the option process_class in the Simulation section.
[ProcessParameters]
# File name of the process description.
file = SIR_process_def.ini
# Infection rate.
beta = .9e-2
# Recovery rate. 
gamma = 0.04 

# The fraction of nodes, alternatively the number of nodes, that will be  assigned to each state initially.
# The state names must match those specified by the network process class.
[NodeStateDistribution]
# 95% S
{status:S} = 0.95
# 5% I
{status:I} = 0.05
# Zero recovered to start with.
{status:R} = 0

# Result output settings.
[Output]

# Output directory:
output_dir = ../output/

# This is the base name of all files generated by the run.
base_name = test_SIR

# If unique is defined as true, yes, 1, or on, unique file names will be created (time stamp added)
unique = yes

# If this is true, yes, 1, or on, a copy of the full program config, plus an Info
# section will be saved.
save_config = yes

# If this is true/yes/on, the network node states will be counted and saved as a csv file.
# Default value True.
# Note only valid if the current process support updates. If not nothing will be saved.
save_state_count = yes

# Count nodes every ... iterations. Value should be integer >= 1.
# Default value 1.
save_state_count_interval = 1

# If this is true, yes, 1, or on, a copy of the network will be saved.
# Save interval may be set using the save_network_interval key.
save_network = yes

# This control how often the network will be saved.
# A value <= 0 means only the initial network will be saved. A positive value
# n> 0, results in the initial network being saved plus every n:th iteration
# thereafter, as well as the last network.
# Default value 0.
save_network_interval = 0