Initializer< FP, Model > Class Template Reference
|
CPP API
|
Class that can be used to compute an initialization vector out of flows for an LCT Model with division in groups. More...
#include <initializer_flows.h>
Public Types | |
| using | LctStatesGroups = typename Model::LctStatesGroups |
Public Member Functions | |
| bool | compute_initialization_vector (Eigen::VectorX< FP > const &total_population, Eigen::VectorX< FP > const &deaths, Eigen::VectorX< FP > const &total_confirmed_cases) |
| Core function of Initializer. More... | |
| Initializer (TimeSeries< FP > &&flows, Model &model) | |
| Constructs a new Initializer object. More... | |
| void | set_tol_for_support_max (FP new_tol) |
| Setter for the tolerance used to calculate the maximum support of ErlangDensitys. More... | |
Private Member Functions | |
| bool | check_constraints () const |
| Checks constraints of the Initializer including checks for the model. More... | |
| template<InfectionState State, size_t Group> | |
| bool | compute_compartment (Eigen::VectorX< FP > &init, Eigen::Index idx_incoming_flow, FP transition_rate) const |
| Computes a slice of the initial value vector for each subcompartment of one InfectionState for a specified group. More... | |
| template<size_t Group = 0> | |
| bool | compute_initialization_vector_impl (Eigen::VectorX< FP > &init, Eigen::VectorX< FP > const &total_population, Eigen::VectorX< FP > const &deaths, Eigen::VectorX< FP > const &total_confirmed_cases) |
| Implementation of the calculation of the initial value vector slice that corresponds to a specified group. More... | |
Private Attributes | |
| FP | m_dt {} |
| Step size of the times in m_flows and time step for the approximation of the integral. More... | |
| TimeSeries< FP > | m_flows |
| TimeSeries with the flows which are used to calculate the initial vector. More... | |
| Model & | m_model |
| The LCT-SECIR model for which the initialization should be performed. More... | |
| FP | m_tol {1e-10} |
| Tolerance used to calculate the maximum support of the ErlangDensitys. More... | |
Detailed Description
template<typename FP, typename Model>
class mio::lsecir::Initializer< FP, Model >
Class that can be used to compute an initialization vector out of flows for an LCT Model with division in groups.
The initialization method is based on the fact that the LCT model is a special case of an IDE model with special choices of stay time distributions (so-called Erlang distributions). Accordingly, the method for calculating initial values for the compartments from given flows/transitions is taken from the IDE-SECIR model. We cannot use the functionality of the IDE model directly, as we have to calculate a division into sub-compartments and not only the sizes of the compartments. See also the IDE-SECIR model for the general method and for a better understanding of flows/transitions.
- Template Parameters
-
Model is expected to be an LCT-SECIR model defined in models/lct_secir/model.h.
Member Typedef Documentation
◆ LctStatesGroups
| using mio::lsecir::Initializer< FP, Model >::LctStatesGroups = typename Model::LctStatesGroups |
Constructor & Destructor Documentation
◆ Initializer()
|
inline |
Constructs a new Initializer object.
- Parameters
-
[in] flows Initializing TimeSeries with flows fitting to these defined in InfectionTransition. For each group of m_model, InfectionTransition::Count entries are required. Timesteps should be equidistant and the values should be non-negative. The time history has to be long enough so that it is possible to calculate the initial vector. The length of the required time history depends on the Erlang densities used to compute the initial vector. [in,out] model The LCT-SECIR model for which the initialization should be performed.
Member Function Documentation
◆ check_constraints()
|
inlineprivate |
Checks constraints of the Initializer including checks for the model.
- Returns
- Returns true if one (or more) constraint(s) are not satisfied, otherwise false.
◆ compute_compartment()
|
inlineprivate |
Computes a slice of the initial value vector for each subcompartment of one InfectionState for a specified group.
- Template Parameters
-
Group The group for which the corresponding slice of the initial value vector is calculated. State The InfectionState for which the corresponding slice of the initial value vector is calculated
- Parameters
-
[out] init The initial value vector under consideration. [in] idx_incoming_flow Index of the flow which is relevant for the calculation, so the flow to the InfectionState. [in] transition_rate Specifies the transition rate of the InfectionState. 'This is equal to 1 / (expected time in the InfectionState).
- Returns
- Returns true if one (or more) constraint(s) of the computed slice of the initial value vector are not satisfied, otherwise false.
◆ compute_initialization_vector()
|
inline |
Core function of Initializer.
Computes a vector that can be used for the initialization of an LCT model stratified by groups with the number of persons for each subcompartment for each group. The initial value vector is updated in the model.
- Parameters
-
[in] total_population The total size of the considered population. [in] deaths Number of deceased people from the disease at time 0. [in] total_confirmed_cases Total number of confirmed cases at time 0.
- Returns
- Returns true if one (or more) constraint(s) of the model, the initial flows or the computed initial value vector are not satisfied, otherwise false.
◆ compute_initialization_vector_impl()
|
inlineprivate |
Implementation of the calculation of the initial value vector slice that corresponds to a specified group.
Computes a vector that can be used for the initialization of an LCT model stratified by groups with the number of persons for each subcompartment. The groups are calculated recursively.
- Template Parameters
-
Group The group for which the corresponding slice of the initial value vector is calculated.
- Parameters
-
[out] init The initial value vector under consideration. [in] total_population The total size of the considered population. [in] deaths Number of deceased people from the disease at time 0. [in] total_confirmed_cases Total number of confirmed cases at time 0.
- Returns
- Returns true if one (or more) constraint(s) of the computed initial value vector are not satisfied, otherwise false.
◆ set_tol_for_support_max()
|
inline |
Setter for the tolerance used to calculate the maximum support of ErlangDensitys.
- Parameters
-
[in] new_tol New tolerance.
Member Data Documentation
◆ m_dt
|
private |
Step size of the times in m_flows and time step for the approximation of the integral.
◆ m_flows
|
private |
TimeSeries with the flows which are used to calculate the initial vector.
◆ m_model
|
private |
The LCT-SECIR model for which the initialization should be performed.
◆ m_tol
|
private |
Tolerance used to calculate the maximum support of the ErlangDensitys.
Generated by