SciCompMod / memilio

Modular spatio-temporal models for epidemic and pandemic simulations
https://scicompmod.github.io/memilio/
Apache License 2.0
51 stars 15 forks source link

include vaccinations and virus variants in get_derivatives of vaccination model #235

Open dabele opened 2 years ago

dabele commented 2 years ago

Currently, vaccinations and virus variants are applied in secirv::Simulation::apply by modifying parameters or directly setting compartments. I think this is not ideal, as they could be included more elegantly in secirv::Model::get_derivatives.

In general we should limit the places in the code where compartments or parameters are modifed, otherwise the model becomes very hard to follow.

E.g., daily first vaccinations are the flow from compartment Susceptible to SusceptiblePartiallyImmune.

mknaranja commented 2 years ago

A base for this discussion could be what we had implemented in the parameter DynamicInfectionFromContact here:

https://github.com/DLR-SC/memilio/pull/233/files/cda84d1dd6db5bdc8a5b67354dcb65f443bc52d1#diff-ec5f30db7521beeba42314e5ef7c1e097edea1667dc21478f55ab0e6885a6cbbR152-R166:

        for (auto i = AgeGroup(0); i < shared_params_model.parameters.get_num_groups(); ++i) {
            shared_params_model.parameters.template get<BaseInfectiousnessB117>()[i] =
                shared_params_model.parameters.template get<InfectionProbabilityFromContact>()[i];
            shared_params_model.parameters.template get<BaseInfectiousnessB161>()[i] =
                shared_params_model.parameters.template get<InfectionProbabilityFromContact>()[i] * delta_fac;
            shared_params_model.parameters.template get<DynamicInfectionFromContact>()[i] = {};
            for (size_t t = 0; t < (size_t)tmax; ++t) {
                double share_new_variant = std::min(1.0, pow(2, (double)t / 7) / 100.0);
                double new_transmission =
                    (1 - share_new_variant) * shared_params_model.parameters.template get<BaseInfectiousnessB117>()[(AgeGroup)i] +
                    share_new_variant * shared_params_model.parameters.template get<BaseInfectiousnessB161>()[(AgeGroup)i];
                shared_params_model.parameters.template get<DynamicInfectionFromContact>()[i].push_back(
                    new_transmission);
            }
        }