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::ImmunityContParams Struct Reference

Parameters specifying the immunity 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_immune pairs.
 

Public Member Functions

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

Public Attributes

const bool enabled
 Whether immunity control is enabled.
 
const std::size_t num_additional_immunities
 The number of immunities added to the default p_expose.
 
TimesQueue at_times
 Add additional immunities at these time steps.
 
TimesValuesQueue change_p_immune
 Change p_immune to new value at given times.
 

Detailed Description

Parameters specifying the immunity control.

Member Typedef Documentation

◆ TimesQueue

Type of the times queue.

◆ TimesValuesQueue

The type of the change p_immune pairs.

Constructor & Destructor Documentation

◆ ImmunityContParams()

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

Configuration constructor.

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

130 :
131 enabled(get_as<bool>("enabled", cfg)),
133 get_as<std::size_t>("num_additional_immunities", cfg, 0)},
134 at_times {[&]() {
135 auto cont = get_as<std::vector<std::size_t>>("at_times", cfg, {});
136
137 std::sort(cont.begin(), cont.end());
138
139 // Copy elements into the queue
140 TimesQueue q {};
141 for (const auto& v : cont) {
142 q.push(v);
143 }
144
145 return q;
146 }()},
147 change_p_immune {[&]() {
148 // Check the parameter
149 if (not cfg["change_p_immune"] or
150 not cfg["change_p_immune"].size()) {
151 // Key did not exist or was empty; return empty queue.
152 return TimesValuesQueue {};
153 }
154 else if (not cfg["change_p_immune"].IsSequence()) {
155 // Inform about bad type of the given configuration entry
156 throw std::invalid_argument(
157 "Parameter change_p_immune need be "
158 "a sequence of pairs, but was not! Given infection control "
159 "parameters:\n" +
160 DataIO::to_string(cfg));
161 }
162
164 "change_p_immune",
165 cfg);
166
167 // Sort such that low times are in the beginning of the queue
168 std::sort(cont.begin(),
169 cont.end(),
170 [](const auto& a, const auto& b) {
171 return a.first < b.first;
172 });
173
174 // Copy elements into the queue
176 for (const auto& v : cont) {
177 q.push(v);
178 }
179
180 return q;
181 }()} {};
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
const std::size_t num_additional_immunities
The number of immunities added to the default p_expose.
Definition params.hh:114
TimesValuesQueue change_p_immune
Change p_immune to new value at given times.
Definition params.hh:124
std::queue< std::size_t > TimesQueue
Type of the times queue.
Definition params.hh:104
std::queue< std::pair< std::size_t, double > > TimesValuesQueue
The type of the change p_immune pairs.
Definition params.hh:107
TimesQueue at_times
Add additional immunities at these time steps.
Definition params.hh:117
const bool enabled
Whether immunity control is enabled.
Definition params.hh:111

Member Data Documentation

◆ at_times

TimesQueue Utopia::Models::SEIRD::ImmunityContParams::at_times
mutable

Add additional immunities at these time steps.

◆ change_p_immune

TimesValuesQueue Utopia::Models::SEIRD::ImmunityContParams::change_p_immune
mutable

Change p_immune 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_immune is set to new_value

◆ enabled

const bool Utopia::Models::SEIRD::ImmunityContParams::enabled

Whether immunity control is enabled.

◆ num_additional_immunities

const std::size_t Utopia::Models::SEIRD::ImmunityContParams::num_additional_immunities

The number of immunities added to the default p_expose.


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