metawards.utils.run_models

metawards.utils.run_models(network: Union[metawards._network.Network, metawards._networks.Networks], variables: metawards._variableset.VariableSets, population: metawards._population.Population, nprocs: int, nthreads: int, seed: int, nsteps: int, output_dir: metawards._outputfiles.OutputFiles, iterator: Callable[[], None] = None, extractor: Callable[[], None] = None, mixer: Callable[[], None] = None, mover: Callable[[], None] = None, profiler: metawards.utils._profiler.Profiler = None, parallel_scheme: str = 'multiprocessing', debug_seeds=False) → List[Tuple[metawards._variableset.VariableSet, metawards._population.Population]][source]

Run all of the models on the passed Network that are described by the passed VariableSets

Parameters
  • network (Network or Networks) – The network(s) to model

  • variables (VariableSets) – The sets of VariableSet that represent all of the model runs to perform

  • population (Population) – The initial population for all of the model runs. This also contains the starting date and day for the model outbreak

  • nprocs (int) – The number of model runs to perform in parallel

  • nthreads (int) – The number of threads to parallelise each model run over

  • seed (int) – Random number seed which is used to generate random seeds for all model runs

  • nsteps (int) – The maximum number of steps to perform for each model - this will run until the outbreak is over if this is None

  • output_dir (OutputFiles) – The OutputFiles that represents the directory in which all output should be placed

  • iterator (str) – Iterator to load that will be used to iterate the outbreak

  • extractor (str) – Extractor to load that will be used to extract information

  • mixer (str) – Mixer to load that will be used to mix demographic data

  • mover (str) – Mover to load that will be used to move the population between different demographics

  • profiler (Profiler) – Profiler used to profile the model run

  • parallel_scheme (str) – Which parallel scheme (multiprocessing, mpi4py or scoop) to use to run multiple model runs in parallel

  • debug_seeds (bool (False)) – Set this parameter to force all runs to use the same seed (seed) - this is used for debugging and should never be set in production runs

Returns

results – The set of adjustable variables and final population at the end of each run

Return type

List[ tuple(VariableSet, Population)]