-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding makefile and main * Updating example notes * Adding examples to makefile * Bumping version * Multiple patches * Update README.md * Update main.cpp * Adding a print to the lfmcmc test * Adding a note about the stored data in print * Add test of correct and error print burnin in tests/00-lfmcmc.cpp * Fix lfmcmc printing error and add descriptive comments --------- Co-authored-by: Andrew Pulsipher <[email protected]>
- Loading branch information
1 parent
27c32a5
commit bb8d6e8
Showing
13 changed files
with
364 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
main.o: main.cpp | ||
g++ -std=c++17 -O3 -g main.cpp -o main.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Community-hospital model | ||
|
||
In this model, we have three states: | ||
|
||
- Susceptible individuals (in the community), | ||
- Infected individuals (in the community), and | ||
- Infected hospitalized individuals. | ||
|
||
Susceptible individuals may become hospitalized or not (so they have two possible transitions), and infected individuals may recover or (if hospitalized) stay infected but be discharged (so they go back as infected but in the community). | ||
|
||
The model has the following parameters: | ||
|
||
- Prob hospitalization: 0.1 | ||
- Prob recovery: 0.33 | ||
- Discharge infected: 0.1 | ||
|
||
Here is an example of the run | ||
|
||
```bash | ||
root ➜ /workspaces/epiworld/examples/14-community-hosp $ make | ||
g++ -std=c++17 -O3 -g main.cpp -o main.o | ||
root ➜ /workspaces/epiworld/examples/14-community-hosp $ ./main.o | ||
_________________________________________________________________________ | ||
Running the model... | ||
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| done. | ||
done. | ||
________________________________________________________________________________ | ||
________________________________________________________________________________ | ||
SIMULATION STUDY | ||
|
||
Name of the model : (none) | ||
Population size : 1000 | ||
Agents' data : (none) | ||
Number of entities : 0 | ||
Days (duration) : 100 (of 100) | ||
Number of viruses : 1 | ||
Last run elapsed t : 4.00ms | ||
Last run speed : 20.81 million agents x day / second | ||
Rewiring : off | ||
Global events: | ||
(none) | ||
Virus(es): | ||
- MRSA | ||
Tool(s): | ||
(none) | ||
Model parameters: | ||
- Discharge infected : 0.1000 | ||
- Prob hospitalization : 0.1000 | ||
- Prob recovery : 0.3300 | ||
Distribution of the population at time 100: | ||
- (0) Susceptible : 990 -> 937 | ||
- (1) Infected : 10 -> 49 | ||
- (2) Infected (hospitalized) : 0 -> 14 | ||
Transition Probabilities: | ||
- Susceptible 0.98 0.02 0.00 | ||
- Infected 0.32 0.61 0.07 | ||
- Infected (hospitalized) 0.35 0.07 0.58 | ||
``` | ||
## Notes | ||
A few key observations from this example. | ||
1. **We have a sampling function that exclude population**. These two functions are used in the update functions so the sampling excludes hospitalized individuals: | ||
```cpp | ||
// A sampler that excludes infected from the hospital | ||
auto sampler_suscept = sampler::make_sample_virus_neighbors<>( | ||
{States::Infected_Hospitalized} | ||
); | ||
``` | ||
2. **All update functions are built from scratch**. For instance, susceptible individuals are updated according to the following function: | ||
```cpp | ||
inline void update_susceptible(Agent<int> * p, Model<int> * m) | ||
{ | ||
auto virus = sampler_suscept(p, m); | ||
if (virus != nullptr) | ||
{ | ||
if (m->par("Prob hospitalization") > m->runif()) | ||
p->set_virus(*virus, m, States::Infected_Hospitalized); | ||
else | ||
p->set_virus(*virus, m, States::Infected); | ||
} | ||
return; | ||
} | ||
``` |
Oops, something went wrong.