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_implementation_delay () const
 Get/Set the implementation delay at which the NPIs are implemented after threshold exceedance. More...
 
void set_implementation_delay (SimulationTime< FP > delay)
 
FP get_base_value () const
 Get/Set the base value of the thresholds. More...
 
void set_base_value (FP v)
 
SimulationTime< FP > get_directive_begin () const
 Get/Set the first day of the simulation for which a DynamicNPI can be activated. More...
 
void set_directive_begin (SimulationTime< FP > begin)
 
SimulationTime< FP > get_directive_end () const
 Get/Set the last day of the simulation for which a DynamicNPI can be active. More...
 
void set_directive_end (SimulationTime< FP > end)
 

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_delay {0.0}
 
SimulationTime< FP > m_directive_begin {SimulationTime<FP>(std::numeric_limits<FP>::lowest())}
 
SimulationTime< FP > m_directive_end {SimulationTime<FP>(std::numeric_limits<FP>::max())}
 
SimulationTime< FP > m_duration {14.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_directive_begin()

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

Get/Set the first day of the simulation for which a DynamicNPI can be activated.

This parameter imitates the beginning date of a legal directive.

Returns
the first day of a legal directive prescribing the DynamicNPI.

◆ get_directive_end()

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

Get/Set the last day of the simulation for which a DynamicNPI can be active.

This parameter imitates the last date of a legal directive and ends all active DynamicNPIs.

Returns
the last day of a legal directive prescribing the DynamicNPI.

◆ 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_implementation_delay()

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

Get/Set the implementation delay at which the NPIs are implemented after threshold exceedance.

This parameter imitates delayed reaction times when automatic implementations should be realized.

Returns
the implementation delay after which the NPIs are implemented upon threshold exceedance.

◆ 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
Parameters
vSets the base value of the thresholds.

◆ set_directive_begin()

template<typename FP >
void mio::DynamicNPIs< FP >::set_directive_begin ( SimulationTime< FP >  begin)
inline
Parameters
beginThe first day of a legal directive prescribing the DynamicNPI.

◆ set_directive_end()

template<typename FP >
void mio::DynamicNPIs< FP >::set_directive_end ( SimulationTime< FP >  end)
inline
Parameters
endThe last day of a legal directive prescribing the DynamicNPI.

◆ 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_implementation_delay()

template<typename FP >
void mio::DynamicNPIs< FP >::set_implementation_delay ( SimulationTime< FP >  delay)
inline
Parameters
delayThe implementation delay after which the NPIs are implemented upon threshold exceedance.

◆ 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_delay

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::m_delay {0.0}
private

◆ m_directive_begin

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::m_directive_begin {SimulationTime<FP>(std::numeric_limits<FP>::lowest())}
private

◆ m_directive_end

template<typename FP >
SimulationTime<FP> mio::DynamicNPIs< FP >::m_directive_end {SimulationTime<FP>(std::numeric_limits<FP>::max())}
private

◆ m_duration

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

◆ m_thresholds

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