Utopia 2
Framework for studying models of complex & adaptive systems.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Utopia::Models::SEIRD::ExposureContParams Struct Reference

Parameters specifying the exposure control. More...

#include <params.hh>

Public Types

using TimesQueue = std::queue< std::size_t >
 Type of the times queue.
 
using TimesValuesQueue = std::queue< std::pair< std::size_t, double > >
 The type of the change p_exposed pairs.
 

Public Member Functions

 ExposureContParams (const DataIO::Config &cfg)
 Configuration constructor.
 

Public Attributes

const bool enabled
 Whether exposure control is enabled.
 
const std::size_t num_additional_exposures
 The number of exposures added to the default p_expose.
 
TimesQueue at_times
 Add additional exposures at these time steps.
 
TimesValuesQueue change_p_exposed
 Change p_expose to new value at given times.
 

Detailed Description

Parameters specifying the exposure control.

Member Typedef Documentation

◆ TimesQueue

Type of the times queue.

◆ TimesValuesQueue

The type of the change p_exposed pairs.

Constructor & Destructor Documentation

◆ ExposureContParams()

Utopia::Models::SEIRD::ExposureContParams::ExposureContParams ( const DataIO::Config cfg)
inline

Configuration constructor.

Construct an ExposureContParams object with required parameters being extracted from a configuration node with the same parameter names.

45 :
46 enabled(get_as<bool>("enabled", cfg)),
48 get_as<std::size_t>("num_additional_exposures", cfg, 0)},
49 at_times {[&]() {
50 auto cont = get_as<std::vector<std::size_t>>("at_times", cfg, {});
51
52 std::sort(cont.begin(), cont.end());
53
54 // Copy elements into the queue
55 TimesQueue q {};
56 for (const auto& v : cont) {
57 q.push(v);
58 }
59
60 return q;
61 }()},
62 change_p_exposed {[&]() {
63 // Check the parameter
64 if (not cfg["change_p_exposed"] or
65 not cfg["change_p_exposed"].size()) {
66 // Key did not exist or was empty; return empty queue.
67 return TimesValuesQueue {};
68 }
69 else if (not cfg["change_p_exposed"].IsSequence()) {
70 // Inform about bad type of the given configuration entry
71 throw std::invalid_argument(
72 "Parameter change_p_exposed need be "
73 "a sequence of pairs, but was not! Given infection control "
74 "parameters:\n" +
76 }
77
79 "change_p_exposed",
80 cfg);
81
82 // Sort such that times low times are in the beginning of the queue
83 std::sort(cont.begin(),
84 cont.end(),
85 [](const auto& a, const auto& b) {
86 return a.first < b.first;
87 });
88
89 // Copy elements into the queue
91 for (const auto& v : cont) {
92 q.push(v);
93 }
94
95 return q;
96 }()} {};
std::string to_string(const Config &node)
Given a config node, returns a string representation of it.
Definition cfg_utils.hh:110
Container select_entities(const Manager &mngr, const DataIO::Config &sel_cfg)
Select entities according to parameters specified in a configuration.
Definition select.hh:213
TimesQueue at_times
Add additional exposures at these time steps.
Definition params.hh:32
const std::size_t num_additional_exposures
The number of exposures added to the default p_expose.
Definition params.hh:29
const bool enabled
Whether exposure control is enabled.
Definition params.hh:26
TimesValuesQueue change_p_exposed
Change p_expose to new value at given times.
Definition params.hh:39
std::queue< std::pair< std::size_t, double > > TimesValuesQueue
The type of the change p_exposed pairs.
Definition params.hh:22
std::queue< std::size_t > TimesQueue
Type of the times queue.
Definition params.hh:19

Member Data Documentation

◆ at_times

TimesQueue Utopia::Models::SEIRD::ExposureContParams::at_times
mutable

Add additional exposures at these time steps.

◆ change_p_exposed

TimesValuesQueue Utopia::Models::SEIRD::ExposureContParams::change_p_exposed
mutable

Change p_expose to new value at given times.

Each element of this container provides a pair of [time, new_value]. If the iteration step (time) of the simulation is reached p_expose is set to new_value

◆ enabled

const bool Utopia::Models::SEIRD::ExposureContParams::enabled

Whether exposure control is enabled.

◆ num_additional_exposures

const std::size_t Utopia::Models::SEIRD::ExposureContParams::num_additional_exposures

The number of exposures added to the default p_expose.


The documentation for this struct was generated from the following file: