Revision Notes for FRED 7.7


The following features were added in FRED version 7.7.4.

  • Bug fixes and efficiency improvements in the snapshot-restart feature.


The following features were added in FRED version 7.7.3.

  • Bug fixes in the snapshot-restart feature.

  • Bug fixes in the order of processing the meta agent and the admin agents in rare circumstances.

  • The default values for start_date and end_date have been removed. FRED will now generate a compiler error if either of these is missing.


The following features were added in FRED version 7.7.2.

  • Bug fixes in the snapshot-restart feature.


The following features were added in FRED version 7.7.1.

  • Bug fixes in the snapshot-restart feature.

  • Bug fix in the case of an agent’s state being initialized by two conditions (using set_state())


The following features were added in FRED version 7.7.0.

  • Simulation snapshots are now supported, as described in this note.

  • The allocation of memory for conditions has been optimized, in particular so that conditions with start_state = Excluded and admin_start_state = Excluded now only allocate memory for the meta agent.

  • New functions added to replace existing factors, as described later in this note. The replaced factors are now deprecated.


Snapshots and Restarts

The major change in this release is support for snapshots and restarts. A snapshot captures the state of a model at a given simulation time, while a restart is the ability to continue (restart) a simulation from a given snapshot. Two new simulation control parameters have been added to enable this capability.

snapshots = <N>             # default snapshots = 0
snapshot_interval = <days>  # default snapshot_interval = 0

The snapshots parameter controls how many snapshots to keep. The snapshot_interval gives the number of days between snapshots. If snapshots > \(0\) and no interval is given, the interval defaults to 99999 and each run will produce a single snapshot at the end of the run.

If snapshot_interval \(> 0\) and snapshots is not specified, the value of snapshots is set to \(1\).

Each run produces its own snapshot each time the number of days specified by snapshot_interval have passed. Run-specific snapshots are rolled into a single snapshot at the end of the job. This combined snapshot file for the job is stored in ../OUT/snapshot.tgz.

The new FRED command fred_get_snapshot fetches the snapshot file for the job with the given key (specified as -k <key>) and copies it to the file snapshot.tgz in the current directory. To store the snapshot to an alternate file name use the -o option.

$ fred_get_snapshot -k <key> -o <output_file_name>

To restart a job from a snapshot, use the new -R option to fred_job:

$ fred_job -k <key> ... -R <snapshot_file_name>

The resulting job will be initialized using the given snapshot, and will set the simulation day to the day after the snapshot day. The start_date of the new job should be the same as the start_date of the snapshot job, and the end_date of the new job must be after the snapshot day.

In addition to the combined snapshot of all run snapshots produced at the end of job, interim job-level snapshot files are created throughout the job based on the snapshot_mode setting. This simulation parameter defaults to \(0\).

The possible values for this setting are \(0\) and \(1\).

  • When snapshot_mode = 0, the first run to make a snapshot is designated the snapshot_run. When the snapshot_run completes, the next run to make a snapshot takes over as snapshot_run. Whenever the snapshot_run run produces a snapshot, a new job-level snapshot is created, combining the current run-level snapshots into a single snapshot file for the overall job. The use of mode \(0\) makes fewer job-level snapshots than mode \(1\), although for a large job some run-level snapshots could be lost if the job is interrupted before it completes.

  • When snapshot_mode = 1, each run creates a new job-level snapshot immediately after making a run-level snapshots. This mode makes more job-level snapshots, which could impact performance in a job with a large number of parallel runs. Mode \(1\) reduces the chance that a run-level snapshot is lost if the job is interrupted.

Functions that Replace Factors

The following list shows the new function to the left of the \(=\) sign that is equivalent to the factor on the right. The factors shown are now deprecated, with the function now preferred.

state(<condition_name>) = current_state_in_<condition_name>
transmissions(<condition_name>) = transmissions_of_<condition_name>
source(<condition_name>) = source_of_<condition_name>

current_count(<condition_name>.<state_name>, <group_name>) = current_count_of_<condition_name>.<state_name>[_in_<group_name>]
total_count(<condition_name>.<state_name>, <group_name>) = total_count_of_<condition_name>.<state_name>[_in_<group_name>]
daily_count(<condition_name>.<state_name>) = incidence_count_of_<condition_name>.<state_name>


If the second argument <group_name> is omitted in current_count or total_count, the function returns the count for the entire population.