Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical > Class Template Reference

CPP API: mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical > Class Template Reference
mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical > Class Template Reference

Class that defines an GLCT-SECIR model. More...

#include <model.h>

Inheritance diagram for mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >:
Collaboration diagram for mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >:

Public Types

using Base = CompartmentalModel< FP, LctState, mio::Populations< FP, LctState >, Parameters< FP > >
 
using LctState = LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >
 This class specifies the number of subcompartments. More...
 
using ParameterSet = Params
 
using Populations = Pop
 
- Public Types inherited from mio::CompartmentalModel< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >, mio::Populations< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 > >, Parameters< FP > >
using Compartments = LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >
 
using ParameterSet = Parameters< FP >
 
using Populations = mio::Populations< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 > >
 

Public Member Functions

TimeSeries< FP > calculate_compartments (const TimeSeries< FP > &subcompartments_ts) const
 Cumulates a simulation result with subcompartments to produce a result that divides the population only into the infection states defined in InfectionState. More...
 
bool check_constraints () const
 Checks that the model satisfies all constraints (e.g. More...
 
void get_derivatives (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const override
 Evaluates the right-hand-side f of the GLCT dydt = f(y, t). More...
 
 Model ()
 Default constructor. More...
 
- Public Member Functions inherited from mio::CompartmentalModel< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >, mio::Populations< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 > >, Parameters< FP > >
bool apply_constraints ()
 Checks whether the model satisfies all constraints. More...
 
bool check_constraints () const
 Checks that the model satisfies all constraints (e.g. More...
 
 CompartmentalModel (CompartmentalModel &&)=default
 
 CompartmentalModel (const CompartmentalModel &)=default
 
 CompartmentalModel (Populations const &po, ParameterSet const &pa)
 CompartmentalModel default constructor. More...
 
void eval_right_hand_side (Eigen::Ref< const Eigen::VectorX< FP >> pop, Eigen::Ref< const Eigen::VectorX< FP >> y, FP t, Eigen::Ref< Eigen::VectorX< FP >> dydt) const
 This function evaluates the right-hand-side f of the ODE dydt = f(y, t). More...
 
Eigen::VectorX< FP > get_initial_values () const
 Get the initial conditions for the ODE dydt = f(y, t). More...
 
CompartmentalModeloperator= (CompartmentalModel &&)=default
 
CompartmentalModeloperator= (const CompartmentalModel &)=default
 
virtual ~CompartmentalModel ()=default
 

Additional Inherited Members

- Public Attributes inherited from mio::CompartmentalModel< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >, mio::Populations< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 > >, Parameters< FP > >
ParameterSet parameters
 
Populations populations
 

Detailed Description

template<typename FP, size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
class mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >

Class that defines an GLCT-SECIR model.

Template Parameters
NumExposedThe number of subcompartments used for the Exposed compartment.
NumInfectedNoSymptomsThe number of subcompartments used for the InfectedNoSymptoms compartment.
NumInfectedSymptomsThe number of subcompartments used for the InfectedSymptoms compartment.
NumInfectedSevereThe number of subcompartments used for the InfectedSevere compartment.
NumInfectedCriticalThe number of subcompartments used for the InfectedCritical compartment.

Member Typedef Documentation

◆ Base

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
using mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::Base = CompartmentalModel<FP, LctState, mio::Populations<FP, LctState>, Parameters<FP> >

◆ LctState

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
using mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::LctState = LctInfectionState<FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1>

This class specifies the number of subcompartments.

◆ ParameterSet

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
using mio::CompartmentalModel< FP, Comp, Pop, Params >::ParameterSet = Params

◆ Populations

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
using mio::CompartmentalModel< FP, Comp, Pop, Params >::Populations = Pop

Constructor & Destructor Documentation

◆ Model()

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::Model ( )
inline

Default constructor.

Member Function Documentation

◆ calculate_compartments()

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
TimeSeries<FP> mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::calculate_compartments ( const TimeSeries< FP > &  subcompartments_ts) const
inline

Cumulates a simulation result with subcompartments to produce a result that divides the population only into the infection states defined in InfectionState.

If the model is used for simulation, we will get a result in form of a TimeSeries with infection states divided in subcompartments. The function calculates a TimeSeries without subcompartments from another TimeSeries with subcompartments. This is done by summing up the corresponding subcompartments.

Parameters
[in]subcompartments_tsResult of a simulation with the model.
Returns
Result of the simulation divided in infection states without subcompartments. Returns TimeSeries with values -1 if calculation is not possible.

◆ check_constraints()

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
bool mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::check_constraints ( ) const
inline

Checks that the model satisfies all constraints (e.g.

parameter or population constraints), and logs an error if constraints are not satisfied.

Returns
Returns true if one or more constraints are not satisfied, false otherwise.

◆ get_derivatives()

template<typename FP , size_t NumExposed, size_t NumInfectedNoSymptoms, size_t NumInfectedSymptoms, size_t NumInfectedSevere, size_t NumInfectedCritical>
void mio::glsecir::Model< FP, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical >::get_derivatives ( Eigen::Ref< const Eigen::VectorX< FP >>  pop,
Eigen::Ref< const Eigen::VectorX< FP >>  y,
FP  t,
Eigen::Ref< Eigen::VectorX< FP >>  dydt 
) const
inlineoverridevirtual

Evaluates the right-hand-side f of the GLCT dydt = f(y, t).

The GLCT-SECIR model is defined through ordinary differential equations of the form dydt = f(y, t). y is a vector containing number of individuals for each (sub-) compartment. This function evaluates the right-hand-side f of the ODE and can be used in an ODE solver.

Parameters
[in]popThe current state of the population in the geographic unit we are considering.
[in]yThe current state of the model (or a subpopulation) as a flat array.
[in]tThe current time.
[out]dydtA reference to the calculated output.

Reimplemented from mio::CompartmentalModel< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 >, mio::Populations< FP, LctInfectionState< FP, InfectionState, 1, NumExposed, NumInfectedNoSymptoms, NumInfectedSymptoms, NumInfectedSevere, NumInfectedCritical, 1, 1 > >, Parameters< FP > >.