model.h Source File
|
CPP API
|
ode_seir_metapop/model.h
Go to the documentation of this file.
49 class Model : public FlowModel<FP, InfectionState, mio::Populations<FP, mio::regions::Region, AgeGroup, InfectionState>,
53 using Base = FlowModel<FP, InfectionState, mio::Populations<FP, mio::regions::Region, AgeGroup, InfectionState>,
78 void get_flows(Eigen::Ref<const Eigen::VectorX<FP>> pop, Eigen::Ref<const Eigen::VectorX<FP>> y, FP t,
85 params.template get<CommutingStrengths<>>().get_cont_freq_mat().get_matrix_at(SimulationTime<FP>(t));
125 flows[Base::template get_flat_flow_index<Exposed, Infected>({Region(region), AgeGroup(age_i)})] =
128 flows[Base::template get_flat_flow_index<Infected, Recovered>({Region(region), AgeGroup(age_i)})] =
141 IOResult<ScalarType> get_reproduction_number(size_t t_idx, const mio::TimeSeries<ScalarType>& y)
144 return mio::failure(mio::StatusCode::OutOfRange, "t_idx is not a valid index for the TimeSeries");
153 const size_t total_infected_compartments = num_infected_compartments * num_age_groups * num_regions;
155 ContactMatrixGroup<ScalarType> const& contact_matrix = params.template get<ContactPatterns<ScalarType>>();
158 auto const& population_after_commuting = params.template get<PopulationAfterCommuting<ScalarType>>();
160 Eigen::MatrixXd F = Eigen::MatrixXd::Zero(total_infected_compartments, total_infected_compartments);
161 Eigen::MatrixXd V = Eigen::MatrixXd::Zero(total_infected_compartments, total_infected_compartments);
196 V(num_age_groups * num_regions + i.get() * num_regions + n.get(), i.get() * num_regions + n.get()) =
205 Eigen::MatrixXd NextGenMatrix = Eigen::MatrixXd::Zero(total_infected_compartments, total_infected_compartments);
represents a collection of contact frequency matrices that whose sum is the total number of contacts.
Definition: contact_matrix.h:536
A FlowModel is a CompartmentalModel defined by the flows between compartments.
Definition: flow_model.h:74
Typesafe wrapper for a floating-point simulation time value (in days).
Definition: damping.h:78
Eigen::Ref< const Vector > get_value(Eigen::Index i) const
reference to value vector at time point i
Definition: time_series.h:298
Eigen::Index get_num_time_points() const
number of time points in the series
Definition: time_series.h:197
FP & get_time(Eigen::Index i)
time of time point at index i
Definition: time_series.h:272
The Model holds the Parameters and the initial Populations for every region and defines the ordinary ...
Definition: ode_seir_metapop/model.h:51
void set_commuting_strengths(const Eigen::MatrixXd &commuting_strengths)
Set the CommutingStrengths matrix and update the PopulationAfterCommuting.
Definition: ode_seir_metapop/model.h:235
void serialize(IOContext &io) const
serialize this.
Definition: ode_seir_metapop/model.h:281
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 override
Compute the values of the flows between compartments at a given time.
Definition: ode_seir_metapop/model.h:78
Eigen::VectorXd get_reproduction_numbers(const mio::TimeSeries< ScalarType > &y)
Computes the reproduction number for all time points of the Model output obtained by the Simulation.
Definition: ode_seir_metapop/model.h:221
Model(int num_regions, int num_agegroups)
Create a Model with the given number of Regions and AgeGroups.
Definition: ode_seir_metapop/model.h:65
static IOResult< Model > deserialize(IOContext &io)
deserialize an object of this class.
Definition: ode_seir_metapop/model.h:293
void set_commuting_strengths()
Set the CommutingStrengths matrix without data.
Definition: ode_seir_metapop/model.h:270
IOResult< ScalarType > get_reproduction_number(size_t t_idx, const mio::TimeSeries< ScalarType > &y)
Computes the reproduction number at a given index time of the Model output obtained by the Simulation...
Definition: ode_seir_metapop/model.h:141
Parameters of the SEIR metapopulation model.
Definition: ode_seir_metapop/parameters.h:153
IOResult< FP > get_reproduction_number(size_t t_idx, const Simulation< FP, Base > &sim)
Computes the reproduction number at a given index time of the Model output obtained by the Simulation...
Definition: ode_secir/model.h:434
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
auto failure(const IOStatus &s)
Create an object that is implicitly convertible to an error IOResult<T>.
Definition: io.h:381
@ OutOfRange
boost::outcome_v2::in_place_type_t< T > Tag
Type that is used for overload resolution.
Definition: io.h:408
details::ApplyResultT< F, T... > apply(IOContext &io, F f, const IOResult< T > &... rs)
Evaluate a function with zero or more unpacked IOResults as arguments.
Definition: io.h:482
auto success()
Create an object that is implicitly convertible to a succesful IOResult<void>.
Definition: io.h:360
constexpr std::tuple_element< I, std::tuple< Index< CategoryTags >... > >::type & get(Index< CategoryTags... > &i) noexcept
Retrieves the Index (by reference) at the Ith position of a MultiIndex.
Definition: index.h:304
boost::outcome_v2::unchecked< T, IOStatus > IOResult
Value-or-error type for operations that return a value but can fail.
Definition: io.h:354
A Flow defines a possible transition between two Compartments in a FlowModel.
Definition: flow.h:33
Collection of types. Each type is mapped to an index of type size_t.
Definition: type_list.h:32
The latent time in day unit.
Definition: ode_seir_metapop/parameters.h:63
The infectious time in day unit.
Definition: ode_seir_metapop/parameters.h:79
Probability of getting infected from a contact.
Definition: ode_seir_metapop/parameters.h:47
Index for enumerating subregions (cities, counties, etc.) of the modelled area.
Definition: regions.h:37
Generated by