DynamicNPIs< FP > Class Template Reference

CPP API: mio::DynamicNPIs< FP > Class Template Reference

represents non-pharmaceutical interventions (NPI) that are activated during the simulation if some value (e.g. More...

#include <dynamic_npis.h>

Public Member Functions

void draw_sample ()
 draw a random sample from the damping distributions More...
 
SimulationTime< FP > get_duration () const
 get the duration of the NPIs. More...
 
auto get_max_exceeded_threshold (FP value)
 find the highest threshold that is smaller than the value. More...
 
template<class IOContext >
void serialize (IOContext &io) const
 serialize this. More...
 
void set_duration (SimulationTime< FP > v)
 set the duration of the NPIs. More...
 
void set_threshold (FP threshold, const std::vector< DampingSampling< FP >> &dampings)
 set a threshold and the NPIs that should be enacted. More...
 
auto get_thresholds () const
 range of pairs of threshold values and NPIs. More...
 
auto get_thresholds ()
 range of pairs of threshold values and NPIs. More...
 
SimulationTime< FP > get_interval () const
 Get/Set the interval at which the NPIs are checked. More...
 
void set_interval (SimulationTime< FP > interval)
 
FP get_base_value () const
 Get/Set the base value of the thresholds. More...
 
void set_base_value (FP v)
 

Static Public Member Functions

template<class IOContext >
static IOResult< DynamicNPIsdeserialize (IOContext &io)
 deserialize an object of this class. More...
 

Private Attributes

FP m_base {1.0}
 
SimulationTime< FP > m_duration {14.0}
 
SimulationTime< FP > m_interval {3.0}
 
std::vector< std::pair< FP, std::vector< DampingSampling< FP > > > > m_thresholds
 

Detailed Description

template<typename FP>
class mio::DynamicNPIs< FP >

represents non-pharmaceutical interventions (NPI) that are activated during the simulation if some value (e.g.

infections) exceeds specified thresholds.

Member Function Documentation

◆ deserialize()

template<typename FP >
template<class IOContext >
static IOResult<DynamicNPIs> mio::DynamicNPIs< FP >::deserialize ( IOContext &  io)
inlinestatic

deserialize an object of this class.

See also
mio::deserialize

◆ draw_sample()

template<typename FP >
void mio::DynamicNPIs< FP >::draw_sample ( )
inline

draw a random sample from the damping distributions

◆ get_base_value()

template<typename FP >
FP mio::DynamicNPIs< FP >::get_base_value ( ) const
inline

Get/Set the base value of the thresholds.

The base value determines the unit of the threshold values. E.g. If the base value is X, the thresholds should be interpreted as cases per X people.

Returns
The base value of the thresholds.

◆ get_duration()

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::get_duration ( ) const
inline

get the duration of the NPIs.

Returns
the duration of the NPIs.

◆ get_interval()

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::get_interval ( ) const
inline

Get/Set the interval at which the NPIs are checked.

Returns
the interval at which the NPIs are checked.

◆ get_max_exceeded_threshold()

template<typename FP >
auto mio::DynamicNPIs< FP >::get_max_exceeded_threshold ( FP  value)
inline

find the highest threshold that is smaller than the value.

Parameters
valuevalue to compare against the thresholds.
Returns
iterator (see get_thresholds()) to the exceeded threshold if found. get_thresholds().end() otherwise

◆ get_thresholds() [1/2]

template<typename FP >
auto mio::DynamicNPIs< FP >::get_thresholds ( )
inline

range of pairs of threshold values and NPIs.

thresholds are sorted by value in descending order.

Returns
the range of set thresholds.

◆ get_thresholds() [2/2]

template<typename FP >
auto mio::DynamicNPIs< FP >::get_thresholds ( ) const
inline

range of pairs of threshold values and NPIs.

thresholds are sorted by value in descending order.

Returns
the range of set thresholds.

◆ serialize()

template<typename FP >
template<class IOContext >
void mio::DynamicNPIs< FP >::serialize ( IOContext &  io) const
inline

serialize this.

See also
mio::serialize

◆ set_base_value()

template<typename FP >
void mio::DynamicNPIs< FP >::set_base_value ( FP  v)
inline
Returns
The base value of the thresholds.

◆ set_duration()

template<typename FP >
void mio::DynamicNPIs< FP >::set_duration ( SimulationTime< FP >  v)
inline

set the duration of the NPIs.

Parameters
vthe duration of the NPIs.

◆ set_interval()

template<typename FP >
void mio::DynamicNPIs< FP >::set_interval ( SimulationTime< FP >  interval)
inline
Parameters
intervalThe interval at which the NPIs are checked.

◆ set_threshold()

template<typename FP >
void mio::DynamicNPIs< FP >::set_threshold ( FP  threshold,
const std::vector< DampingSampling< FP >> &  dampings 
)
inline

set a threshold and the NPIs that should be enacted.

Parameters
thresholdthe threshold that may be exceeded.
dampingsthe NPIs

Member Data Documentation

◆ m_base

template<typename FP >
FP mio::DynamicNPIs< FP >::m_base {1.0}
private

◆ m_duration

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::m_duration {14.0}
private

◆ m_interval

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::m_interval {3.0}
private

◆ m_thresholds

template<typename FP >
std::vector<std::pair<FP, std::vector<DampingSampling<FP> > > > mio::DynamicNPIs< FP >::m_thresholds
private