Model< FP > Class Template Reference

CPP API: mio::ssirs::Model< FP > Class Template Reference
mio::ssirs::Model< FP > Class Template Reference

#include <model.h>

Inheritance diagram for mio::ssirs::Model< FP >:
Collaboration diagram for mio::ssirs::Model< FP >:

Public Types

using Base = mio::StochasticModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP >, Flows >
 
- Public Types inherited from mio::StochasticModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP >, Flows >
using Base = std::conditional_t< std::is_same_v< Flows, void >, CompartmentalModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP > >, FlowModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP >, Flows > >
 

Public Member Functions

void get_flows (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> flows) const
 
void get_noise (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> noise) const
 Calculate random changes to the population at a certain time point. More...
 
 Model ()
 
- Public Member Functions inherited from mio::StochasticModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP >, Flows >
RandomNumberGenerator & get_rng () const
 Access the model's RNG. More...
 
FP sample_standard_normal_distribution () const
 Sample a standard normal distributed value from the model's RNG. More...
 
auto white_noise (Eigen::Index size) const
 Sample a vector of independent standard normal distributed values from the model's RNG. More...
 

Member Typedef Documentation

◆ Base

Constructor & Destructor Documentation

◆ Model()

template<typename FP >
mio::ssirs::Model< FP >::Model ( )
inline

Member Function Documentation

◆ get_flows()

template<typename FP >
void mio::ssirs::Model< FP >::get_flows ( Eigen::Ref< const Eigen::VectorX< FP >>  pop,
Eigen::Ref< const Eigen::VectorX< FP >>  y,
FP  t,
Eigen::Ref< Eigen::VectorX< FP >>  flows 
) const
inline

◆ get_noise()

template<typename FP >
void mio::ssirs::Model< FP >::get_noise ( Eigen::Ref< const Eigen::VectorX< FP >>  ,
Eigen::Ref< const Eigen::VectorX< FP >>  ,
FP  ,
Eigen::Ref< Eigen::VectorX< FP >>   
) const
inlinevirtual

Calculate random changes to the population at a certain time point.

This function calculates the random noise part of an SDE model. In general, it represents the result of the deterministic noise matrix multiplied by a white noise vector.

For infectious disease models, the noise matrix usually maps noise contributions from each flow to their respective compartments. In that case, the white noise vector has size #flows. The resulting noise vector must have the same size as the state vector y. This is due to the fact that the integration of SDE models must happen on populations, not flows, as the applied noise can occassionally push compartments into negative values. This can be mitigated by removing negative values and rescaling the population (see map_to_nonnegative), but this mitigation can not (in general) be applied to flows. The noise must still be applied per flow, so both inflow and outflow use the same random value. Otherwise, transitions between compartments would no longer preserve the total population count.

Reimplemented from mio::StochasticModel< FP, InfectionState, mio::Populations< FP, InfectionState >, Parameters< FP >, Flows >.