Skip to content

1003 implement ode seir metapopulation model #1273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 102 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
2d4aec1
add model with Populations with Regions
charlie0614 Apr 11, 2024
9416256
working SIR model without infections during commuting
charlie0614 Apr 24, 2024
12c9c09
add infections during commuting and age groups
charlie0614 Apr 26, 2024
2b883b6
read in mobility data for new model
charlie0614 Apr 26, 2024
d49a048
only add edges if weight is big enough
charlie0614 Apr 26, 2024
56c4dd4
correct age resolution
charlie0614 May 8, 2024
0efa8db
add tests
charlie0614 Jun 10, 2024
05e3717
add seir version of mobility model
charlie0614 Jun 17, 2024
f475e3c
small adjustments sir version
charlie0614 Jun 17, 2024
68632c5
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Jun 17, 2024
f19bcf6
fixes after merge
charlie0614 Jun 18, 2024
6ace8cf
Renaming
charlie0614 Jul 25, 2024
232f705
Renaming
charlie0614 Jul 25, 2024
6045e1f
Set up examples for comparison
charlie0614 Jul 25, 2024
dfdac2d
changes for plots and corrections
charlie0614 Jul 29, 2024
16a07da
add improved model
charlie0614 Sep 19, 2024
23196bc
changes for comparing simulations
charlie0614 Sep 19, 2024
4193cd6
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Sep 26, 2024
bfc2562
adjust plot file
charlie0614 Sep 26, 2024
c6b56e9
reformat py file
charlie0614 Sep 26, 2024
5e51d69
py file
charlie0614 Sep 26, 2024
0eff4d1
py file
charlie0614 Sep 26, 2024
3d3b007
change commuting strengths to contact matrix and implement indicator …
charlie0614 Sep 30, 2024
9f0fba7
return to factor 0.5
charlie0614 Oct 7, 2024
8908d01
read in data and time measurement 400 counties
charlie0614 Oct 8, 2024
06950d9
small corrections model
charlie0614 Oct 8, 2024
aad78a9
corrections again
charlie0614 Oct 10, 2024
2bdb791
change integrator in graph model
charlie0614 Oct 10, 2024
3c6f630
fix bug with age groups and discard transmissions during commuting
charlie0614 Nov 7, 2024
aa6b393
adapt structure of old model
charlie0614 Nov 7, 2024
e6e6d70
add computation of basis reproduction number for old model
charlie0614 Nov 8, 2024
649467c
add computation of basis reproduction numbers and changes for countin…
charlie0614 Nov 20, 2024
4239fa7
small cleanup
charlie0614 Nov 28, 2024
2c4de48
read in population data
charlie0614 Dec 1, 2024
ce86fb6
debugging artefacts
charlie0614 Dec 1, 2024
d378118
more cleanup and provide demo population for a number of agegroups di…
charlie0614 Dec 2, 2024
33a2dd5
read in contact matrices, set age resolved parameters, restructure
charlie0614 Dec 2, 2024
c1bd747
add bool for using population from data
charlie0614 Dec 3, 2024
df22f54
read in data for graph model
charlie0614 Dec 3, 2024
7b30779
simulation for nrw, plots and a bug fix
charlie0614 Dec 12, 2024
f49a497
add timing example
charlie0614 Dec 13, 2024
64744ab
cmake changes for timing
charlie0614 Dec 13, 2024
a262104
fix bug for measuring runtimes and graph timing example
charlie0614 Dec 13, 2024
565141c
fix bug for graph timing
charlie0614 Dec 13, 2024
9f36912
fix things for runtime measurements
charlie0614 Dec 16, 2024
ee57c8f
add plotfiles, small correction in the model and maybe optimizations
charlie0614 Dec 18, 2024
d8b321f
mini optimizations and small changes for timing runs
charlie0614 Dec 19, 2024
7dc7e44
add simulations for paper model and comparison of basic reproduction …
charlie0614 Dec 19, 2024
90a8d3e
small changes in plots
charlie0614 Dec 19, 2024
c78c996
fix runtime maybe
charlie0614 Dec 20, 2024
cd056b5
adjust timing examples for single age group
charlie0614 Dec 31, 2024
fba237a
remove prints from simulations
charlie0614 Jan 9, 2025
363bf85
add examples for basic reproduction numbers, and measurements of steps
charlie0614 Jan 9, 2025
fd2bfdd
remove synthetic population for simulation
charlie0614 Jan 9, 2025
33bf7a9
small improvement model c
charlie0614 Jan 9, 2025
24883f3
remove steps from timing example
charlie0614 Jan 9, 2025
4db243d
changes in plots
charlie0614 Jan 9, 2025
8084deb
fix bug in model b
charlie0614 Jan 12, 2025
9b87803
fix bug in computation of basic reproduction number as well
charlie0614 Jan 12, 2025
f7f3eca
add likwid test example
Jan 14, 2025
c74474f
new likwid example
Jan 14, 2025
a4fb5d7
likwid examples
Jan 17, 2025
172998a
optimize model
charlie0614 Jan 23, 2025
87faada
cleanup timing files
charlie0614 Feb 5, 2025
45cad87
cleanup step files
charlie0614 Feb 5, 2025
b0e9827
restructure for thesis submission
charlie0614 Feb 5, 2025
9f8334f
add system flag for boost again
charlie0614 Feb 5, 2025
a4351e3
rename ode_seir_mobility
charlie0614 Feb 5, 2025
f18a2ef
rename namespaces of metapopulation models
charlie0614 Feb 5, 2025
7795832
small corrections
charlie0614 Feb 5, 2025
995f59b
cleanup plot file results
charlie0614 Feb 5, 2025
32c74ad
cleanup plot file runtimes
charlie0614 Feb 5, 2025
629e886
change colors in plots
charlie0614 Feb 5, 2025
c61dac5
add shellscripts for runtimes and steps
charlie0614 Feb 5, 2025
6e56e39
delete redundant plot
charlie0614 Feb 5, 2025
d84d5a3
optimizations ode model
charlie0614 Mar 10, 2025
a5540f9
remove old examples
charlie0614 Mar 27, 2025
137feab
Merge branch 'main' into 1003-implement-model-in-which-the-mobility-i…
charlie0614 Mar 27, 2025
1291acd
format python file
charlie0614 Mar 28, 2025
d4e9341
format more python files
charlie0614 Mar 28, 2025
c48fc83
resolve pyupgrade issue
charlie0614 Mar 31, 2025
6782917
commit likwid examples
charlie0614 Mar 31, 2025
51a28f4
rename mio::Vector in metapop models
charlie0614 Apr 2, 2025
b9d0fbb
adjust to changed data structure
charlie0614 Apr 4, 2025
881cb5b
adjust to changed data structure
charlie0614 Apr 4, 2025
86fdc27
CHG: Adapt paths to new folder structure
kilianvolmer Apr 16, 2025
298636a
adjustments for testing
charlie0614 Apr 24, 2025
d7ba3c5
add tests
charlie0614 Apr 30, 2025
e2f3864
continue working on tests and restructure population after commuting
charlie0614 May 5, 2025
67e6d22
add minimal metapop example
charlie0614 May 12, 2025
04f3033
Merge branch '1003-implement-model-in-which-the-mobility-is-integrate…
charlie0614 May 12, 2025
77f2d97
delete thesis examples and rename model
charlie0614 May 12, 2025
5800934
remove timing artifacts
charlie0614 May 12, 2025
ceea756
renamed model
charlie0614 May 12, 2025
99fe446
renamed model 2
charlie0614 May 12, 2025
22a94f4
remove superfluous include omp
charlie0614 May 12, 2025
fd323b0
correct setting of population after commuting
charlie0614 May 13, 2025
b2d266a
comment in tests
charlie0614 May 13, 2025
baf54e7
correct test and add compare files
charlie0614 May 13, 2025
13ec735
remove debugging artifact
charlie0614 May 13, 2025
fc94b55
add documentation
charlie0614 May 14, 2025
172c674
change error handling to include
charlie0614 May 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ if(MEMILIO_BUILD_MODELS)
add_subdirectory(models/ode_seir)
add_subdirectory(models/ode_seair)
add_subdirectory(models/ode_sir)
add_subdirectory(models/ode_seir_metapop)
add_subdirectory(models/sde_sir)
add_subdirectory(models/sde_sirs)
add_subdirectory(models/sde_seirvv)
Expand Down
4 changes: 4 additions & 0 deletions cpp/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ add_executable(graph_stochastic_mobility_example graph_stochastic_mobility.cpp)
target_link_libraries(graph_stochastic_mobility_example PRIVATE memilio ode_secir)
target_compile_options(graph_stochastic_mobility_example PRIVATE ${MEMILIO_CXX_FLAGS_ENABLE_WARNING_ERRORS})

add_executable(ode_metapop_seir_example ode_seir_metapop.cpp)
target_link_libraries(ode_metapop_seir_example PRIVATE memilio ode_seir_metapop)
target_compile_options(ode_metapop_seir_example PRIVATE ${MEMILIO_CXX_FLAGS_ENABLE_WARNING_ERRORS})

add_executable(abm_minimal_example abm_minimal.cpp)
target_link_libraries(abm_minimal_example PRIVATE memilio abm)
target_compile_options(abm_minimal_example PRIVATE ${MEMILIO_CXX_FLAGS_ENABLE_WARNING_ERRORS})
Expand Down
42 changes: 42 additions & 0 deletions cpp/examples/ode_seir_metapop.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "memilio/compartments/simulation.h"
#include "memilio/utils/custom_index_array.h"
#include "models/ode_seir_metapop/infection_state.h"
#include "models/ode_seir_metapop/model.h"
#include "models/ode_seir_metapop/parameters.h"
#include "models/ode_seir_metapop/regions.h"

int main()
{
const ScalarType t0 = 0.;
const ScalarType tmax = 10;
ScalarType dt = 0.1;

mio::oseirmetapop::Model<ScalarType> model(3, 1);

for (size_t i = 0; i < (size_t)model.parameters.get_num_regions(); i++) {
model.populations[{mio::oseirmetapop::Region(i), mio::AgeGroup(0),
mio::oseirmetapop::InfectionState::Susceptible}] = 10000;
}

model.populations[{mio::oseirmetapop::Region(0), mio::AgeGroup(0), mio::oseirmetapop::InfectionState::Exposed}] +=
100;
model.populations[{mio::oseirmetapop::Region(0), mio::AgeGroup(0),
mio::oseirmetapop::InfectionState::Susceptible}] -= 100;

Eigen::MatrixXd mobility_data_commuter(3, 3);
mobility_data_commuter << 0.4, 0.3, 0.3, 0.2, 0.7, 0.1, 0.4, 0.1, 0.5;

model.set_commuting_strengths(mobility_data_commuter);

model.parameters.template get<mio::oseirmetapop::ContactPatterns<>>()
.get_cont_freq_mat()[0]
.get_baseline()
.setConstant(2.7);

model.parameters.set<mio::oseirmetapop::TimeExposed<>>(3.335);
model.parameters.set<mio::oseirmetapop::TimeInfected<>>(8.097612257);
model.parameters.set<mio::oseirmetapop::TransmissionProbabilityOnContact<>>(0.07333);

auto result = simulate(t0, tmax, dt, model);
return 0;
}
13 changes: 13 additions & 0 deletions cpp/models/ode_seir_metapop/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
add_library(ode_seir_metapop
infection_state.h
model.h
model.cpp
parameters.h
regions.h
)
target_link_libraries(ode_seir_metapop PUBLIC memilio)
target_include_directories(ode_seir_metapop PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_compile_options(ode_seir_metapop PRIVATE ${MEMILIO_CXX_FLAGS_ENABLE_WARNING_ERRORS})
44 changes: 44 additions & 0 deletions cpp/models/ode_seir_metapop/infection_state.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2020-2025 MEmilio
*
* Authors: Carlotta Gerstein
*
* Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ODESEIRMETAPOP_INFECTIONSTATE_H
#define ODESEIRMETAPOP_INFECTIONSTATE_H

namespace mio
{
namespace oseirmetapop
{

/**
* @brief The InfectionState enum describes the possible
* categories for the infectious state of persons
*/
enum class InfectionState
{
Susceptible,
Exposed,
Infected,
Recovered,
Count
};

} // namespace oseirmetapop
} // namespace mio

#endif // ODESEIR_INFECTIONSTATE_H
28 changes: 28 additions & 0 deletions cpp/models/ode_seir_metapop/model.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (C) 2020-2025 MEmilio
*
* Authors: Carlotta Gerstein
*
* Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ode_seir_metapop/model.h"

namespace mio
{
namespace oseirmetapop
{

} // namespace oseirmetapop
} // namespace mio
Loading
Loading